diff --git a/src/header/sys_random/cbindgen.toml b/src/header/sys_random/cbindgen.toml index d83dd8b5eb..85ff9e5953 100644 --- a/src/header/sys_random/cbindgen.toml +++ b/src/header/sys_random/cbindgen.toml @@ -1,7 +1,9 @@ -sys_includes = ["sys/types.h"] -include_guard = "_SYS_RANDOM_H" +after_includes = """ +#include // for size_t from sys/types.h +#include // for ssize_t from sys/types.h +""" +include_guard = "_RELIBC_SYS_RANDOM_H" language = "C" -style = "Tag" no_includes = true cpp_compat = true diff --git a/src/header/sys_random/mod.rs b/src/header/sys_random/mod.rs index 57040d469a..8393a78fd4 100644 --- a/src/header/sys_random/mod.rs +++ b/src/header/sys_random/mod.rs @@ -13,11 +13,19 @@ use crate::{ }; /// See . +/// +/// 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 . +/// +/// 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 . +/// +/// 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(