blob: 57cd88cc9939522928efbc7e826a00638f1db82b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/* ISC license. */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <unistd.h>
#include <errno.h>
#include <sys/syscall.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
static int getrandom (void *buf, size_t buflen, unsigned int flags)
{
#ifdef SYS_getrandom
return syscall(SYS_getrandom, buf, buflen, flags) ;
#else
return (errno = ENOSYS, -1) ;
#endif
}
int main (void)
{
char buf[256] ;
PROG = "s6-fillurandompool" ;
if (getrandom(buf, 256, 0) != 256)
strerr_diefu1sys(111, "getrandom") ;
return 0 ;
}
|