about summary refs log tree commit diff
path: root/library/std/src/sys/unix/fd.rs
AgeCommit message (Collapse)AuthorLines
2020-12-20Check that c_int is i32 in FileDesc::new.Mara Bos-1/+1
2020-12-10Add safety note to library/std/src/sys/unix/fd.rsMichael Howell-0/+1
Co-authored-by: Elichai Turkel <elichai.turkel@gmail.com>
2020-12-10Mark `-1` as an available niche for file descriptorsMichael Howell-1/+7
Based on discussion from https://internals.rust-lang.org/t/can-the-standard-library-shrink-option-file/12768, the file descriptor -1 is chosen based on the POSIX API designs that use it as a sentinel to report errors. A bigger niche could've been chosen, particularly on Linux, but would not necessarily be portable. This PR also adds a test case to ensure that the -1 niche (which is kind of hacky and has no obvious test case) works correctly. It requires the "upper" bound, which is actually -1, to be expressed in two's complement.
2020-10-16Take sys/vxworks/{fd,fs,io} from sys/unix instead.Mara Bos-2/+4
2020-09-11Ignore unnecessary unsafe warningsThomas de Zeeuw-1/+0
This is a work-around for a libc issue: https://github.com/rust-lang/libc/issues/1888.
2020-09-10Use IOV_MAX and UIO_MAXIOV constants in limit vectored I/OThomas de Zeeuw-16/+26
Also updates the libc dependency to 0.2.77 (from 0.2.74) as the constants were only recently added.
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-13/+3
Also doing fmt inplace as requested.
2020-08-06Keep stdout open in limit_vector_count testTomasz Miąsko-2/+2
2020-08-05Add fallback for cfg(unix) targets that do not define libc::_SC_IOV_MAX.Adam Reichold-0/+7
2020-08-05Rely only on POSIX semantics for I/O vector countAdam Reichold-17/+3
All #[cfg(unix)] platforms follow the POSIX standard and define _SC_IOV_MAX so that we rely purely on POSIX semantics to determine the limits on I/O vector count.
2020-08-05Reduce synchronization overhead of I/O vector count memoizationAdam Reichold-10/+14
2020-08-05Memoize the I/O vector count limitAdam Reichold-12/+17
Keep the I/O vector count limit in a `SyncOnceCell` to avoid the overhead of repeatedly calling `sysconf` as these limits are guaranteed to not change during the lifetime of a process by POSIX.
2020-08-05Query maximum vector count on Linux and macOSAdam Reichold-2/+36
Both Linux and MacOS enforce limits on the vector count when performing vectored I/O via the readv and writev system calls and return EINVAL when these limits are exceeded. This changes the standard library to handle those limits as short reads and writes to avoid forcing its users to query these limits using platform specific mechanisms.
2020-07-27mv std libs to library/mark-0/+258