Skip to content

Commit 9073acd

Browse files
committed
Add fallback for cfg(unix) targets that do not define libc::_SC_IOV_MAX.
1 parent 04a0114 commit 9073acd

File tree

1 file changed

+7
-0
lines changed
  • library/std/src/sys/unix

1 file changed

+7
-0
lines changed

library/std/src/sys/unix/fd.rs

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use crate::cmp;
44
use crate::io::{self, Initializer, IoSlice, IoSliceMut, Read};
55
use crate::mem;
6+
#[cfg(not(any(target_os = "redox", target_env = "newlib")))]
67
use crate::sync::atomic::{AtomicUsize, Ordering};
78
use crate::sys::cvt;
89
use crate::sys_common::AsInner;
@@ -27,6 +28,7 @@ const READ_LIMIT: usize = c_int::MAX as usize - 1;
2728
#[cfg(not(target_os = "macos"))]
2829
const READ_LIMIT: usize = libc::ssize_t::MAX as usize;
2930

31+
#[cfg(not(any(target_os = "redox", target_env = "newlib")))]
3032
fn max_iov() -> usize {
3133
static LIM: AtomicUsize = AtomicUsize::new(0);
3234

@@ -42,6 +44,11 @@ fn max_iov() -> usize {
4244
lim
4345
}
4446

47+
#[cfg(any(target_os = "redox", target_env = "newlib"))]
48+
fn max_iov() -> usize {
49+
16 // The minimum value required by POSIX.
50+
}
51+
4552
impl FileDesc {
4653
pub fn new(fd: c_int) -> FileDesc {
4754
FileDesc { fd }

0 commit comments

Comments
 (0)