getrandom.2: Minor wording fixes

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-01-22 21:12:21 +01:00
parent 3851c7aa65
commit 81d43c5023
1 changed files with 15 additions and 13 deletions

View File

@ -31,9 +31,9 @@ getrandom \- obtain a series of random bytes
.sp
.BI "int getrandom(void *"buf ", size_t " buflen ", unsigned int " flags );
.SH DESCRIPTION
The system call
The
.BR getrandom ()
fills the buffer pointed to by
system call fills the buffer pointed to by
.I buf
with up to
.I buflen
@ -87,7 +87,7 @@ If the number of available bytes in
is less than requested in
.IR buflen ,
the call returns just the available random bytes.
If no random byte is available, the response will depend on the
If no random byte is available, the behavior depends on the
presence of
.B GRND_NONBLOCK
in the
@ -102,7 +102,7 @@ If the
.B GRND_NONBLOCK
flag is set, then
.BR getrandom ()
instead immediately returns -1 with
instead immediately returns \-1 with
.I errno
set to
.BR EAGAIN .
@ -117,7 +117,7 @@ if insufficient entropy was present in the
.IR /dev/random
pool, or if the system call was interrupted by a signal.
.PP
On error, -1 is returned, and
On error, \-1 is returned, and
.I errno
is set appropriately.
.SH ERRORS
@ -156,14 +156,14 @@ This system call is Linux-specific.
.SS Interruption by a signal handler
A call to
.BR getrandom ()
can only block when called without the
can block only when called without the
.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.
blocking occurs only if the entropy pool has not been initialized yet.
When reading from
.I /dev/random
.RB ( GRND_RANDOM
@ -176,16 +176,18 @@ in case of an interruption of a blocking call by a signal
when reading from
.I /dev/urandom
depends on the initialization state of the entropy buffer
and on the request size
and on the request size,
.IR buflen .
If the entropy is not yet initialized or the request size is large
.RI ( buflen "\ >\ 256),"
then the call will fail with the
.B EINTR
will be returned.
error.
If the entropy pool has been initialized and the request size is small
.RI ( buflen "\ <=\ 256),"
then
.BR getrandom ()
will not return
will not fail with
.BR EINTR .
Instead, it will return all of the bytes that have been requested.
.PP
@ -258,15 +260,15 @@ getentropy(void *buf, size_t buflen)
return 0;
failure:
errno = EIO;
return -1;
return \-1;
}
.fi
.in
.SH BUGS
As of Linux 3.19, the following bug exists:
.PP
.\" FIXME patch proposed https://lkml.org/lkml/2014/11/29/16
Depending on CPU load
.IP * 3
Depending on CPU load,
.BR getrandom ()
does not react to interrupts before reading all bytes requested.
.SH SEE ALSO