Skip to content

Commit

Permalink
Rollup merge of #118748 - devnexen:fbsd_getrandom_simpl, r=Nilstrieb,…
Browse files Browse the repository at this point in the history
…dtolnay

std: getrandom simplification for freebsd.

it is in the libcs' crate too now.
  • Loading branch information
GuillaumeGomez committed Jan 9, 2024
2 parents 4a24b5b + bc6a5c7 commit df2f4ae
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 df2f4ae

Please sign in to comment.