summaryrefslogtreecommitdiff
path: root/src/sysdeps/trygetrandom.c
blob: b6cda1845196ff3f0fa7bc0416107d2c32485bb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* 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] ;
  return getrandom(buf, 4, 0) ;
}