mirror of
https://github.com/openharmony/third_party_rust_rustix.git
synced 2026-07-25 23:55:24 -04:00
0c39924cef
This aligns the module name with how all the comments and documentation talk about it. This is an internal API, so it's not a semver bump. Fixes #367.
22 lines
657 B
Rust
22 lines
657 B
Rust
use crate::{backend, io};
|
|
|
|
/// `GRND_*`
|
|
pub use backend::rand::types::GetRandomFlags;
|
|
|
|
/// `getrandom(buf, flags)`—Reads a sequence of random bytes.
|
|
///
|
|
/// This is a very low-level API which may be difficult to use correctly. Most
|
|
/// users should prefer to use [`getrandom`] or [`rand`] APIs instead.
|
|
///
|
|
/// [`getrandom`]: https://crates.io/crates/getrandom
|
|
/// [`rand`]: https://crates.io/crates/rand
|
|
///
|
|
/// # References
|
|
/// - [Linux]
|
|
///
|
|
/// [Linux]: https://man7.org/linux/man-pages/man2/getrandom.2.html
|
|
#[inline]
|
|
pub fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usize> {
|
|
backend::rand::syscalls::getrandom(buf, flags)
|
|
}
|