Skip to content

Commit

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

std::rand: enable getrandom for dragonflybsd too.
  • Loading branch information
rust-timer authored Mar 10, 2024
2 parents 3521a2f + d416a22 commit 0d1d78f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion library/std/src/sys/pal/unix/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ 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", netbsd10))]
#[cfg(any(
target_os = "espidf",
target_os = "horizon",
target_os = "freebsd",
target_os = "dragonfly",
netbsd10
))]
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
}
Expand All @@ -73,6 +79,7 @@ mod imp {
target_os = "espidf",
target_os = "horizon",
target_os = "freebsd",
target_os = "dragonfly",
netbsd10
)))]
fn getrandom_fill_bytes(_buf: &mut [u8]) -> bool {
Expand All @@ -85,6 +92,7 @@ mod imp {
target_os = "espidf",
target_os = "horizon",
target_os = "freebsd",
target_os = "dragonfly",
netbsd10
))]
fn getrandom_fill_bytes(v: &mut [u8]) -> bool {
Expand Down

0 comments on commit 0d1d78f

Please sign in to comment.