about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-01-09 13:23:16 +0100
committerGitHub <noreply@github.com>2024-01-09 13:23:16 +0100
commitdf2f4ae4acac07922a87801b1bf6ebae29ef4392 (patch)
tree3d2c8abee998ab32de76e08c17548294f426f4fb /library/std/src/sys
parent4a24b5bc054f78c165cbdf4dd3e0a7f56f468d7d (diff)
parentbc6a5c71b635a9a5ea52c0b5f4ff297b0f611ac7 (diff)
downloadrust-df2f4ae4acac07922a87801b1bf6ebae29ef4392.tar.gz
rust-df2f4ae4acac07922a87801b1bf6ebae29ef4392.zip
Rollup merge of #118748 - devnexen:fbsd_getrandom_simpl, r=Nilstrieb,dtolnay
std: getrandom simplification for freebsd.

it is in the libcs' crate too now.
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/unix/rand.rs12
1 files changed, 1 insertions, 11 deletions
diff --git a/library/std/src/sys/unix/rand.rs b/library/std/src/sys/unix/rand.rs
index 2825d167742..cf0fe0f47c5 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(