random.h 835 B

123456789101112131415161718192021222324252627282930313233
  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. #ifndef _SYS_RANDOM_H
  5. #define _SYS_RANDOM_H 1
  6. #include <features.h>
  7. __BEGIN_DECLS
  8. #if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
  9. # if 0 /*def __ASSUME_GETRANDOM_SYSCALL */
  10. # include <linux/random.h>
  11. # else
  12. # undef GRND_NONBLOCK
  13. # undef GRND_RANDOM
  14. /*
  15. * Flags for getrandom(2)
  16. *
  17. * GRND_NONBLOCK Don't block and return EAGAIN instead
  18. * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom
  19. */
  20. # define GRND_NONBLOCK 0x0001
  21. # define GRND_RANDOM 0x0002
  22. # endif
  23. /* FIXME: aren't there a couple of __restrict and const missing ? */
  24. extern int getrandom(void *__buf, size_t count, unsigned int flags)
  25. __nonnull ((1)) __wur;
  26. #endif
  27. __END_DECLS
  28. #endif /* sys/random.h */