about summary refs log tree commit diff
path: root/library/std/src/sys
AgeCommit message (Collapse)AuthorLines
2024-07-15Remove LPOVERLAPPEDChris Denton-2/+1
2024-07-15Remove LPCVOIDChris Denton-2/+1
2024-07-15Remove SIZE_TChris Denton-3/+2
2024-07-15Remove CHARChris Denton-4/+3
As with USHORT, keep using C types for BSD socket APIs.
2024-07-15Remove USHORTChris Denton-4/+3
We stick to C types in for socket and address as these are at least nominally BSD-ish and they're used outside of pal/windows in general *nix code
2024-07-15Remove LPWSTRChris Denton-10/+8
2024-07-15Remove UINTChris Denton-2/+1
2024-07-15Remove LONGChris Denton-4/+2
2024-07-15Remove LARGE_INTEGERChris Denton-16/+15
2024-07-15Remove NonZeroDWORDChris Denton-5/+3
2024-07-14std: deny(unsafe_op_in_unsafe_fn) but allow sitesJubilee Young-0/+2
This provides a list of locations to hunt down issues in.
2024-07-14std: removes logarithms family function edge cases handling for solaris.David Carlier-31/+0
Issue had been fixed over time with solaris, 11.x behaves correctly (and we support it as minimum), illumos works correctly too.
2024-07-13Rollup merge of #127370 - ChrisDenton:win-sys, r=Mark-SimulacrumJubilee-67/+77
Windows: Add experimental support for linking std-required system DLLs using raw-dylib For Windows, this allows std to define system imports without needing the user to have import libraries. It's intended for this to become the default. For now it's an experimental feature so it can be tested using build-std.
2024-07-13std::unix::fs: removing, now useless, layers predating macOs 10.10.David Carlier-59/+1
fdopendir, openat and unlinkat are available since yosemite but we support sierra as minimum.
2024-07-13Auto merge of #127397 - jyn514:multi-thread-panic-hook, r=workingjubileebors-28/+25
fix interleaved output in the default panic hook when multiple threads panic simultaneously previously, we only held a lock for printing the backtrace itself. since all threads were printing to the same file descriptor, that meant random output in the default panic hook from one thread would be interleaved with the backtrace from another. now, we hold the lock for the full duration of the hook, and the output is ordered. --- i noticed some odd things while working on this you may or may not already be aware of. - libbacktrace is included as a submodule instead of a normal rustc crate, and as a result uses `cfg(backtrace_in_std)` instead of a more normal `cfg(feature = "rustc-dep-of-std")`. probably this is left over from before rust used a cargo-based build system? - the default panic handler uses `trace_unsynchronized`, etc, in `sys::backtrace::print`. as a result, the lock only applies to concurrent *panic handlers*, not concurrent *threads*. in other words, if another, non-panicking, thread tried to print a backtrace at the same time as the panic handler, we may have UB, especially on windows. - we have the option of changing backtrace to enable locking when `backtrace_in_std` is set so we can reuse their lock instead of trying to add our own.
2024-07-13Auto merge of #126606 - zachs18:patch-2, r=joboetbors-0/+74
Guard against calling `libc::exit` multiple times on Linux. Mitigates (but does not fix) #126600 by ensuring only one thread which calls Rust `exit` actually calls `libc::exit`, and all other callers of Rust `exit` block.
2024-07-12fix interleaved panic outputjyn-28/+25
previously, we only held a lock for printing the backtrace itself. since all threads were printing to the same file descriptor, that meant random output in the default panic hook would be interleaved with the backtrace. now, we hold the lock for the full duration of the hook, and the output is ordered.
2024-07-12Rollup merge of #126827 - the8472:pidfd-spawn, r=workingjubileeMatthias Krüger-6/+131
Use pidfd_spawn for faster process spawning when a PidFd is requested glibc 2.39 added `pidfd_spawnp` and `pidfd_getpid` which makes it possible to get pidfds while staying on the CLONE_VFORK path. verified that vfork gets used with strace: ``` $ strace -ff -e pidfd_open,clone3,openat,execve,waitid,close ./x test std --no-doc -- pidfd [...] [pid 2820532] clone3({flags=CLONE_VM|CLONE_PIDFD|CLONE_VFORK|CLONE_CLEAR_SIGHAND, pidfd=0x7b7f885fec6c, exit_signal=SIGCHLD, stack=0x7b7f88aff000, stack_size=0x9000}strace: Process 2820533 attached <unfinished ...> [pid 2820533] execve("/home/the8472/bin/sleep", ["sleep", "1000"], 0x7ffdd0e268d8 /* 107 vars */) = -1 ENOENT (No such file or directory) [pid 2820533] execve("/home/the8472/.cargo/bin/sleep", ["sleep", "1000"], 0x7ffdd0e268d8 /* 107 vars */) = -1 ENOENT (No such file or directory) [pid 2820533] execve("/usr/local/bin/sleep", ["sleep", "1000"], 0x7ffdd0e268d8 /* 107 vars */) = -1 ENOENT (No such file or directory) [pid 2820533] execve("/usr/bin/sleep", ["sleep", "1000"], 0x7ffdd0e268d8 /* 107 vars */ <unfinished ...> [pid 2820532] <... clone3 resumed> => {pidfd=[3]}, 88) = 2820533 [pid 2820533] <... execve resumed>) = 0 [pid 2820532] openat(AT_FDCWD, "/proc/self/fdinfo/3", O_RDONLY|O_CLOEXEC) = 4 [pid 2820532] close(4) = 0 ``` Tracking issue: #82971
2024-07-10Explicitly ignore `into_raw_handle()` using `let _ =` in sys/pal/windows.Zachary S-3/+3
2024-07-09Exposing STARTUPINFOW.wShowWindow in CommandExt (show_window function) to ↵Andres Olivares-0/+10
control how a new process should display its window (normal, minimized, maximized, etc)
2024-07-08Attempt to fix CIzachs18-3/+12
2024-07-08Reset sigpipe not supported for vxworksB I Mohammed Abbas-0/+1
2024-07-07Move/change declaration of `mod exit_guard;`zachs18-1/+1
2024-07-05Attempt to fix CIZachary S-0/+2
2024-07-05Move exit guard from sys::common::exit_guard to sys::exit_guard.Zachary S-2/+2
2024-07-05Update library/std/src/sys/pal/common/exit_guard.rszachs18-3/+5
Co-authored-by: Ralf Jung <post@ralfj.de>
2024-07-05Add experimental raw-dylib feature to stdChris Denton-0/+13
For Windows, this allows defining imports without needing the user to have import libraries. It's intended for this to become the default.
2024-07-05Use windows_targets macro for allocChris Denton-67/+64
2024-07-05Rollup merge of #127320 - ChrisDenton:win-sys, r=Mark-SimulacrumGuillaume Gomez-851/+162
Update windows-bindgen to 0.58.0 This also switches from the bespoke `std` generated bindings to the normal `sys` ones everyone else uses. This has almost no difference except that the `sys` bindings use the `windows_targets::links!` macro for FFI imports, which we implement manually. This does cause the diff to look much larger than it really is but the bulk of the changes are mostly contained to the generated code.
2024-07-04Add comments to windows_targets.rsChris Denton-0/+9
2024-07-04Update windows-bindgen to 0.58.0Chris Denton-851/+153
2024-07-04Rollup merge of #127195 - biabbas:vxworks_cleanup, r=jhprattJacob Pratt-2/+4
Remove unqualified form import of io::Error in process_vxworks.rs and fallback on remove_dir_impl for vxworks Hi all, This is to address issue #127084. On inspections it was found that io::Error refrences were all of qualified form and there was no need to add a unqualified form import. Also to successfully build rust for vxworks, we need to fallback on the remove_impl_dir implementations. Thank you.
2024-07-04Rollup merge of #126792 - wooden-worm:master, r=Mark-SimulacrumJacob Pratt-10/+15
wasm64 build with target-feature=+simd128,+atomics Fixes https://github.com/rust-lang/rust/issues/126778
2024-07-03Remove Miri special-caseZachary S-9/+1
2024-07-03Use pthread_t instead of numeric thread idZachary S-45/+12
2024-07-03Use libc::pause instead of std::thread::park in wait-for-exit loopZachary S-7/+10
2024-07-03Fall back on remove dir implementation for vxworksB I Mohammed Abbas-1/+3
2024-07-02chore: remove duplicate wordshattizai-2/+2
2024-07-01Remove unqualified import io:: Error for vxworks as all Error references are ↵B I Mohammed Abbas-1/+1
qualified in process_vxworks.rs
2024-06-29Rollup merge of #126953 - joboet:lazy_key, r=jhprattMatthias Krüger-128/+115
std: separate TLS key creation from TLS access Currently, `std` performs an atomic load to get the OS key on every access to `StaticKey` even when the key is already known. This PR thus replaces `StaticKey` with the platform-specific `get` and `set` function and a new `LazyKey` type that acts as a `LazyLock<Key>`, allowing the reuse of the retreived key for multiple accesses. Related to #110897.
2024-06-28std: add safety commentsjoboet-4/+16
2024-06-25std: separate TLS key creation from TLS accessjoboet-125/+100
Currently, `std` performs an atomic load to get the OS key on every access to `StaticKey` even when the key is already known. This PR thus replaces `StaticKey` with the platform-specific `get` and `set` function and a new `LazyKey` type that acts as a `LazyLock<Key>`, allowing the reuse of the retreived key for multiple accesses.
2024-06-25`PathBuf::as_mut_vec` removed and verified for UEFI and Windows platforms ↵ash-8/+23
#126333
2024-06-25inner truncate methods for UEFI platformsash-0/+5
2024-06-25Check that we get somewhat sane PIDs when spawning with pidfdsThe 8472-0/+3
2024-06-25more fine-grained feature-detection for pidfd spawningThe 8472-21/+33
we now distinguish between pidfd_spawn support, pidfd-via-fork/exec and not-supported
2024-06-25document safety properties of the internal Process::new constructorThe 8472-0/+6
2024-06-25use pidfd_spawn for faster process creation when pidfds are requestedThe 8472-6/+106
2024-06-25document the cvt methodsThe 8472-0/+4
2024-06-24Rollup merge of #125082 - kpreid:const-uninit, r=dtolnayMichael Goulet-1/+1
Remove `MaybeUninit::uninit_array()` and replace it with inline const blocks. \[This PR originally contained the changes in #125995 too. See edit history for the original PR description.] The documentation of `MaybeUninit::uninit_array()` says: > Note: in a future Rust version this method may become unnecessary when Rust allows [inline const expressions](https://github.com/rust-lang/rust/issues/76001). The example below could then use `let mut buf = [const { MaybeUninit::<u8>::uninit() }; 32];`. The PR adding it also said: <https://github.com/rust-lang/rust/pull/65580#issuecomment-544200681> > if it’s stabilized soon enough maybe it’s not worth having a standard library method that will be replaceable with `let buffer = [MaybeUninit::<T>::uninit(); $N];` That time has come to pass — inline const expressions are stable — so `MaybeUninit::uninit_array()` is now unnecessary. The only remaining question is whether it is an important enough *convenience* to keep it around. I believe it is net good to remove this function, on the principle that it is better to compose two orthogonal features (`MaybeUninit` and array construction) than to have a specific function for the specific combination, now that that is possible.