--- a/include/random/sys/random.h (index) +++ b/include/random/sys/random.h (working tree) @@ -4,9 +4,9 @@ extern "C" { #endif -#define __NEED_size_t -#define __NEED_ssize_t -#include +#include + +#if !defined(SYS_getrandom) +#if defined(__x86_64__) + #define SYS_getrandom 318 +#elif defined(__i386__) + #define SYS_getrandom 355 +#elif defined(__aarch64__) + #define SYS_getrandom 278 +#elif defined(__arm__) + #define SYS_getrandom 384 +#elif defined(__powerpc__) + #define SYS_getrandom 359 +#else +#error Unsupported platform +#endif +#endif #define GRND_NONBLOCK 0x0001 #define GRND_RANDOM 0x0002 --- a/getrandom.c (index) +++ b/getrandom.c (working tree) @@ -3,5 +3,5 @@ ssize_t getrandom(void *buf, size_t buflen, unsigned flags) { - return syscall_cp(SYS_getrandom, buf, buflen, flags); + return syscall(SYS_getrandom, buf, buflen, flags); }