mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Add fallback for cfg(unix) targets that do not define libc::_SC_IOV_MAX.
This commit is contained in:
parent
04a0114e7e
commit
9073acdc98
@ -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 }
|
||||
|
Loading…
Reference in New Issue
Block a user