summaryrefslogtreecommitdiff
path: root/src/sysdeps/trygetrandom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysdeps/trygetrandom.c')
-rw-r--r--src/sysdeps/trygetrandom.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/sysdeps/trygetrandom.c b/src/sysdeps/trygetrandom.c
index 8abe3dd..cc2426b 100644
--- a/src/sysdeps/trygetrandom.c
+++ b/src/sysdeps/trygetrandom.c
@@ -1,24 +1,10 @@
/* ISC license. */
-#undef _POSIX_C_SOURCE
-#undef _XOPEN_SOURCE
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-
-static int getrandom (void *buf, size_t buflen, unsigned int flags)
-{
- return syscall(SYS_getrandom, buf, buflen, flags) ;
-}
+#include <sys/random.h>
int main (void)
{
char buf[4] ;
- if (getrandom(buf, 4, 0) < 0) return 1 ;
+ if (getrandom(buf, 4, GRND_NONBLOCK) < 0) return 1 ;
return 0 ;
}