From 09ff424905d5de0b2a21a3960d9756a90b07ba26 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 22 Mar 2015 14:47:29 +0100 Subject: libc: add getrandom(2) Introduce a 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 --- libc/sysdeps/linux/common/sys/random.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 libc/sysdeps/linux/common/sys/random.h (limited to 'libc/sysdeps/linux/common/sys/random.h') diff --git a/libc/sysdeps/linux/common/sys/random.h b/libc/sysdeps/linux/common/sys/random.h new file mode 100644 index 000000000..42f802576 --- /dev/null +++ b/libc/sysdeps/linux/common/sys/random.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2015 Bernhard Reutner-Fischer + * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. +*/ + +#ifndef _SYS_RANDOM_H +#define _SYS_RANDOM_H 1 +#include + +__BEGIN_DECLS + +#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU +# if 0 /*def __ASSUME_GETRANDOM_SYSCALL */ +# include +# else +# undef GRND_NONBLOCK +# undef GRND_RANDOM +/* + * Flags for getrandom(2) + * + * GRND_NONBLOCK Don't block and return EAGAIN instead + * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom + */ +# define GRND_NONBLOCK 0x0001 +# define GRND_RANDOM 0x0002 +# endif +/* 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; +#endif + +__END_DECLS + +#endif /* sys/random.h */ -- cgit v1.2.3