blob: 8abe3dd81df9760416f76445ae08620a3b725da7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/* 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) ;
}
int main (void)
{
char buf[4] ;
if (getrandom(buf, 4, 0) < 0) return 1 ;
return 0 ;
}
|