Add getrandom and sys/random.h
This commit is contained in:
@@ -50,6 +50,7 @@ pub mod _wctype;
|
||||
pub mod arch_aarch64_user;
|
||||
pub mod arch_x64_user;
|
||||
pub mod sys_procfs;
|
||||
pub mod sys_random;
|
||||
pub mod sys_uio;
|
||||
pub mod sys_un;
|
||||
pub mod sys_utsname;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
sys_includes = ["sys/types.h"]
|
||||
include_guard = "_SYS_RANDOM_H"
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
no_includes = true
|
||||
cpp_compat = true
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
@@ -0,0 +1,14 @@
|
||||
use core::slice;
|
||||
|
||||
use crate::platform::{Pal, Sys, types::*};
|
||||
|
||||
pub const GRND_NONBLOCK: c_uint = 1;
|
||||
pub const GRND_RANDOM: c_uint = 2;
|
||||
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t {
|
||||
Sys::getrandom(slice::from_raw_parts_mut(
|
||||
buf as *mut u8,
|
||||
buflen as usize
|
||||
), flags)
|
||||
}
|
||||
Reference in New Issue
Block a user