This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: getentropy for <unistd.h>


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.

diff --git a/posix/unistd.h b/posix/unistd.h
index 392dc0e..70b10c6 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]