about summary refs log tree commit diff
path: root/library/std/src/sys
AgeCommit message (Collapse)AuthorLines
2020-09-14Add basic test for Unix peer credentialsJoe Ellis-0/+20
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-18/+0
This note is not relevant to other operating systems.
2020-09-12Small cleanups in Windows Mutex.Mara Bos-32/+32
- Move `held` into the boxed part, since the SRW lock implementation does not use this. This makes the Mutex 50% smaller. - Use `Cell` instead of `UnsafeCell` for `held`, such that `.replace()` can be used. - Add some comments.
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-6/+8
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-6/+8
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-08Capitalize safety commentsFlying-Toast-2/+2
2020-09-07Rollup merge of #76346 - gillespiecd:nlinks-docs, r=Dylan-DPCDylan DPC-2/+2
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-2/+2
2020-09-04Add is_enclave_range/is_user_range overflow checksTheodore Cipicchio-8/+34
Functions such as `is_enclave_range` and `is_user_range` in `sgx::os::fortanix_sgx::mem` are often used to make sure memory ranges passed to an enclave from untrusted code or passed to other trusted code functions are safe to use for their intended purpose. Currently, these functions do not perform any checks to make sure the range provided doesn't overflow when adding the range length to the base address. While debug builds will panic if overflow occurs, release builds will simply wrap the result, leading to false positive results for either function. The burden is placed on application authors to know to perform overflow checks on their own before calling these functions, which can easily lead to security vulnerabilities if omitted. Additionally, since such checks are performed in the Intel SGX SDK versions of these functions, developers migrating from Intel SGX SDK code may expect these functions to operate the same. This commit adds explicit overflow checking to `is_enclave_range` and `is_user_range`, returning `false` if overflow occurs in order to prevent misuse of invalid memory ranges. It also alters the checks to account for ranges that lie exactly at the end of the address space, where calculating `p + len` would overflow despite the range being valid.
2020-09-03Improve SGX RWLock initializer testJethro Beekman-23/+11
2020-09-03Auto merge of #76235 - jyn514:std-intra-links, r=poliorceticsbors-2/+5
Convert many files to intra-doc links Helps with https://github.com/rust-lang/rust/issues/75080 r? @poliorcetics I recommend reviewing one commit at a time, but the diff is small enough you can do it all at once if you like :)
2020-09-03Auto merge of #75971 - Amjad50:libstd-deny-unsafe_op_in_unsafe_fn, ↵bors-8/+60
r=Mark-Simulacrum Applied `#![deny(unsafe_op_in_unsafe_fn)]` in library/std/src/wasi partial fix for #73904 There are still more that was not applied in [mod.rs]( https://github.com/rust-lang/rust/blob/38fab2ea92a48980219989817201bf2094ae826a/library/std/src/sys/wasi/mod.rs) and that is due to its using files from `../unsupported` like: ``` #[path = "../unsupported/cmath.rs"] pub mod cmath; ```
2020-09-03Applied `#![deny(unsafe_op_in_unsafe_fn)]` in library/std/src/wasiAmjad Alsharafi-8/+60
All refactoring needed was only in `alloc.rs`, changed part of the code in `alloc` method to satisfy the SAFETY statement
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-1182/+1160
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-30Rollup merge of #75990 - rylev:arm-fastfail, r=alexcrichtonDylan DPC-3/+13
Add __fastfail for Windows on arm/aarch64 Fixes #73215
2020-08-30Rollup merge of #75832 - kofls:intradoc-fix, r=jyn514Dylan DPC-25/+2
Move to intra-doc links for wasi/ext/fs.rs, os_str_bytes.rs… …, primitive_docs.rs & poison.rs Partial fix for #75080 r? @jyn514
2020-08-29Explicitly look for 'thumb-mode' before using __fastfail on 'arm'Ryan Levick-1/+1
2020-08-28Back to opcode for 32 bit ARM __fastfailRyan Levick-1/+1
2020-08-28Switch to asm! macro and use brk instruction on ARMRyan Levick-3/+3
2020-08-27Add __fastfail for Windows on arm/aarch64Ryan Levick-3/+13
2020-08-27Rollup merge of #75758 - bpangWR:master, r=Mark-SimulacrumDylan DPC-14/+5
Fixes for VxWorks r? @alexcrichton
2020-08-26Move to intra-doc links for wasi/ext/fs.rs, os_str_bytes.rs, ↵Surya Midatala-25/+2
primitive_docs.rs & poison.rs
2020-08-25For VxWorks:Pang, Baoshan-14/+5
fix building errors use wr-c++ as linker
2020-08-25Auto merge of #75364 - rylev:libpanic-abort-failfast, r=alexcrichtonbors-8/+4
Call into fastfail on abort in libpanic_abort on Windows x86(_64) This partially resolves #73215 though this is only for x86 targets. This code is directly lifted from [libstd](https://github.com/rust-lang/rust/blob/13290e83a6e20f3b408d177a9d64d8cf98fe4615/library/std/src/sys/windows/mod.rs#L315). `__fastfail` is the preferred way to abort a process on Windows as it will hook into debugger toolchains. Other platforms expose a `_rust_abort` symbol which wraps `std::sys::abort_internal`. This would also work on Windows, but is a slightly largely change as we'd need to make sure that the symbol is properly exposed to the linker. I'm inlining the call to the `__fastfail`, but the indirection through `rust_abort` might be a cleaner approach. A different instruction must be used on ARM architectures. I'd like to verify this works first before tackling ARM.
2020-08-21Make raw standard stream constructors constTomasz Miąsko-27/+27
2020-08-21Remove result type from raw standard streams constructorsTomasz Miąsko-61/+61
Raw standard streams constructors are infallible. Remove unnecessary result type.
2020-08-21Add `#![allow(unsafe_op_in_unsafe_fn)]` in sys/hermitmaekawatoshiki-0/+17
2020-08-21Revert "`#![deny(unsafe_op_in_unsafe_fn)]` in sys/hermit"maekawatoshiki-147/+75
This reverts commit 7cae9e8c88e468e94c157d9aaee4b8e3cf90b9a4.
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-16Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rsPrabakaran Kumaresshan-34/+8
2020-08-15inline linkingPrabakaran Kumaresshan-6/+2
2020-08-15remove empty linesPrabakaran Kumaresshan-7/+0