std::rand: adding solaris/illumos for getrandom support.
To help solarish support for miri https://rust-lang/miri/issues/3567
This commit is contained in:
parent
7c4ac0603e
commit
1d45f47d24
1 changed files with 12 additions and 1 deletions
|
@ -59,7 +59,14 @@ mod imp {
|
||||||
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), libc::GRND_NONBLOCK) }
|
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 {
|
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
|
||||||
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
|
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
|
||||||
}
|
}
|
||||||
|
@ -83,6 +90,8 @@ mod imp {
|
||||||
target_os = "horizon",
|
target_os = "horizon",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "solaris",
|
||||||
|
target_os = "illumos",
|
||||||
netbsd10
|
netbsd10
|
||||||
)))]
|
)))]
|
||||||
fn getrandom_fill_bytes(_buf: &mut [u8]) -> bool {
|
fn getrandom_fill_bytes(_buf: &mut [u8]) -> bool {
|
||||||
|
@ -96,6 +105,8 @@ mod imp {
|
||||||
target_os = "horizon",
|
target_os = "horizon",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "solaris",
|
||||||
|
target_os = "illumos",
|
||||||
netbsd10
|
netbsd10
|
||||||
))]
|
))]
|
||||||
fn getrandom_fill_bytes(v: &mut [u8]) -> bool {
|
fn getrandom_fill_bytes(v: &mut [u8]) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue