Skip to contentSkip to conversation

getentropy clarifications

PATCH Nikos Mavrogiannopoulos 3 participants 4 messages Mar 29, 2017 – Apr 10, 2017 2 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

Hi,
The attached patches clarify some parts of the getentropy() functions.

regards,
Nikos

From be741e2dde51a060c4294780f5dad83e967955a2 Mon Sep 17 00:00:00 2001
From: Nikos Mavrogiannopoulos <[email protected]>
Date: Wed, 29 Mar 2017 14:43:14 +0200
Subject: [PATCH 1/2] getentropy: corrected the header it is defined under

---
 man3/getentropy.3 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
man3/getentropy.3 +5 -1
index 697f937..4cd4d61 100644
@@ -26,7 +26,7 @@
 .SH NAME
 getentropy \- fill a buffer with random bytes
 .SH SYNOPSIS
-.B #include <sys/random.h>
+.B #include <unistd.h>
 .sp
 .BI "int getentropy(void *" buffer ", size_t " length );
 .SH DESCRIPTION
@@ -90,6 +90,10 @@ a cancellation point,
 .BR getentropy ()
 is not a cancellation point.
 
+In earlier versions of glibc this function was avaible under the
+.BR <sys/random.h>
+header.
+
 A call to
 .BR getentropy ()
 may block if the system has just booted and the kernel has
Signature · 1 line
2.9.3

From 112c3653fd293453504bffff35b60785c9f82c40 Mon Sep 17 00:00:00 2001
From: Nikos Mavrogiannopoulos <[email protected]>
Date: Wed, 29 Mar 2017 14:44:21 +0200
Subject: [PATCH 2/2] getentropy: clarify "returns"

---
 man3/getentropy.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/getentropy.3 +1 -1
index 4cd4d61..b341284 100644
@@ -43,7 +43,7 @@ argument is 256.
 
 A successful call to
 .BR getentropy ()
-always returns the requested number of bytes of entropy.
+always returns zero and provides the requested number of bytes of entropy.
 .SH RETURN VALUE
 On success, this function returns zero,
 On error, \-1 is returned, and
Signature · 1 line
2.9.3

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

* Nikos Mavrogiannopoulos:

man3/getentropy.3 a cancellation point, · line 95

Quoted 3 lines
man3/getentropy.3 +3 -0
+In earlier versions of glibc this function was avaible under the
+.BR <sys/random.h>
+header.

It's still available in <sys/random.h>, and the declaration there can still be useful if you want to compile without feature test macros.

In addition, I don't think there ever was a released glibc version where getentropy was declared in <sys/random.h>, but not in <unistd.h> (with the relevant feature test macros).
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 9 lines · Florian Weimer

* Nikos Mavrogiannopoulos:

man3/getentropy.3 a cancellation point, · line 95

Quoted 3 lines
man3/getentropy.3 +3 -0
+In earlier versions of glibc this function was avaible under the
+.BR <sys/random.h>
+header.

It's still available in <sys/random.h>, and the declaration there can still be useful if you want to compile without feature test macros.

Quoted 3 lines

In addition, I don't think there ever was a released glibc version where getentropy was declared in <sys/random.h>, but not in <unistd.h> (with the relevant feature test macros).

Thanks, Florian. I tweaked the page to mention the FTM requirements when using <unistd.h>, and modified the text in NOTES to read:

getentropy() is also declared in <sys/random.h>. (No feature test macro need be defined to obtain the declaration from that header file.)

Cheers,

Michael

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
In reply to a message not in the archive
Quoted 2 lines · Nikos Mavrogiannopoulos

Hi,
The attached patches clarify some parts of the getentropy() functions.

Thanks, Nikos. Applied. I'll clarify things a little in the light of Florian's comments.

Cheers,

Michael

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html