diff options
| author | Meziu <meziu210@icloud.com> | 2021-10-19 17:59:59 +0200 |
|---|---|---|
| committer | Mark Drobnak <mark.drobnak@gmail.com> | 2022-06-13 20:44:39 -0700 |
| commit | 4e808f87ccb706d339c9ea10c3c9a9c9fd7fc6cb (patch) | |
| tree | fe1be89ab4da7ec631c4c4d7bd6f824d95c29da4 /library/std/src/sys/unix/rand.rs | |
| parent | 3bdec3c8abdc48e46715d7b14b764af28da1cee3 (diff) | |
| download | rust-4e808f87ccb706d339c9ea10c3c9a9c9fd7fc6cb.tar.gz rust-4e808f87ccb706d339c9ea10c3c9a9c9fd7fc6cb.zip | |
Horizon OS STD support
Co-authored-by: Ian Chamberlain <ian.h.chamberlain@gmail.com> Co-authored-by: Mark Drobnak <mark.drobnak@gmail.com>
Diffstat (limited to 'library/std/src/sys/unix/rand.rs')
| -rw-r--r-- | library/std/src/sys/unix/rand.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/library/std/src/sys/unix/rand.rs b/library/std/src/sys/unix/rand.rs index ea6df724713..56d01074c20 100644 --- a/library/std/src/sys/unix/rand.rs +++ b/library/std/src/sys/unix/rand.rs @@ -59,17 +59,27 @@ mod imp { unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), libc::GRND_NONBLOCK) } } - #[cfg(target_os = "espidf")] + #[cfg(any(target_os = "espidf", target_os = "horizon"))] fn getrandom(buf: &mut [u8]) -> libc::ssize_t { unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) } } - #[cfg(not(any(target_os = "linux", target_os = "android", target_os = "espidf")))] + #[cfg(not(any( + target_os = "linux", + target_os = "android", + target_os = "espidf", + target_os = "horizon" + )))] fn getrandom_fill_bytes(_buf: &mut [u8]) -> bool { false } - #[cfg(any(target_os = "linux", target_os = "android", target_os = "espidf"))] + #[cfg(any( + target_os = "linux", + target_os = "android", + target_os = "espidf", + target_os = "horizon" + ))] fn getrandom_fill_bytes(v: &mut [u8]) -> bool { use crate::sync::atomic::{AtomicBool, Ordering}; use crate::sys::os::errno; |
