OSDN Git Service

libc: add getrandom(2)
[uclinux-h8/uclibc-ng.git] / libc / sysdeps / linux / common / sys / random.h
1 /* Copyright (C) 2015 Bernhard Reutner-Fischer
2  * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
3 */
4
5 #ifndef _SYS_RANDOM_H
6 #define _SYS_RANDOM_H   1
7 #include <features.h>
8
9 __BEGIN_DECLS
10
11 #if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
12 # if 0 /*def __ASSUME_GETRANDOM_SYSCALL */
13 #  include <linux/random.h>
14 # else
15 #  undef GRND_NONBLOCK
16 #  undef GRND_RANDOM
17 /*
18  * Flags for getrandom(2)
19  *
20  * GRND_NONBLOCK        Don't block and return EAGAIN instead
21  * GRND_RANDOM          Use the /dev/random pool instead of /dev/urandom
22  */
23 #  define GRND_NONBLOCK 0x0001
24 #  define GRND_RANDOM   0x0002
25 # endif
26 /* FIXME: aren't there a couple of __restrict and const missing ? */
27 extern int getrandom(void *__buf, size_t count, unsigned int flags)
28            __nonnull ((1)) __wur;
29 #endif
30
31 __END_DECLS
32
33 #endif /* sys/random.h */