Merge branch 'sysrandom-doc' into 'master'

add descriptions to constants and function in sys_random

See merge request redox-os/relibc!1380
This commit is contained in:
Jeremy Soller
2026-05-24 06:23:51 -06:00
2 changed files with 13 additions and 3 deletions
+5 -3
View File
@@ -1,7 +1,9 @@
sys_includes = ["sys/types.h"]
include_guard = "_SYS_RANDOM_H"
after_includes = """
#include <bits/size-t.h> // for size_t from sys/types.h
#include <bits/ssize-t.h> // for ssize_t from sys/types.h
"""
include_guard = "_RELIBC_SYS_RANDOM_H"
language = "C"
style = "Tag"
no_includes = true
cpp_compat = true
+8
View File
@@ -13,11 +13,19 @@ use crate::{
};
/// See <https://www.man7.org/linux/man-pages/man2/getrandom.2.html>.
///
/// Do not block when requesting random bytes.
/// Will set `errno` to `EAGAIN` if requested entropy is not available.
pub const GRND_NONBLOCK: c_uint = 1;
/// See <https://www.man7.org/linux/man-pages/man2/getrandom.2.html>.
///
/// If this bit is set, then random bytes are drawn from the `random` source
/// instead of the `urandom` source.
pub const GRND_RANDOM: c_uint = 2;
/// See <https://www.man7.org/linux/man-pages/man2/getrandom.2.html>.
///
/// Fills the buffer pointed to by `buf` with up to `buflen` random bytes.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t {
Sys::getrandom(