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