getentropy for <unistd.h>
Commit Message
On 12/23/2016 05:45 PM, Paul Eggert wrote:
> Florian Weimer wrote:
>> Should I depend on _GNU_SOURCE instead?
>
> Sounds good to me. It would work well with Gnulib-using apps, which
> typically define _GNU_SOURCE at an early stage in 'configure'.
Good. I plan to commit the attached patch.
Thanks,
Florian
Declare getentropy in <unistd.h>
2016-12-23 Florian Weimer <fweimer@redhat.com>
* posix/unistd.h (getentropy): Declare.
@@ -1157,6 +1157,11 @@ extern int pthread_atfork (void (*__prepare) (void),
void (*__child) (void)) __THROW;
#endif
+#ifdef __USE_GNU
+/* Write LENGTH bytes of randomness starting at BUFFER. Return 0 on
+ success or -1 on error. */
+int getentropy (void *__buffer, size_t __length) __wur;
+#endif
/* Define some macros helping to catch buffer overflows. */
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function