From bc6a5c71b635a9a5ea52c0b5f4ff297b0f611ac7 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 8 Dec 2023 15:26:16 +0000 Subject: [PATCH] std: getrandom simplification for freebsd. it is in the libcs' crate too now. --- library/std/src/sys/unix/rand.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/library/std/src/sys/unix/rand.rs b/library/std/src/sys/unix/rand.rs index 2825d16774272..cf0fe0f47c53f 100644 --- a/library/std/src/sys/unix/rand.rs +++ b/library/std/src/sys/unix/rand.rs @@ -64,17 +64,7 @@ mod imp { #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd"))] fn getrandom(buf: &mut [u8]) -> libc::ssize_t { - #[cfg(not(target_os = "freebsd"))] - use libc::getrandom; - #[cfg(target_os = "freebsd")] - extern "C" { - fn getrandom( - buf: *mut libc::c_void, - buflen: libc::size_t, - flags: libc::c_uint, - ) -> libc::ssize_t; - } - unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) } + unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) } } #[cfg(not(any(