mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-12 23:13:15 +00:00
Rollup merge of #107159 - devnexen:random_fbsd_update, r=workingjubilee
rand use getrandom for freebsd (available since 12.x)
This commit is contained in:
commit
d287861309
@ -62,18 +62,15 @@ mod imp {
|
|||||||
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), libc::GRND_NONBLOCK) }
|
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), libc::GRND_NONBLOCK) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "espidf", target_os = "horizon"))]
|
#[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 {
|
||||||
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
|
#[cfg(not(target_os = "freebsd"))]
|
||||||
}
|
use libc::getrandom;
|
||||||
|
#[cfg(target_os = "freebsd")]
|
||||||
#[cfg(target_os = "freebsd")]
|
|
||||||
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
|
|
||||||
// FIXME: using the above when libary std's libc is updated
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn getrandom(
|
fn getrandom(
|
||||||
buffer: *mut libc::c_void,
|
buf: *mut libc::c_void,
|
||||||
length: libc::size_t,
|
buflen: libc::size_t,
|
||||||
flags: libc::c_uint,
|
flags: libc::c_uint,
|
||||||
) -> libc::ssize_t;
|
) -> libc::ssize_t;
|
||||||
}
|
}
|
||||||
@ -236,6 +233,7 @@ mod imp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: once the 10.x release becomes the minimum, this can be dropped for simplification.
|
||||||
#[cfg(target_os = "netbsd")]
|
#[cfg(target_os = "netbsd")]
|
||||||
mod imp {
|
mod imp {
|
||||||
use crate::ptr;
|
use crate::ptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user