about summary refs log tree commit diff
path: root/src/minutils/s6-fillurandompool.c
blob: 775f289173da8b50618f93995ad38ab99d96e6fb (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
/* ISC license. */

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <unistd.h>
#include <sys/syscall.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>

#define USAGE "s6-fillurandompool"

static int getrandom (void *buf, size_t buflen, unsigned int flags)
{
  return syscall(SYS_getrandom, buf, buflen, flags) ;
}

int main (void)
{
  char buf[256] ;
  PROG = "s6-fillurandompool" ;
  if (getrandom(buf, 256, 0) != 256)
    strerr_diefu1sys(111, "getrandom") ;
  return 0 ;
}