Skip to content

Commit d416a22

Browse files
committed
std::rand: enable getrandom for dragonflybsd too.
1 parent e612d07 commit d416a22

File tree

1 file changed

+9
-1
lines changed
  • library/std/src/sys/pal/unix

1 file changed

+9
-1
lines changed

library/std/src/sys/pal/unix/rand.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ mod imp {
6262
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), libc::GRND_NONBLOCK) }
6363
}
6464

65-
#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd", netbsd10))]
65+
#[cfg(any(
66+
target_os = "espidf",
67+
target_os = "horizon",
68+
target_os = "freebsd",
69+
target_os = "dragonfly",
70+
netbsd10
71+
))]
6672
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
6773
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
6874
}
@@ -73,6 +79,7 @@ mod imp {
7379
target_os = "espidf",
7480
target_os = "horizon",
7581
target_os = "freebsd",
82+
target_os = "dragonfly",
7683
netbsd10
7784
)))]
7885
fn getrandom_fill_bytes(_buf: &mut [u8]) -> bool {
@@ -85,6 +92,7 @@ mod imp {
8592
target_os = "espidf",
8693
target_os = "horizon",
8794
target_os = "freebsd",
95+
target_os = "dragonfly",
8896
netbsd10
8997
))]
9098
fn getrandom_fill_bytes(v: &mut [u8]) -> bool {

0 commit comments

Comments
 (0)