about summary refs log tree commit diff
path: root/library/std/src/sys/pal
AgeCommit message (Collapse)AuthorLines
2024-07-15Move safety comment outside unsafe blockChris Denton-1/+1
2024-07-15Make pal/windows default to deny unsafe in unsafeChris Denton-11/+26
2024-07-15Fix Windows 7Chris Denton-4/+4
2024-07-15Don't re-export `c_int` from `c`Chris Denton-8/+7
2024-07-15Remove DWORDChris Denton-88/+77
2024-07-15Remove ULONGChris Denton-14/+13
2024-07-15Remove PSRWLOCKChris Denton-3/+0
2024-07-15Remove LPVOIDChris Denton-12/+10
2024-07-15Remove LPSECURITY_ATTRIBUTESChris Denton-3/+2
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: 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 #126606 - zachs18:patch-2, r=joboetbors-0/+1
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-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-08Reset sigpipe not supported for vxworksB I Mohammed Abbas-0/+1
2024-07-05Move exit guard from sys::common::exit_guard to sys::exit_guard.Zachary S-63/+1
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-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.
2024-06-24Replace `MaybeUninit::uninit_array()` with array repeat expression.Kevin Reid-1/+1
This is possible now that inline const blocks are stable; the idea was even mentioned as an alternative when `uninit_array()` was added: <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];` Const array repetition and inline const blocks are now stable (in the next release), so that circumstance has come to pass, and we no longer have reason to want `uninit_array()` other than convenience. Therefore, let’s evaluate the inconvenience by not using `uninit_array()` in the standard library, before potentially deleting it entirely.
2024-06-24Auto merge of #126523 - joboet:the_great_big_tls_refactor, r=Mark-Simulacrumbors-998/+5
std: refactor the TLS implementation As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. `@rustbot` label +A-thread-locals