panic_unwind = { path = "../panic_unwind", optional = true }
panic_abort = { path = "../panic_abort" }
core = { path = "../core" }
-libc = { version = "0.2.74", default-features = false, features = ['rustc-dep-of-std'] }
+libc = { version = "0.2.77", default-features = false, features = ['rustc-dep-of-std'] }
compiler_builtins = { version = "0.1.35" }
profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" }
use crate::io::{self, Initializer, IoSlice, IoSliceMut, Read};
use crate::mem;
#[cfg(not(any(target_os = "redox", target_env = "newlib")))]
-use crate::sync::atomic::{AtomicUsize, Ordering};
use crate::sys::cvt;
use crate::sys_common::AsInner;
#[cfg(not(target_os = "macos"))]
const READ_LIMIT: usize = libc::ssize_t::MAX as usize;
-#[cfg(not(any(target_os = "redox", target_env = "newlib")))]
-fn max_iov() -> usize {
- static LIM: AtomicUsize = AtomicUsize::new(0);
-
- let mut lim = LIM.load(Ordering::Relaxed);
- if lim == 0 {
- let ret = unsafe { libc::sysconf(libc::_SC_IOV_MAX) };
-
- // 16 is the minimum value required by POSIX.
- lim = if ret > 0 { ret as usize } else { 16 };
- LIM.store(lim, Ordering::Relaxed);
- }
+#[cfg(any(
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "netbsd",
+ target_os = "openbsd",
+))]
+const fn max_iov() -> usize {
+ libc::IOV_MAX as usize
+}
- lim
+#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux"))]
+const fn max_iov() -> usize {
+ libc::UIO_MAXIOV as usize
}
-#[cfg(any(target_os = "redox", target_env = "newlib"))]
-fn max_iov() -> usize {
+#[cfg(not(any(
+ target_os = "android",
+ target_os = "dragonfly",
+ target_os = "emscripten",
+ target_os = "freebsd",
+ target_os = "ios",
+ target_os = "linux",
+ target_os = "macos",
+ target_os = "netbsd",
+ target_os = "openbsd",
+)))]
+const fn max_iov() -> usize {
16 // The minimum value required by POSIX.
}