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/getrandom.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 / getrandom.rs` 25 lines ยท 938 bytes Raw Blame History 1 //! Implementation using getrandom(2). 2 //! 3 //! Available since: 4 //! - Linux Kernel 3.17, Glibc 2.25, Musl 1.1.20 5 //! - Android API level 23 (Marshmallow) 6 //! - NetBSD 10.0 7 //! - FreeBSD 12.0 8 //! - illumos since Dec 2018 9 //! - DragonFly 5.7 10 //! - Hurd Glibc 2.31 11 //! - shim-3ds since Feb 2022 12 //! 13 //! For these platforms, we always use the default pool and never set the 14 //! GRND_RANDOM flag to use the /dev/random pool. On Linux/Android/Hurd, using 15 //! GRND_RANDOM is not recommended. On NetBSD/FreeBSD/Dragonfly/3ds, it does 16 //! nothing. On illumos, the default pool is used to implement getentropy(2), 17 //! so we assume it is acceptable here. 18 use crate::{util_libc::sys_fill_exact, Error}; 19 use core::mem::MaybeUninit; 20 21 pub fn getrandom_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { 22 sys_fill_exact(dest, |buf| unsafe { 23 libc::getrandom(buf.as_mut_ptr() as *mut libc::c_void, buf.len(), 0) 24 }) 25 }