diff options
| author | Adam Reichold <adam.reichold@t-online.de> | 2020-08-05 16:56:51 +0200 |
|---|---|---|
| committer | Adam Reichold <adam.reichold@t-online.de> | 2020-08-05 17:15:08 +0200 |
| commit | 9073acdc9888acd2ba66601a77b96fbda67ac8c7 (patch) | |
| tree | cd375c98b72d1a949d7d6e2ff7a56f606b20f99a /library/std/src | |
| parent | 04a0114e7ecc44049425aaf8f7ba7f66da80e0c4 (diff) | |
| download | rust-9073acdc9888acd2ba66601a77b96fbda67ac8c7.tar.gz rust-9073acdc9888acd2ba66601a77b96fbda67ac8c7.zip | |
Add fallback for cfg(unix) targets that do not define libc::_SC_IOV_MAX.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys/unix/fd.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs index 6b8f3ea172d..e36a53084ba 100644 --- a/library/std/src/sys/unix/fd.rs +++ b/library/std/src/sys/unix/fd.rs @@ -3,6 +3,7 @@ use crate::cmp; 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; @@ -27,6 +28,7 @@ const READ_LIMIT: usize = c_int::MAX as usize - 1; #[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); @@ -42,6 +44,11 @@ fn max_iov() -> usize { lim } +#[cfg(any(target_os = "redox", target_env = "newlib"))] +fn max_iov() -> usize { + 16 // The minimum value required by POSIX. +} + impl FileDesc { pub fn new(fd: c_int) -> FileDesc { FileDesc { fd } |
