diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2016-09-15 11:48:18 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2016-09-15 11:48:18 +0000 |
commit | 6f3e9754ef9446cb8a9f98e593aed23a730c4c10 (patch) | |
tree | a973052c9a8c818a830ce3304996e45598989863 /src/minutils/s6-fillurandompool.c | |
parent | 8cbb5587ff1b3770ff570bc120ea532cd62357bb (diff) | |
download | s6-linux-utils-6f3e9754ef9446cb8a9f98e593aed23a730c4c10.tar.gz s6-linux-utils-6f3e9754ef9446cb8a9f98e593aed23a730c4c10.tar.xz s6-linux-utils-6f3e9754ef9446cb8a9f98e593aed23a730c4c10.zip |
Add s6-fillurandompool
Diffstat (limited to 'src/minutils/s6-fillurandompool.c')
-rw-r--r-- | src/minutils/s6-fillurandompool.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/minutils/s6-fillurandompool.c b/src/minutils/s6-fillurandompool.c new file mode 100644 index 0000000..775f289 --- /dev/null +++ b/src/minutils/s6-fillurandompool.c @@ -0,0 +1,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 ; +} |