mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
Rollup merge of #118748 - devnexen:fbsd_getrandom_simpl, r=Nilstrieb,dtolnay
std: getrandom simplification for freebsd. it is in the libcs' crate too now.
This commit is contained in:
commit
df2f4ae4ac
@ -64,17 +64,7 @@ mod imp {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd"))]
|
#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd"))]
|
||||||
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
|
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
|
||||||
#[cfg(not(target_os = "freebsd"))]
|
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
|
||||||
use libc::getrandom;
|
|
||||||
#[cfg(target_os = "freebsd")]
|
|
||||||
extern "C" {
|
|
||||||
fn getrandom(
|
|
||||||
buf: *mut libc::c_void,
|
|
||||||
buflen: libc::size_t,
|
|
||||||
flags: libc::c_uint,
|
|
||||||
) -> libc::ssize_t;
|
|
||||||
}
|
|
||||||
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(
|
#[cfg(not(any(
|
||||||
|
Loading…
Reference in New Issue
Block a user