about summary refs log tree commit diff
path: root/library/std/src/sys/pal
AgeCommit message (Collapse)AuthorLines
2024-04-01std::thread: adding get_name implementation for solaris/illumos.David Carlier-3/+11
THREAD_NAME_MAX is 32 (31 max + 1 for the null terminator).
2024-03-31std::thread: adding get_name haiku implementation.David Carlier-1/+19
follow-up #123233
2024-03-31std: move `thread::current` TLS variable out of `thread_info`joboet-104/+0
2024-03-31std: move UNIX stack overflow guard page handling into `stack_overflow.rs`joboet-310/+287
2024-03-30std::thread: adding freebsd/netbsd to the linux's get_name implementation.David Carlier-1/+8
2024-03-27Rollup merge of #123038 - he32:netbsd-ilp32-fix, r=workingjubileeMatthias Krüger-1/+1
std library thread.rs: fix NetBSD code for ILP32 CPUs.
2024-03-27Rollup merge of #122880 - a1phyr:preadv_more_platform, r=workingjubileeMatthias Krüger-6/+22
Unix: Support more platforms with `preadv` and `pwritev` - `aix`, `dragonfly` and `openbsd` with direct call - `watchos` with weak linkage cc #89517
2024-03-26unix fs: Make hurd and horizon using explicit new rather than FromSamuel Thibault-2/+2
408c0ea2162b ("unix time module now return result") dropped the From impl for SystemTime, breaking the hurd and horizon builds. Fixes #123032
2024-03-26Unix: Support more platforms with `preadv` and `pwritev`Benoît du Garreau-6/+22
2024-03-26std library unix/thread.rs: fix NetBSD code for ILP32 CPUs.Havard Eidnes-1/+1
2024-03-24Rollup merge of #122992 - devnexen:available_parallelism_sol_upd, r=AmanieuMatthias Krüger-2/+6
std::thread: refine available_parallelism for solaris/illumos. Rather than the system-wide available cpus fallback solution, we fetch the cpus bound to the current process.
2024-03-24Rollup merge of #122983 - taiki-e:bsd, r=workingjubileeMatthias Krüger-1/+1
Fix build failure on ARM/AArch64/PowerPC/RISC-V FreeBSD/NetBSD Fixes https://github.com/rust-lang/rust/pull/121881#discussion_r1536764650 Checked targets: aarch64-unknown-freebsd, powerpc64-unknown-freebsd, armv7-unknown-freebsd, riscv64gc-unknown-freebsd, aarch64-unknown-netbsd. r? ``@Amanieu`` cc ``@devnexen``
2024-03-24fix build.David Carlier-5/+3
2024-03-24std::thread: refine available_parallelism for solaris/illumos.David Carlier-0/+6
Rather than the system-wide available cpus fallback solution, we fetch the cpus bound to the current process.
2024-03-24Fix build failure on ARM/AArch64/PowerPC/RISC-V FreeBSD/NetBSDTaiki Endo-1/+1
2024-03-23Rollup merge of #120419 - Ayush1325:uefi-sys-os, r=nicholasbishop,workingjubileeJubilee-10/+81
Expand sys/os for UEFI - Implement current_exe() and getcwd()
2024-03-23rename ptr::from_exposed_addr -> ptr::with_exposed_provenanceRalf Jung-5/+5
2024-03-23Auto merge of #119552 - krtab:dead_code_priv_mod_pub_field, r=cjgillot,saethlinbors-1/+7
Replace visibility test with reachability test in dead code detection Fixes https://github.com/rust-lang/rust/issues/119545 Also included is a fix for an error now flagged by the lint
2024-03-22Rollup merge of #121881 - devnexen:bsd_acceptfilter, r=AmanieuMatthias Krüger-0/+31
std::net: adding acceptfilter feature for netbsd/freebsd. similar to linux's ext deferaccept, to filter incoming connections before accept.
2024-03-20std::net: adding acceptfilter feature for netbsd/freebsd.David Carlier-0/+31
similar to linux's ext deferaccept, to filter incoming connections before accept.
2024-03-20Use less restricted memory ordering in xous::thread_local_key.Mara Bos-5/+5
SeqCst isn't necessary in any of these cases.
2024-03-19SeqCst->Relaxed for xous set_nonblocking.Mara Bos-1/+1
The SeqCst wasn't synchronizing with anything. Relaxed is enough.
2024-03-19SeqCst->{Release,Acquire} for xous DropLock.Mara Bos-3/+6
SeqCst is unnecessary. Release+Acquire is the right ordering for a mutex.
2024-03-19SeqCst->Relaxed in pal::windows::pipe.Mara Bos-4/+4
Relaxed is enough to ensure fetch_add(1) returns each integer exactly once.
2024-03-19SeqCst->{Release,Acquire} for wasm DropLock.Mara Bos-3/+6
SeqCst is unnecessary. Release+Acquire is the right ordering for a mutex.
2024-03-19Use less restricted memory ordering in thread_parking::pthread.Mara Bos-10/+12
SeqCst is unnecessary here.
2024-03-18Support for visionOSAdam Gastineau-12/+98
2024-03-17Expand sys/os for UEFIAyush Singh-10/+81
- Implement current_exe() - Cache device_path_to_text protocol Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2024-03-16Rollup merge of #122390 - ChrisDenton:bindgen, r=Mark-SimulacrumChris Denton-213/+211
Bump windows-bindgen to 0.55.0 windows-bindgen is the crate used to generate std's Windows API bindings. Not many changes for us, it's mostly just simplifying the generate code (e.g. no more `-> ()`). The one substantial change is some structs now use `i8` byte arrays instead of `u8`. However, this only impacts one test.
2024-03-14Rollup merge of #121650 - GrigorenkoPV:cap_setgid, r=AmanieuMatthias Krüger-3/+11
change std::process to drop supplementary groups based on CAP_SETGID A trivial rebase of #95982 Should fix #39186 (from what I can tell) Original description: > Fixes #88716 > > * Before this change, when a process was given a uid via `std::os::unix::process::CommandExt.uid`, there would be a `setgroups` call (when the process runs) to clear supplementary groups for the child **if the parent was root** (to remove potentially unwanted permissions). > * After this change, supplementary groups are cleared if we have permission to do so, that is, if we have the CAP_SETGID capability. > > This new behavior was agreed upon in #88716 but there was a bit of uncertainty from `@Amanieu` here: [#88716 (comment)](https://github.com/rust-lang/rust/issues/88716#issuecomment-973366600) > > > I agree with this change, but is it really necessary to ignore an EPERM from setgroups? If you have permissions to change UID then you should also have permissions to change groups. I would feel more comfortable if we documented set_uid as requiring both UID and GID changing permissions. > > The way I've currently written it, we ignore an EPERM as that's what #88716 originally suggested. I'm not at all an expert in any of this so I'd appreciate feedback on whether that was the right way to go.
2024-03-14Auto merge of #114038 - Stargateur:108277, r=ChrisDentonbors-51/+35
unix time module now return result First try to fix #108277 without break anything. if anyone who read this know tips to be able to check compilation for different target I could use some help. So far I installed many target with rustup but `./x check --all-targets` doesn't seem to use them. TODO: - [x] better error - [ ] test, how ? `@rustbot` label -S-waiting-on-author +S-waiting-on-review
2024-03-13Provide `cabi_realloc` on `wasm32-wasip2` by defaultAlex Crichton-0/+67
This commit provides a component model intrinsic in the standard library by default on the `wasm32-wasip2` target. This intrinsic is not required by the component model itself but is quite common to use, for example it's needed if a wasm module receives a string or a list. The intention of this commit is to provide an overridable definition in the standard library through a weak definition of this function. That means that downstream crates can provide their own customized and more specific versions if they'd like, but the standard library's version should suffice for general-purpose use.
2024-03-13Get wasm32-wasip2 compiling with its custom pal implementationAlex Crichton-9/+3
The ordering of targets in `pal/mod.rs` did not end up using the wasip2 implementation, so after reordering that I've edited the implementation to compile correctly.
2024-03-12Bump windows-bindgen to 0.55.0Chris Denton-183/+181
2024-03-12Bump windows-bindgen to 0.54.0Chris Denton-31/+31
2024-03-12std: move `Once` implementations to `sys`joboet-115/+0
2024-03-12Allow dead code in sys/palArthur Carcano-0/+6
The dead_code lint was previously eroneously missing this dead code. Since this lint bug has been fixed, the unused field need to be removed or marked as `#[allow(dead_code)]`. These structures API is common to all platforms so the code cannot be removed and is hence marked allow(dead_code).
2024-03-12Allow dead code in thread local dtorArthur Carcano-1/+1
The dead_code lint was previously eroneously missing this dead code. Since this lint bug has been fixed, the unused field need to be removed or marked as `#[allow(dead_code)]`. Given the nature of this code, I don't feel confident removing the field so it is only marked as allow(dead_code).
2024-03-12std::rand: fix dragonflybsd after #121942.David Carlier-7/+13
2024-03-11Auto merge of #122331 - jhpratt:rollup-cbl8xsy, r=jhprattbors-21/+45
Rollup of 9 pull requests Successful merges: - #121148 (Add slice::try_range) - #121633 (Win10: Use `GetSystemTimePreciseAsFileTime` directly) - #121840 (Expose the Freeze trait again (unstably) and forbid implementing it manually) - #121907 (skip sanity check for non-host targets in `check` builds) - #122002 (std::threads: revisit stack address calculation on netbsd.) - #122108 (Add `target.*.runner` configuration for targets) - #122298 (RawVec::into_box: avoid unnecessary intermediate reference) - #122315 (Allow multiple `impl Into<{D,Subd}iagMessage>` parameters in a function.) - #122326 (Optimize `process_heap_alloc`) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-11Rollup merge of #122326 - Zoxc:win-alloc-tweak, r=ChrisDentonJacob Pratt-19/+36
Optimize `process_heap_alloc` This optimizes `process_heap_alloc` introduced in https://github.com/rust-lang/rust/pull/120205. From: ``` .text:0000000180027ED0 ; std::sys::pal::windows::alloc::process_heap_alloc::h703a613b3e25ff93 .text:0000000180027ED0 public _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h703a613b3e25ff93E .text:0000000180027ED0 _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h703a613b3e25ff93E proc near .text:0000000180027ED0 ; CODE XREF: std::sys::pal::common::alloc::realloc_fallback::hc4c96b4c24d03e77+23↑p .text:0000000180027ED0 ; std::sys::pal::common::alloc::realloc_fallback::hc4c96b4c24d03e77+55↑p ... .text:0000000180027ED0 push rsi .text:0000000180027ED1 push rdi .text:0000000180027ED2 sub rsp, 28h .text:0000000180027ED6 mov rsi, rdx .text:0000000180027ED9 mov edi, ecx .text:0000000180027EDB mov rcx, cs:_ZN3std3sys3pal7windows5alloc4HEAP17hb53ca4010cc29b62E ; std::sys::pal::windows::alloc::HEAP::hb53ca4010cc29b62 .text:0000000180027EE2 test rcx, rcx .text:0000000180027EE5 jnz short loc_180027EFC .text:0000000180027EE7 call cs:__imp_GetProcessHeap .text:0000000180027EED test rax, rax .text:0000000180027EF0 jz short loc_180027F0E .text:0000000180027EF2 mov rcx, rax .text:0000000180027EF5 mov cs:_ZN3std3sys3pal7windows5alloc4HEAP17hb53ca4010cc29b62E, rax ; std::sys::pal::windows::alloc::HEAP::hb53ca4010cc29b62 .text:0000000180027EFC .text:0000000180027EFC loc_180027EFC: ; CODE XREF: std::sys::pal::windows::alloc::process_heap_alloc::h703a613b3e25ff93+15↑j .text:0000000180027EFC mov edx, edi .text:0000000180027EFE mov r8, rsi .text:0000000180027F01 add rsp, 28h .text:0000000180027F05 pop rdi .text:0000000180027F06 pop rsi .text:0000000180027F07 jmp cs:__imp_HeapAlloc .text:0000000180027F0E ; --------------------------------------------------------------------------- .text:0000000180027F0E .text:0000000180027F0E loc_180027F0E: ; CODE XREF: std::sys::pal::windows::alloc::process_heap_alloc::h703a613b3e25ff93+20↑j .text:0000000180027F0E xor eax, eax .text:0000000180027F10 add rsp, 28h .text:0000000180027F14 pop rdi .text:0000000180027F15 pop rsi .text:0000000180027F16 retn .text:0000000180027F16 _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h703a613b3e25ff93E endp ``` to ``` .text:0000000180027EE0 ; std::sys::pal::windows::alloc::process_heap_alloc::h70f9d61a631e5c16 .text:0000000180027EE0 public _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h70f9d61a631e5c16E .text:0000000180027EE0 _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h70f9d61a631e5c16E proc near .text:0000000180027EE0 ; CODE XREF: std::sys::pal::common::alloc::realloc_fallback::hc4c96b4c24d03e77+23↑p .text:0000000180027EE0 ; std::sys::pal::common::alloc::realloc_fallback::hc4c96b4c24d03e77+54↑p ... .text:0000000180027EE0 mov rcx, cs:_ZN3std3sys3pal7windows5alloc4HEAP17hb53ca4010cc29b62E ; std::sys::pal::windows::alloc::HEAP::hb53ca4010cc29b62 .text:0000000180027EE7 test rcx, rcx .text:0000000180027EEA jz short loc_180027EF3 .text:0000000180027EEC jmp cs:__imp_HeapAlloc .text:0000000180027EF3 ; --------------------------------------------------------------------------- .text:0000000180027EF3 .text:0000000180027EF3 loc_180027EF3: ; CODE XREF: std::sys::pal::windows::alloc::process_heap_alloc::h70f9d61a631e5c16+A↑j .text:0000000180027EF3 mov ecx, edx .text:0000000180027EF5 mov rdx, r8 .text:0000000180027EF8 jmp std__sys__pal__windows__alloc__process_heap_init_and_alloc .text:0000000180027EF8 _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h70f9d61a631e5c16E endp ``` r? `@ChrisDenton`
2024-03-11Rollup merge of #122002 - devnexen:thread_stack_netbsd_fix, ↵Jacob Pratt-2/+3
r=workingjubilee,riastradh std::threads: revisit stack address calculation on netbsd. like older linux glibc versions, we need to get the guard size and increasing the stack's bottom address accordingly.
2024-03-11Rollup merge of #121633 - ChrisDenton:precise, r=NilstriebJacob Pratt-0/+6
Win10: Use `GetSystemTimePreciseAsFileTime` directly On Windows 10 we can use `GetSystemTimePreciseAsFileTime` directly instead of lazy loading it (with a fallback).
2024-03-11Auto merge of #117156 - jmillikin:os-unix-socket-ext, r=Amanieu,dtolnaybors-10/+16
Convert `Unix{Datagram,Stream}::{set_}passcred()` to per-OS traits These methods are the pre-stabilized API for obtaining peer credentials from an `AF_UNIX` socket, part of the `unix_socket_ancillary_data` feature. Their current behavior is to get/set one of the `SO_PASSCRED` (Linux), `LOCAL_CREDS_PERSISTENT` (FreeBSD), or `LOCAL_CREDS` (NetBSD) socket options. On other targets the `{set_}passcred()` methods do not exist. There are two problems with this approach: 1. Having public methods only exist for certain targets isn't permitted in a stable `std` API. 2. These options have generally similar purposes, but they are non-POSIX and their details can differ in subtle and surprising ways (such as whether they continue to be set after the next call to `recvmsg()`). Splitting into OS-specific extension traits is the preferred solution to both problems.
2024-03-11Optimize `process_heap_alloc`John Kåre Alsaker-19/+36
2024-03-10Rollup merge of #121942 - devnexen:getrandom_for_dfbsd, r=joboetMatthias Krüger-1/+9
std::rand: enable getrandom for dragonflybsd too.
2024-03-10Rollup merge of #113525 - workingjubilee:handle-dynamic-minsigstksz, r=m-ou-seMatthias Krüger-11/+39
Dynamically size sigaltstk in std On modern Linux with Intel AMX and 1KiB matrices, Arm SVE with potentially 2KiB vectors, and RISCV Vectors with up to 16KiB vectors, we must handle dynamic signal stack sizes. We can do so unconditionally by using getauxval, but assuming it may return 0 as an answer, thus falling back to the old constant if needed. Fixes https://github.com/rust-lang/rust/issues/107795
2024-03-09Rollup merge of #121711 - ChrisDenton:junction, r=Mark-SimulacrumGuillaume Boisseau-74/+69
Implement junction_point Implements https://github.com/rust-lang/rust/issues/121709 We already had a private implementation that we use for tests so we could just make that public. Except it was very hacky as it was only ever intended for use in testing. I've made an improved version that at least handles path conversion correctly and has less need for things like the `Align8` hack. There's still room for further improvement though.
2024-03-08further changes from feedbackDavid Carlier-19/+1
2024-03-07Rust is a proper name: rust → RustRalf Jung-1/+1