Skip to content

Commit b47de9a

Browse files
committed
Auto merge of rust-lang#117103 - matthiaskrgr:rollup-96zuuom, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang#107159 (rand use getrandom for freebsd (available since 12.x)) - rust-lang#116859 (Make `ty::print::Printer` take `&mut self` instead of `self`) - rust-lang#117046 (return unfixed len if pat has reported error) - rust-lang#117070 (rustdoc: wrap Type with Box instead of Generics) - rust-lang#117074 (Remove smir from triage and add me to stablemir) - rust-lang#117086 (Update .mailmap to promote my livename) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8939dfc + 9e2e080 commit b47de9a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

std/src/sys/unix/rand.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,15 @@ 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"))]
65+
#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd"))]
6666
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
67-
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
68-
}
69-
70-
#[cfg(target_os = "freebsd")]
71-
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
72-
// FIXME: using the above when libary std's libc is updated
67+
#[cfg(not(target_os = "freebsd"))]
68+
use libc::getrandom;
69+
#[cfg(target_os = "freebsd")]
7370
extern "C" {
7471
fn getrandom(
75-
buffer: *mut libc::c_void,
76-
length: libc::size_t,
72+
buf: *mut libc::c_void,
73+
buflen: libc::size_t,
7774
flags: libc::c_uint,
7875
) -> libc::ssize_t;
7976
}
@@ -236,6 +233,7 @@ mod imp {
236233
}
237234
}
238235

236+
// FIXME: once the 10.x release becomes the minimum, this can be dropped for simplification.
239237
#[cfg(target_os = "netbsd")]
240238
mod imp {
241239
use crate::ptr;

0 commit comments

Comments
 (0)