We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4a0cc88 commit 3a81e1dCopy full SHA for 3a81e1d
library/std/src/sys/pal/unix/rand.rs
@@ -66,13 +66,20 @@ mod imp {
66
target_os = "espidf",
67
target_os = "horizon",
68
target_os = "freebsd",
69
- target_os = "dragonfly",
70
netbsd10
71
))]
72
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
73
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
74
}
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
+
83
#[cfg(not(any(
84
target_os = "linux",
85
target_os = "android",
0 commit comments