getrandom.2: Remove getentropy(3) details and defer to new getentropy(3) page

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-01-23 11:24:28 +13:00
parent b026572816
commit 15df4f6b42
1 changed files with 3 additions and 29 deletions

View File

@ -273,8 +273,8 @@ The special treatment of small values of
.I buflen
was designed for compatibility with
OpenBSD's
.BR getentropy ()
system call.
.BR getentropy (3),
which is nowadays supported by glibc.
.PP
The user of
.BR getrandom ()
@ -289,33 +289,6 @@ is not specified and
is less than or equal to 256,
a return of fewer bytes than requested should never happen,
but the careful programmer will check for this anyway!
.\"
.SS Emulating OpenBSD's getentropy()
The
.BR getentropy ()
system call in OpenBSD can be emulated using the following
function:
.in +4n
.nf
int
getentropy(void *buf, size_t buflen)
{
int ret;
if (buflen > 256)
goto failure;
ret = getrandom(buf, buflen, 0);
if (ret < 0)
return ret;
if (ret == buflen)
return 0;
failure:
errno = EIO;
return \-1;
}
.fi
.in
.SH BUGS
As of Linux 3.19, the following bug exists:
.\" FIXME patch proposed https://lkml.org/lkml/2014/11/29/16
@ -324,6 +297,7 @@ Depending on CPU load,
.BR getrandom ()
does not react to interrupts before reading all bytes requested.
.SH SEE ALSO
.BR getentropy (3),
.BR random (4),
.BR urandom (4),
.BR random (7),