Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/getrandom/src/getentropy.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / getrandom / src / getentropy.rs` 21 lines ยท 632 bytes Raw Blame History 1 //! Implementation using getentropy(2) 2 //! 3 //! Available since: 4 //! - macOS 10.12 5 //! - OpenBSD 5.6 6 //! - Emscripten 2.0.5 7 //! - vita newlib since Dec 2021 8 //! 9 //! For these targets, we use getentropy(2) because getrandom(2) doesn't exist. 10 use crate::{util_libc::last_os_error, Error}; 11 use core::mem::MaybeUninit; 12 13 pub fn getrandom_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { 14 for chunk in dest.chunks_mut(256) { 15 let ret = unsafe { libc::getentropy(chunk.as_mut_ptr() as *mut libc::c_void, chunk.len()) }; 16 if ret != 0 { 17 return Err(last_os_error()); 18 } 19 } 20 Ok(()) 21 }