Rollup merge of #121942 - devnexen:getrandom_for_dfbsd, r=joboet
std::rand: enable getrandom for dragonflybsd too.
This commit is contained in:
commit
f6d47dd1f1
1 changed files with 9 additions and 1 deletions
|
@ -62,7 +62,13 @@ 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",
|
||||||
|
target_os = "dragonfly",
|
||||||
|
netbsd10
|
||||||
|
))]
|
||||||
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) }
|
||||||
}
|
}
|
||||||
|
@ -73,6 +79,7 @@ mod imp {
|
||||||
target_os = "espidf",
|
target_os = "espidf",
|
||||||
target_os = "horizon",
|
target_os = "horizon",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
|
target_os = "dragonfly",
|
||||||
netbsd10
|
netbsd10
|
||||||
)))]
|
)))]
|
||||||
fn getrandom_fill_bytes(_buf: &mut [u8]) -> bool {
|
fn getrandom_fill_bytes(_buf: &mut [u8]) -> bool {
|
||||||
|
@ -85,6 +92,7 @@ mod imp {
|
||||||
target_os = "espidf",
|
target_os = "espidf",
|
||||||
target_os = "horizon",
|
target_os = "horizon",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
|
target_os = "dragonfly",
|
||||||
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