size_t buflen, unsigned int
getrandom() function is used to retrieve random and pseudo-random numbers from the operating system.
By default, the
getrandom() function will
read up to buflen bytes of pseudo-random data into
bufp. Pseudo-random data will be retrieved from the
same source that provides data to /dev/urandom. The
getrandom() function may return less data than was
requested in buflen. This can happen because of
interrupts from signals, availability of data, or because the request was
too large. Callers must always check to see how much data was actually
The following values may be bitwise-ORed together in the flags argument to modify the behavior of the function:
EAGAINwill be set in errno. Otherwise, less data will be returned than requested.
getrandom() function is intended to
eliminate the need to explicitly call
/dev/random or /dev/urandom.
This eliminates the need to have the character devices available or cases
where a program may not have an available file descriptor. For other uses,
arc4random(3C) may be a better
getrandom() function returns the number of bytes written into bufp. Otherwise, -1 is returned and errno is set to indicate the error.
getrandom() function will fail if:
getrandom() function would have blocked and
GRND_NONBLOCKflag was set.
getrandom() function is non-standard. It originally appeared in Linux.
|November 6, 2018||OmniOS|