Skip to content

Commit

Permalink
Unrolled build for rust-lang#122356
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#122356 - devnexen:dfbsd_build_fix, r=jhpratt

std::rand: fix dragonflybsd after rust-lang#121942.
  • Loading branch information
rust-timer authored Apr 4, 2024
2 parents b4acbe4 + 6a16638 commit c29f525
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions library/std/src/sys/pal/unix/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,23 @@ mod imp {
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), libc::GRND_NONBLOCK) }
}

#[cfg(any(
target_os = "espidf",
target_os = "horizon",
target_os = "freebsd",
target_os = "dragonfly",
netbsd10
))]
#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd", netbsd10))]
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
}

#[cfg(target_os = "dragonfly")]
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
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(
target_os = "linux",
target_os = "android",
Expand Down

0 comments on commit c29f525

Please sign in to comment.