summaryrefslogtreecommitdiff
path: root/src/minutils/s6-fillurandompool.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/minutils/s6-fillurandompool.c')
-rw-r--r--src/minutils/s6-fillurandompool.c26
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 ;
+}