Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libc/src/__support/OSUtil/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ add_object_library(
libc.src.errno.errno
libc.src.sys.auxv.getauxval
)

2 changes: 2 additions & 0 deletions libc/src/__support/OSUtil/linux/aarch64/vdso.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ LIBC_INLINE constexpr cpp::string_view symbol_name(VDSOSym sym) {
return "__kernel_clock_gettime";
case VDSOSym::ClockGetRes:
return "__kernel_clock_getres";
case VDSOSym::GetRandom:
return "__kernel_getrandom";
default:
return "";
}
Expand Down
9 changes: 6 additions & 3 deletions libc/src/__support/OSUtil/linux/vdso_sym.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ struct __kernel_timespec;
struct timezone;
struct riscv_hwprobe;
struct getcpu_cache;
struct cpu_set_t;
// NOLINTEND(llvmlibc-implementation-in-namespace)

namespace LIBC_NAMESPACE_DECL {
Expand All @@ -35,7 +34,8 @@ enum class VDSOSym {
RTSigReturn,
FlushICache,
RiscvHwProbe,
VDSOSymCount
GetRandom,
VDSOSymCount,
};

template <VDSOSym sym> LIBC_INLINE constexpr auto dispatcher() {
Expand All @@ -58,8 +58,11 @@ template <VDSOSym sym> LIBC_INLINE constexpr auto dispatcher() {
else if constexpr (sym == VDSOSym::FlushICache)
return static_cast<void (*)(void *, void *, unsigned int)>(nullptr);
else if constexpr (sym == VDSOSym::RiscvHwProbe)
return static_cast<int (*)(riscv_hwprobe *, size_t, size_t, cpu_set_t *,
return static_cast<int (*)(riscv_hwprobe *, size_t, size_t, void *,
unsigned)>(nullptr);
else if constexpr (sym == VDSOSym::GetRandom)
return static_cast<int (*)(void *, size_t, unsigned int, void *, size_t)>(
nullptr);
else
return static_cast<void *>(nullptr);
}
Expand Down
2 changes: 2 additions & 0 deletions libc/src/__support/OSUtil/linux/x86_64/vdso.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ LIBC_INLINE constexpr cpp::string_view symbol_name(VDSOSym sym) {
return "__vdso_time";
case VDSOSym::ClockGetRes:
return "__vdso_clock_getres";
case VDSOSym::GetRandom:
return "__vdso_getrandom";
default:
return "";
}
Expand Down
2 changes: 1 addition & 1 deletion libc/src/__support/threads/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class ThreadAtExitCallbackMgr {

int add_callback(AtExitCallback *callback, void *obj) {
cpp::lock_guard lock(mtx);
return callback_list.push_back({callback, obj});
return callback_list.push_back({callback, obj}) ? 0 : -1;
}

void call() {
Expand Down
20 changes: 20 additions & 0 deletions libc/src/stdlib/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,23 @@ add_entrypoint_object(
libc.src.signal.raise
libc.src.stdlib._Exit
)

add_object_library(
cprng
HDRS
cprng.h
SRCS
cprng.cpp
DEPENDS
libc.src.__support.common
libc.src.__support.OSUtil.linux.vdso
libc.src.__support.threads.callonce
libc.src.__support.threads.linux.raw_mutex
libc.src.__support.CPP.optional
libc.src.__support.CPP.new
libc.src.sys.mman.mmap
libc.src.sys.mman.munmap
libc.src.unistd.sysconf
libc.src.sched.sched_getaffinity
libc.src.sched.__sched_getcpucount
)
Loading
Loading