mirror of https://github.com/mkerrisk/man-pages
getrandom.2: Rework paragraphs marked with FIXME
The patch clarifies when blocking may occur while calling getrandom(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
16199698a6
commit
e14ee946e8
|
@ -55,20 +55,17 @@ Therefore
|
||||||
should not be used for Monte Carlo simulations or other
|
should not be used for Monte Carlo simulations or other
|
||||||
programs/algorithms which are doing probabilistic sampling.
|
programs/algorithms which are doing probabilistic sampling.
|
||||||
|
|
||||||
.\" FIXME is the following paragraph correct?
|
|
||||||
By default,
|
By default,
|
||||||
.BR getrandom ()
|
.BR getrandom ()
|
||||||
draws entropy from the
|
draws entropy from the
|
||||||
.IR /dev/urandom
|
.IR /dev/urandom
|
||||||
pool, and, if that pool has been initialized and
|
pool.
|
||||||
.IR buflen
|
|
||||||
is less than or equal to 256 (see NOTES, below),
|
|
||||||
then the call never blocks when drawing from that pool
|
|
||||||
and always returns the number of bytes requested in
|
|
||||||
.IR buflen .
|
|
||||||
This behavior can be changed via the
|
This behavior can be changed via the
|
||||||
.I flags
|
.I flags
|
||||||
argument.
|
argument.
|
||||||
|
If the
|
||||||
|
.IR /dev/urandom
|
||||||
|
pool has been initialized, reading from that pool never blocks.
|
||||||
|
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
|
@ -157,17 +154,27 @@ was introduced in version 3.17 of the Linux kernel.
|
||||||
This system call is Linux-specific.
|
This system call is Linux-specific.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
.SS Interruption by a signal handler
|
.SS Interruption by a signal handler
|
||||||
.\" FIXME Here, I think there needs to be an opening paragraph that describes
|
A call to
|
||||||
.\" the cases where getrandom() can block. This should cover the cases with
|
.BR getrandom ()
|
||||||
.\" GRND_RANDOM and without GRND_RANDOM. Reading the existing page, I am
|
can only block when called without the
|
||||||
.\" still not completely confident that I know what the cases are.
|
.B GRND_NONBLOCK
|
||||||
|
flag.
|
||||||
|
When reading from
|
||||||
|
.I /dev/urandom
|
||||||
|
.RB ( GRND_RANDOM
|
||||||
|
is not set)
|
||||||
|
blocking only occurs if the entropy pool has not been initialized yet.
|
||||||
|
When reading from
|
||||||
|
.I /dev/random
|
||||||
|
.RB ( GRND_RANDOM
|
||||||
|
is set)
|
||||||
|
blocking occurs if not enough random bytes are available.
|
||||||
|
|
||||||
The reaction of
|
The reaction of
|
||||||
.BR getrandom ()
|
.BR getrandom ()
|
||||||
in case of an interruption of a blocking call by a signal
|
in case of an interruption of a blocking call by a signal
|
||||||
when reading from
|
when reading from
|
||||||
.I /dev/urandom
|
.I /dev/urandom
|
||||||
.RB ( GRND_RANDOM
|
|
||||||
is not set)
|
|
||||||
depends on the initialization state of the entropy buffer
|
depends on the initialization state of the entropy buffer
|
||||||
and on the request size
|
and on the request size
|
||||||
.IR buflen .
|
.IR buflen .
|
||||||
|
@ -184,8 +191,6 @@ Instead, it will return all of the bytes that have been requested.
|
||||||
.PP
|
.PP
|
||||||
When reading from
|
When reading from
|
||||||
.I /dev/random
|
.I /dev/random
|
||||||
.RB ( GRND_RANDOM
|
|
||||||
is set)
|
|
||||||
these guarantees do
|
these guarantees do
|
||||||
.I not
|
.I not
|
||||||
apply.
|
apply.
|
||||||
|
|
Loading…
Reference in New Issue