From 3426471b46f73a0fa8bb787de5d3957999883924 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Thu, 29 Jan 2015 13:13:32 +0100 Subject: [PATCH] getrandom.2: Rework discussion of blocking section on interuption by signals Reviewed-by: Heinrich Schuchardt Signed-off-by: Michael Kerrisk --- man2/getrandom.2 | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/man2/getrandom.2 b/man2/getrandom.2 index 66042cb1c7..2d7c4b3c74 100644 --- a/man2/getrandom.2 +++ b/man2/getrandom.2 @@ -155,7 +155,7 @@ would have blocked if the flag was not set. .TP .B EINTR -While blocked waiting for entropy, the call was interrupted by a signal +The call was interrupted by a signal handler; see the description of how interrupted .BR read (2) calls on "slow" devices are handled with and without the @@ -190,22 +190,29 @@ When a sufficient number of random bits has been collected, the entropy pool is considered to be initialized. This state is normally reached early in the system bootstrap phase. .SS Interruption by a signal handler -A call to -.BR getrandom () -can block only when called without the -.B GRND_NONBLOCK -flag. When reading from .I /dev/urandom .RB ( GRND_RANDOM is not set), -blocking can occur if the entropy pool has not been initialized yet -or if the requested number of bytes is large. +.BR getrandom () +will block until the entropy pool has been initialized +(unless the +.BR GRND_NONBLOCK +flag was specified). +If a request is made to read a large number (more than 256) of bytes, +.BR getrandom () +will block until those bytes have been generated and transferred +from kernel memory to +.IR buf . When reading from .I /dev/random .RB ( GRND_RANDOM is set), -blocking occurs if not enough random bytes are available. +.BR getrandom () +will block until some random bytes become available +(unless the +.BR GRND_NONBLOCK +flag was specified). The behavior when a call to .BR getrandom () -- 2.47.2