The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
random.h
Go to the documentation of this file.
1#pragma once
2
3#include <sys/types.h>
4
5/**
6 * @file sys/random.h
7 * @brief random bytes from the kernel's generator (getrandom).
8 */
9
10#define GRND_NONBLOCK 0x0001 // do not wait for the generator to be seeded
11#define GRND_RANDOM 0x0002 // the same as without (as /dev/random)
12#define GRND_INSECURE 0x0004 // do not wait; the bytes may be weak early at boot
13
14/**
15 * fill buf with length random bytes. waits until the kernel's generator is
16 * seeded (early at boot only), unless GRND_NONBLOCK or GRND_INSECURE.
17 * @return the bytes given (a long request can stop early at a signal), or
18 * -1 with errno EAGAIN, EINTR, EINVAL or EFAULT.
19 */
20ssize_t getrandom(void *buf, size_t length, unsigned int flags);
uint8_t flags
Definition idt.c:3
ssize_t getrandom(void *buf, size_t length, unsigned int flags)
fill buf with length random bytes.
basic system types.
__PTRDIFF_TYPE__ ssize_t
Definition types.h:15