|
NAMEgetrandom —
get random data
LIBRARYStandard C Library (libc, -lc)SYNOPSIS#include <sys/random.h>
ssize_t
DESCRIPTIONgetrandom () fills buf with up to
buflen bytes of random data.
The flags argument may include zero or more of the following:
If the random(4) device has been seeded, reads of up to 256 bytes will always return as many bytes as requested and will not be interrupted by signals. RETURN VALUESUpon successful completion, the number of bytes which were actually read is returned. For requests larger than 256 bytes, this can be fewer bytes than were requested. Otherwise, -1 is returned and the global variable errno is set to indicate the error.ERRORSThegetrandom () operation returns the following errors:
SEE ALSOarc4random(3), getentropy(3), random(4)STANDARDSgetrandom () is non-standard. It is present in Linux.
HISTORYThegetrandom () system call first appeared in
FreeBSD 12.0.
CAVEATSUnlike Linux, theGRND_INSECURE flag on
FreeBSD does not produce any output before the
random(4)
device is seeded.
Visit the GSP FreeBSD Man Page Interface. |