diff options
| author | bors <bors@rust-lang.org> | 2024-04-04 02:11:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-04 02:11:23 +0000 |
| commit | 0accf4ec4c07d23aa86f6a97aeb8797941abc30e (patch) | |
| tree | ab849cc7c6e716b055a495d0a690b4965738bb73 /library/std/src | |
| parent | b4acbe4233b97ec51605c513ce6b215470574f80 (diff) | |
| parent | 4332498a6daff23e4403d9bce43d97ed63cad382 (diff) | |
Auto merge of #123440 - jhpratt:rollup-yat6crk, r=jhpratt
Rollup of 4 pull requests Successful merges: - #122356 (std::rand: fix dragonflybsd after #121942.) - #123093 (Add a nice header to our README.md) - #123307 (Fix f16 and f128 feature gating on different editions) - #123401 (Check `x86_64` size assertions on `aarch64`, too) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys/pal/unix/rand.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/library/std/src/sys/pal/unix/rand.rs b/library/std/src/sys/pal/unix/rand.rs index c9ed6825f6c..d52c3254e5e 100644 --- a/library/std/src/sys/pal/unix/rand.rs +++ b/library/std/src/sys/pal/unix/rand.rs @@ -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", |
