The problem was resolved by updating the C library.
I would like to use syscall getrandom ( http://man7.org/linux/man-pages/man2/getrandom.2.html )
gcc-5 -std = c11 test.c
#include <sys/types.h> #include <sys/stat.h> #include <sys/fcntl.h> #include <errno.h> #include <string.h> #include <signal.h> #include <linux/random.h> #include <sys/syscall.h> int main(void) { void *buf = NULL; size_t l = 5; unsigned int o = 1; int r = syscall(SYS_getrandom, buf, l, o); return 0; }
or
int main(void) { void *buf = NULL; size_t l = 5; unsigned int o = 1; int r = getrandom(buf, l, o); return 0; }
Anyway, when I try to compile it with gcc-5:
test.c: In function 'main': test.c:14:17: warning: implicit declaration of function 'getrandom' [-Wimplicit-function-declaration] int r = getrandom(buf, l, o); ^ /tmp/ccqFdJAJ.o: In function `main': test.c:(.text+0x36): undefined reference to `getrandom' collect2: error: ld returned 1 exit status
I am using Ubuntu 14.04, what can I do to use getrandom? How is this a βnewβ syscall, how can I use it?
edit:
uname -r -> 4.0.3-040003-generic
when I replace r with int r = syscall(SYS_getrandom, buf, l, o); or r = getrandom (buf, l, o) is the same.
source share