Skip to content

Commit

Permalink
std: getrandom simplification for freebsd.
Browse files Browse the repository at this point in the history
it is in the libcs' crate too now.
  • Loading branch information
devnexen committed Dec 8, 2023
1 parent 5ea6256 commit bc6a5c7
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions library/std/src/sys/unix/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,7 @@ mod imp {

#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd"))]
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
#[cfg(not(target_os = "freebsd"))]
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) }
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
}

#[cfg(not(any(
Expand Down

0 comments on commit bc6a5c7

Please sign in to comment.