about summary refs log tree commit diff
path: root/library/std/src/sys/unix
AgeCommit message (Collapse)AuthorLines
2020-09-14Remove use of `MaybeUninit` in `ucred.rs`Joe Ellis-5/+3
We can simply init the struct directly. There is no real need to use uninit memory here.
2020-09-14Implementation of peer credentials for Unix socketsJoe Ellis-0/+145
The code in `ucred.rs` is based on the work done in PR 13 in the tokio-uds repository on GitHub. Link below for reference: https://github.com/tokio-rs/tokio-uds/pull/13 Credit to Martin Habovštiak (GitHub username Kixunil) and contributors for this work!
2020-09-12Remove Windows details from Unix and VmWorks symlink() docstringsNicholas Bishop-9/+0
This note is not relevant to other operating systems.
2020-09-12Auto merge of #76561 - Thomasdezeeuw:iov-constant-limits, r=Amanieubors-18/+47
Use IOV_MAX and UIO_MAXIOV constants in limit vectored I/O Also updates the libc dependency to 0.2.77 (from 0.2.74) as the constants were only recently added. Related #68042, #75005 r? `@Amanieu` (also reviewed #75005)
2020-09-12Rollup merge of #76583 - CDirkx:os-doc, r=jonas-schievinkRalf Jung-5/+5
Update `std::os` module documentation. Adds missing descriptions for the modules `std::os::linux::fs` and `std::os::windows::io`. Also adds punctuation for consistency with other descriptions.
2020-09-11Ignore unnecessary unsafe warningsThomas de Zeeuw-2/+21
This is a work-around for a libc issue: https://github.com/rust-lang/libc/issues/1888.
2020-09-11Add `peek` and `peek_from` to `UnixStream` and `UnixDatagram`rijenkii-20/+192
2020-09-11Update `std::os` module documentation.Christiaan Dirkx-5/+5
Adds missing descriptions for the modules std::os::linux::fs and std::os::windows::io. Also adds punctuation for consistency with other descriptions.
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-09-09Only call pthread_attr_destroy() after getattr_np() succeeds on all libcsTavian Barnes-2/+4
The calling convention of pthread_getattr_np() is to initialize the pthread_attr_t, so _destroy() is only necessary on success (and _init() isn't necessary beforehand). On the other hand, FreeBSD wants the attr_t to be initialized before pthread_attr_get_np(), and therefore it should always be destroyed afterwards.
2020-09-09Fix segfault if pthread_getattr_np failsTavian Barnes-2/+6
glibc destroys[1] the passed pthread_attr_t if pthread_getattr_np() fails. Destroying it again leads to a segfault. Fix it by only destroying it on success for glibc. [1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_getattr_np.c;h=ce437205e41dc05653e435f6188768cccdd91c99;hb=HEAD#l205
2020-09-07Rollup merge of #76346 - gillespiecd:nlinks-docs, r=Dylan-DPCDylan DPC-1/+1
Docs: nlink example typo Small typo fix for the `nlink` function, extra whitespace before the `use` declaration
2020-09-05Auto merge of #75428 - the8472:fix-copy-eopnotsupp, r=joshtriplettbors-10/+17
Workarounds for copy_file_range issues fixes #75387 fixes #75446
2020-09-04Fix nlink example typoChris Gillespie-1/+1
2020-09-02Convert many files to intra-doc linksJoshua Nelson-2/+5
- Use intra-doc links for `std::io` in `std::fs` - Use intra-doc links for File::read in unix/ext/fs.rs - Remove explicit intra-doc links for `true` in `net/addr.rs` - Use intra-doc links in alloc/src/sync.rs - Use intra-doc links in src/ascii.rs - Switch to intra-doc links in alloc/rc.rs - Use intra-doc links in core/pin.rs - Use intra-doc links in std/prelude - Use shorter links in `std/fs.rs` `io` is already in scope.
2020-09-02Update docs of OpenOptions::as_flagsFederico Ponzi-3/+3
2020-08-31Update OpenOptions::as_flags docs, and minor stylingFederico Ponzi-9/+9
2020-08-31Merge branch 'convert-openoptions-cint' of github.com:FedericoPonzi/rust ↵Federico Ponzi-1/+0
into convert-openoptions-cint
2020-08-31Add as_flag function to the OpenOptionsExt structFederico Ponzi-7/+35
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-487/+482
Also doing fmt inplace as requested.
2020-08-30Fix typo get openoptions function nameFederico Ponzi-1/+1
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2020-08-30initial implementation of OpenOptions to c_intFederico Ponzi-0/+7
2020-08-21Make raw standard stream constructors constTomasz Miąsko-3/+3
2020-08-21Remove result type from raw standard streams constructorsTomasz Miąsko-7/+7
Raw standard streams constructors are infallible. Remove unnecessary result type.
2020-08-19Enable stack-overflow detection on musl for non-main threadsTomasz Miąsko-6/+21
2020-08-19resolve commentsPrabakaran Kumaresshan-11/+0
2020-08-19Switch to intra-doc links in /src/sys/unix/ext/*.rsPrabakaran Kumaresshan-74/+35
2020-08-15std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction.Eduard-Mihai Burtescu-8/+20
2020-08-14perform copy_file_range until EOF is reached instead of basing things on ↵The8472-3/+12
file size This solves several problems - race conditions where a file is truncated while copying from it. if we blindly trusted the file size this would lead to an infinite loop - proc files appearing empty to copy_file_range but not to read/write https://github.com/coreutils/coreutils/commit/4b04a0c - copy_file_range returning 0 for some filesystems (overlay? bind mounts?) inside docker, again leading to an infinite loop
2020-08-12more concise error matchingThe8472-8/+4
2020-08-12Workaround for copy_file_range spuriously returning EOPNOTSUPP when attemted ↵The8472-2/+4
on a NFS mount under RHEL/CentOS 7. The syscall is supposed to return ENOSYS in most cases but when calling it on NFS it may leak through EOPNOTSUPP even though that's supposed to be handled by the kernel and not returned to userspace. Since it returns ENOSYS in some cases anyway this will trip the HAS_COPY_FILE_RANGE detection anyway, so treat EOPNOTSUPP as if it were a ENOSYS. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.8_release_notes/deprecated_functionality#the_literal_copy_file_range_literal_call_has_been_disabled_on_local_file_systems_and_in_nfs https://bugzilla.redhat.com/show_bug.cgi?id=1783554
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/+11329