summaryrefslogtreecommitdiff
path: root/src/sysdeps/trygetrandom.c
blob: 67a623d664e9a0d05a3cb9392e150f25dd669441 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* ISC license. */

#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <sys/types.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] ;
  return getrandom(buf, 4, 0) ;
}