Index Index for
Section 9r
Index Alphabetical
listing for G
Bottom of page Bottom of
page

get_random_bytes_wait(9r)

NAME

get_random_bytes_wait - General: Returns the requested number of random bytes and places them in a buffer.

SYNOPSIS

void get_random_bytes_wait( void *buf, int nbytes );

ARGUMENTS

buf Specifies the address of the buffer in which the requested random bytes are stored. nbytes Specifies the number of random bytes.

DESCRIPTION

The get_random_bytes_wait() routine returns the requested number of random bytes and places them in a buffer. This routine is for kernel modules that can be in a wait state.

RETURN VALUES

Upon successful completion, get_random_bytes_wait() returns a buffer filled with random bytes. ************Fran, what does it return upon failure, efault?

EXAMPLE

The following example shows how to use the get_random_bytes_wait() routine to generate a random DCE UUID: unsigned char uuid[16]; get_random_bytes_wait(uuid, sizeof (uuid)); uuid[6] = (uuid[6] & 0x0f) | 0x40; /* UUID version 4 -- random genmeration */ uuid[8] = (uuid[8] & 0x3f) | 0x80; /* UUID variant DCE */ ************Fran, can you send me an example for this routine too? I just copied the example that you gave me for the other one. Thanks.

SEE ALSO

Routines: get_random_bytes(9r) Files: random(4) and urandom(4)

Index Index for
Section 9r
Index Alphabetical
listing for G
Top of page Top of
page