summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/getrandom.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-22 14:47:29 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-22 14:49:27 +0100
commit09ff424905d5de0b2a21a3960d9756a90b07ba26 (patch)
treeb927d20d8fa53c98cc5b08b6826096d43c387d28 /libc/sysdeps/linux/common/getrandom.c
parent534f44d53146457b3ca686c47efb9207543b88e1 (diff)
libc: add getrandom(2)
Introduce a <sys/random.h> for it. /* FIXME: aren't there a couple of __restrict and const missing ? */ extern int getrandom(void *__buf, size_t count, unsigned int flags) __nonnull ((1)) __wur; Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/common/getrandom.c')
-rw-r--r--libc/sysdeps/linux/common/getrandom.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/getrandom.c b/libc/sysdeps/linux/common/getrandom.c
new file mode 100644
index 000000000..d33d5224a
--- /dev/null
+++ b/libc/sysdeps/linux/common/getrandom.c
@@ -0,0 +1,14 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * getrandom() for uClibc
+ *
+ * Copyright (C) 2015 Bernhard Reutner-Fischer
+ *
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+#include <sys/random.h>
+#ifdef __NR_getrandom
+_syscall3(int, getrandom, void *, buf, size_t, buflen, unsigned int, flags)
+#endif