about summary refs log tree commit diff
path: root/library/std/src/sys
AgeCommit message (Collapse)AuthorLines
2021-05-07Rollup merge of #85030 - jethrogb:jb/sgx-rearrange-files, r=nagisaDylan DPC-6/+7
Rearrange SGX split module files In #75979 several inlined modules were split out into multiple files. This PR keeps the multiple files but moves a few things around to organize things in a coherent way.
2021-05-07Rollup merge of #85029 - jethrogb:jb/sgx-movable-mutex, r=m-ou-seDylan DPC-1/+1
SGX mutex is movable r? ``@m-ou-se``
2021-05-07Rollup merge of #84655 - CDirkx:wasm, r=m-ou-seDylan DPC-65/+14
Cleanup of `wasm` Some more cleanup of `sys`, this time `wasm` - Reuse `unsupported::args` (functionally equivalent implementation, just an empty iterator). - Split out `atomics` implementation of `wasm::thread`, the non-`atomics` implementation is reused from `unsupported`. - Move all of the `atomics` code to a separate directory `wasm/atomics`. ````@rustbot```` label: +T-libs-impl r? ````@m-ou-se````
2021-05-07Rearrange SGX split module filesJethro Beekman-6/+7
In #75979 several inlined modules were split out into multiple files. This PR keeps the multiple files but moves a few things around to organize things in a coherent way.
2021-05-07SGX mutex is movableJethro Beekman-1/+1
2021-05-07Rollup merge of #84409 - mzohreva:mz/tls-dtors-before-join, r=jethrogbDylan DPC-10/+65
Ensure TLS destructors run before thread joins in SGX The excellent test is from ```@jethrogb``` For context see: https://github.com/rust-lang/rust/pull/83416#discussion_r617282907
2021-05-06Rollup merge of #84712 - joshtriplett:simplify-chdir, r=yaahcDylan DPC-5/+3
Simplify chdir implementation and minimize unsafe block
2021-05-03Allow documenting on `hermit`Christiaan Dirkx-1/+0
2021-05-03Move `std::sys::sgx::ext` to `std::os::fortanix_sgx`Christiaan Dirkx-267/+0
2021-05-03Move `std::sys::wasi::ext` to `std::os::wasi`Christiaan Dirkx-813/+0
2021-05-03Move `std::sys::unix::ext` to `std::os::unix`Christiaan Dirkx-5390/+0
2021-05-03Move `std::sys::windows::ext` to `std::os::windows`Christiaan Dirkx-1155/+3
2021-05-03Move `std::sys::hermit::ext` to `std::os::hermit`Christiaan Dirkx-53/+0
2021-05-03Cleanup `std::os`Christiaan Dirkx-35/+23
2021-05-03Auto merge of #84842 - blkerby:null_lowercase, r=joshtriplettbors-5/+5
Replace 'NULL' with 'null' This replaces occurrences of "NULL" with "null" in docs, comments, and compiler error/lint messages. This is for the sake of consistency, as the lowercase "null" is already the dominant form in Rust. The all-caps NULL looks like the C macro (or SQL keyword), which seems out of place in a Rust context, given that NULL does not exist in the Rust language or standard library (instead having [`ptr::null()`](https://doc.rust-lang.org/stable/std/ptr/fn.null.html)).
2021-05-02Change 'NULL' to 'null'Brent Kerby-5/+5
2021-05-02Use ErrorKind::OutOfMemory in unix, windows, and wasiKornel-0/+5
2021-05-01Auto merge of #84658 - Amanieu:reserved_regs, r=petrochenkovbors-2/+8
Be stricter about rejecting LLVM reserved registers in asm! LLVM will silently produce incorrect code if these registers are used as operands. cc `@rust-lang/wg-inline-asm`
2021-05-01Reserve x18 on AArch64 and un-reserve x16Amanieu d'Antras-4/+4
2021-04-30Avoid using rbx in SGX inline assembly since it is reservedAmanieu d'Antras-2/+8
2021-04-30Auto merge of #84716 - joshtriplett:chroot, r=dtolnaybors-0/+33
Add std::os::unix::fs::chroot to change the root directory of the current process This is a straightforward wrapper that uses the existing helpers for C string handling and errno handling. Having this available is convenient for UNIX utility programs written in Rust, and avoids having to call the unsafe `libc::chroot` directly and handle errors manually, in a program that may otherwise be entirely safe code.
2021-04-30Auto merge of #84522 - CDirkx:cmath, r=yaahcbors-118/+34
Reuse `sys::unix::cmath` on other platforms Reuse `sys::unix::cmath` on all non-`windows` platforms. `unix` is chosen as the canonical location instead of `unsupported` or `common` because `unsupported` doesn't make sense semantically and `common` is reserved for code that is supported on all platforms. Also `unix` is already the home of some non-`windows` code that is technically not exclusive to `unix` like `unix::path`.
2021-04-30Add std::os::unix::fs::chroot to change the root directory of the current ↵Josh Triplett-0/+33
process This is a straightforward wrapper that uses the existing helpers for C string handling and errno handling. Having this available is convenient for UNIX utility programs written in Rust, and avoids having to call the unsafe `libc::chroot` directly and handle errors manually, in a program that may otherwise be entirely safe code.
2021-04-29Simplify chdir implementation and minimize unsafe blockJosh Triplett-5/+3
2021-04-28Remove `DropGuard` in `sys::windows::process` and use `StaticMutex` insteadChristiaan Dirkx-24/+4
2021-04-28Fix missing import in `unsupported::args`Christiaan Dirkx-0/+1
2021-04-28Reuse `unsupported::args` on `wasm`Christiaan Dirkx-42/+1
2021-04-28Move `wasm` atomics code to `wasm/atomics`Christiaan Dirkx-5/+5
2021-04-28Rework `wasm::thread` to `thread_atomics`Christiaan Dirkx-19/+8
2021-04-28Reuse `unix::cmath`Christiaan Dirkx-118/+34
2021-04-27Rollup merge of #84521 - CDirkx:hermit-dedup, r=Mark-SimulacrumDylan DPC-92/+3
Reuse modules on `hermit` Reuse the following modules on `hermit`: - `unix::path` (contents identical) - `unsupported::io` (contents identical) - `unsupported::thread_local_key` (contents functionally identical, only changes are the panic error messages) `@rustbot` label: +T-libs-impl
2021-04-25Rollup merge of #84541 - KaiJewson:inline-raw, r=m-ou-seDylan DPC-0/+76
Inline most raw socket, fd and handle conversions Now that file descriptor types on Unix have niches, it is advantageous for user libraries which provide file descriptor wrappers (e.g. `Socket` from socket2) to store a `File` internally instead of a `RawFd`, so that the niche can be taken advantage of. However, doing so will currently result in worse performance as `IntoRawFd`, `FromRawFd` and `AsRawFd` are not inlined. This change adds `#[inline]` to those methods on std types that wrap file descriptors, handles or sockets.
2021-04-25Inline most raw socket, fd and handle conversionsKaiJewson-0/+76
2021-04-25Auto merge of #84115 - CDirkx:rt, r=m-ou-sebors-89/+81
Rework `init` and `cleanup` This PR reworks the code in `std` that runs before and after `main` and centralizes this code respectively in the functions `init` and `cleanup` in both `sys_common` and `sys`. This makes is easy to see what code is executed during initialization and cleanup on each platform just by looking at e.g. `sys::windows::init`. Full list of changes: - new module `rt` in `sys_common` to contain `init` and `cleanup` and the runtime macros. - `at_exit` and the mechanism to register exit handlers has been completely removed. In practice this was only used for closing sockets on windows and flushing stdout, which have been moved to `cleanup`. - <s>On windows `alloc` and `net` initialization is now done in `init`, this saves a runtime check in every allocation and network use.</s>
2021-04-24Reuse `unix::path` and `unsupported::{io, thread_local_key}` on `hermit`Christiaan Dirkx-92/+3
2021-04-23Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`Christiaan Dirkx-27/+30
2021-04-22Rollup merge of #84413 - CDirkx:args_inner_debug, r=m-ou-seDylan DPC-30/+25
Remove `sys::args::Args::inner_debug` and use `Debug` instead This removes the method `sys::args::Args::inner_debug` on all platforms and implements `Debug` for `Args` instead. I believe this creates a more natural API for the different platforms under `sys`: export a type `Args: Debug + Iterator + ...` vs. `Args: Iterator + ...` and with a method `inner_debug`.
2021-04-22Rollup merge of #84402 - CDirkx:rwlock, r=dtolnayDylan DPC-1/+53
Move `sys_common::rwlock::StaticRWLock` etc. to `sys::unix::rwlock` This moves `sys_common::rwlock::StaticRwLock`, `RWLockReadGuard` and `RWLockWriteGuard` to `sys::unix::rwlock`. They are already `#[cfg(unix)]` and don't need to be in `sys_common`.
2021-04-22Document that `init` and `cleanup` are not guaranteed to runChristiaan Dirkx-0/+10
2021-04-22Apply suggestions from reviewChristiaan Dirkx-7/+10
2021-04-22Move most init to `sys::init`Christiaan Dirkx-51/+30
2021-04-22Remove `sys::args::Args::inner_debug` and use `Debug` insteadChristiaan Dirkx-30/+25
2021-04-22Move all cleanup to `sys::cleanup`Christiaan Dirkx-22/+7
2021-04-22Rework `at_exit` to `cleanup`Christiaan Dirkx-21/+36
2021-04-21Ensure TLS destructors run before thread joins in SGXMohsen Zohrevandi-10/+65
2021-04-21Rollup merge of #84212 - CDirkx:void, r=m-ou-seMara Bos-252/+238
Replace `Void` in `sys` with never type This PR replaces several occurrences in `sys` of the type `enum Void {}` with the Rust never type (`!`). The name `Void` is unfortunate because in other languages (C etc.) it refers to a unit type, not an uninhabited type. Note that the previous stabilization of the never type was reverted, however all uses here are implementation details and not publicly visible.
2021-04-21Move `sys_common::rwlock::StaticRWLock` etc. to `sys::unix::rwlock`Christiaan Dirkx-1/+53
2021-04-21Apply suggestions from code reviewChristiaan Dirkx-2/+4
2021-04-20Change uses of never typeChristiaan Dirkx-196/+198
2021-04-20Replace `Void` with never typeChristiaan Dirkx-60/+44