fix building libstd for Miri on macOS
This commit is contained in:
parent
6369a98ebd
commit
dc8414b607
|
@ -93,17 +93,20 @@ pub fn init() {
|
|||
reset_sigpipe();
|
||||
}
|
||||
|
||||
// In the case when all file descriptors are open, the poll has been
|
||||
// observed to perform better than fcntl (on GNU/Linux).
|
||||
#[cfg(not(any(
|
||||
miri,
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(miri)] {
|
||||
// The standard fds are always available in Miri.
|
||||
unsafe fn sanitize_standard_fds() {}
|
||||
} else if #[cfg(not(any(
|
||||
target_os = "emscripten",
|
||||
target_os = "fuchsia",
|
||||
// The poll on Darwin doesn't set POLLNVAL for closed fds.
|
||||
target_os = "macos",
|
||||
target_os = "ios",
|
||||
target_os = "redox",
|
||||
)))]
|
||||
)))] {
|
||||
// In the case when all file descriptors are open, the poll has been
|
||||
// observed to perform better than fcntl (on GNU/Linux).
|
||||
unsafe fn sanitize_standard_fds() {
|
||||
use crate::sys::os::errno;
|
||||
let pfds: &mut [_] = &mut [
|
||||
|
@ -130,7 +133,7 @@ pub fn init() {
|
|||
}
|
||||
}
|
||||
}
|
||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "redox"))]
|
||||
} else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "redox"))] {
|
||||
unsafe fn sanitize_standard_fds() {
|
||||
use crate::sys::os::errno;
|
||||
for fd in 0..3 {
|
||||
|
@ -141,12 +144,10 @@ pub fn init() {
|
|||
}
|
||||
}
|
||||
}
|
||||
#[cfg(any(
|
||||
// The standard fds are always available in Miri.
|
||||
miri,
|
||||
target_os = "emscripten",
|
||||
target_os = "fuchsia"))]
|
||||
} else {
|
||||
unsafe fn sanitize_standard_fds() {}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "emscripten", target_os = "fuchsia")))]
|
||||
unsafe fn reset_sigpipe() {
|
||||
|
|
Loading…
Reference in New Issue