random.h 855 B

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