Skip to content

Commit 3a81e1d

Browse files
committed
std::rand: fix dragonflybsd after rust-lang#121942.
1 parent 4a0cc88 commit 3a81e1d

File tree

1 file changed

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

1 file changed

+8
-1
lines changed

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,20 @@ mod imp {
6666
target_os = "espidf",
6767
target_os = "horizon",
6868
target_os = "freebsd",
69-
target_os = "dragonfly",
7069
netbsd10
7170
))]
7271
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
7372
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
7473
}
7574

75+
#[cfg(target_os = "dragonfly")]
76+
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
77+
extern "C" {
78+
fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> c_int;
79+
}
80+
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
81+
}
82+
7683
#[cfg(not(any(
7784
target_os = "linux",
7885
target_os = "android",

0 commit comments

Comments
 (0)