about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2024-05-05 19:03:38 +0000
committerDavid Carlier <devnexen@gmail.com>2024-05-06 13:31:58 +0000
commit1d45f47d24e43546b2a3e71fea80660c86343f41 (patch)
treed30b223c98ea0fccf231d419c584149c95eaaa33
parent7c4ac0603e9ee5295bc802c90575391288a69a8a (diff)
downloadrust-1d45f47d24e43546b2a3e71fea80660c86343f41.tar.gz
rust-1d45f47d24e43546b2a3e71fea80660c86343f41.zip
std::rand: adding solaris/illumos for getrandom support.
To help solarish support for miri https://rust-lang/miri/issues/3567
-rw-r--r--library/std/src/sys/pal/unix/rand.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/library/std/src/sys/pal/unix/rand.rs b/library/std/src/sys/pal/unix/rand.rs
index d8f227b4ef4..e6df109a6b8 100644
--- a/library/std/src/sys/pal/unix/rand.rs
+++ b/library/std/src/sys/pal/unix/rand.rs
@@ -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) }
     }
@@ -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 {
@@ -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 {