| 1 |
//! linux_raw syscalls supporting `rustix::rand`. |
| 2 |
//! |
| 3 |
//! # Safety |
| 4 |
//! |
| 5 |
//! See the `rustix::backend` module documentation for details. |
| 6 |
#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)] |
| 7 |
|
| 8 |
use crate::backend::conv::{pass_usize, ret_usize}; |
| 9 |
use crate::io; |
| 10 |
use crate::rand::GetRandomFlags; |
| 11 |
|
| 12 |
#[inline] |
| 13 |
pub(crate) unsafe fn getrandom( |
| 14 |
buf: *mut u8, |
| 15 |
cap: usize, |
| 16 |
flags: GetRandomFlags, |
| 17 |
) -> io::Result<usize> { |
| 18 |
ret_usize(syscall!(__NR_getrandom, buf, pass_usize(cap), flags)) |
| 19 |
} |