Skip to content

Commit

Permalink
Rollup merge of #124766 - devnexen:getrandom_solarish, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
std::rand: adding solaris/illumos for getrandom support.

To help solarish support for miri https://rust-lang/miri#3567
  • Loading branch information
matthiaskrgr authored May 11, 2024
2 parents ef15976 + 1d45f47 commit f73f266
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion library/std/src/sys/pal/unix/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ 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",
netbsd10,
target_os = "illumos",
target_os = "solaris"
))]
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
}
Expand All @@ -83,6 +90,8 @@ mod imp {
target_os = "horizon",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "solaris",
target_os = "illumos",
netbsd10
)))]
fn getrandom_fill_bytes(_buf: &mut [u8]) -> bool {
Expand All @@ -96,6 +105,8 @@ mod imp {
target_os = "horizon",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "solaris",
target_os = "illumos",
netbsd10
))]
fn getrandom_fill_bytes(v: &mut [u8]) -> bool {
Expand Down

0 comments on commit f73f266

Please sign in to comment.