about summary refs log tree commit diff
path: root/library/std/src/sys
AgeCommit message (Collapse)AuthorLines
2024-10-10Prefer `target_vendor = "apple"` on confstrMads Marquart-3/+3
2024-10-10use `confstr(_CS_DARWIN_USER_TEMP_DIR, ...)` as a `TMPDIR` fallback on darwinThom Chiovoloni-4/+97
2024-10-09Decouple WASIp2 sockets from WasiFdNicola Krumschmidt-18/+56
2024-10-08Update library/std/src/sys/pal/unix/process/process_vxworks.rsYuri Astrakhan-1/+1
Co-authored-by: Josh Stone <cuviper@gmail.com>
2024-10-08fix ref in process_vxworks.rsYuri Astrakhan-1/+1
2024-10-08Update library/std/src/sys/pal/unix/process/process_unix.rsYuri Astrakhan-1/+1
Co-authored-by: Josh Stone <cuviper@gmail.com>
2024-10-08Change a few `&Option<T>` into `Option<&T>`Yuri Astrakhan-10/+10
2024-10-06Rollup merge of #131307 - YohDeadfall:prctl-set-name-dbg-assert, ↵Matthias Krüger-1/+3
r=workingjubilee Android: Debug assertion after setting thread name While `prctl` cannot fail if it points to a valid buffer, it's still better to assert the result as it's done for other places.
2024-10-05Stabilize `std::io::ErrorKind::QuotaExceeded`Pavel Grigorenko-4/+4
Also drop "Filesystem" from its name
2024-10-05Android: Debug assertion after setting thread nameYoh Deadfall-1/+3
2024-10-05Rollup merge of #131094 - joboet:lazy_once_box, r=ibraheemdevMatthias Krüger-195/+185
std: replace `LazyBox` with `OnceBox` This PR replaces the `LazyBox` wrapper used to allocate the pthread primitives with `OnceBox`, which has a more familiar API mirroring that of `OnceLock`. This cleans up the code in preparation for larger changes like #128184 (from which this PR was split) and allows some neat optimizations, like avoid an acquire-load of the allocation pointer in `Mutex::unlock`, where the initialization of the allocation must have already been observed. Additionally, I've gotten rid of the TEEOS `Condvar` code, it's just a duplicate of the pthread one anyway and I didn't want to repeat myself.
2024-10-03std::fs::get_path freebsd update.David Carlier-2/+2
what matters is we re doing the right things as doing sizeof, rather than KINFO_FILE_SIZE (only defined on intel architectures), the kernel making sure it matches the expectation in its side.
2024-10-02std: make `thread::current` available in all `thread_local!` destructorsjoboet-29/+185
2024-10-01std: replace `LazyBox` with `OnceBox`joboet-195/+185
This PR replaces the `LazyBox` wrapper used to allocate the pthread primitives with `OnceBox`, which has a more familiar API mirroring that of `OnceLock`. This cleans up the code in preparation for larger changes like #128184 (from which this PR was split) and allows some neat optimizations, like avoid an acquire-load of the allocation pointer in `Mutex::unlock`, where the initialization of the allocation must have already been observed. Additionally, I've gotten rid of the TEEOS `Condvar` code, it's just a duplicate of the pthread one anyway and I didn't want to repeat myself.
2024-09-30Win: Use `FILE_RENAME_FLAG_POSIX_SEMANTICS` for `std::fs::rename` if availableGeorge Tokmaji-1/+163
Windows 10 1601 introduced `FileRenameInfoEx` as well as `FILE_RENAME_FLAG_POSIX_SEMANTICS`, allowing for atomic renaming. If it isn't supported, we fall back to `FileRenameInfo`. This commit also replicates `MoveFileExW`'s behavior of checking whether the source file is a mount point and moving the mount point instead of resolving the target path.
2024-09-29Hook up std::net to wasi-libc on wasm32-wasip2 targetNicola Krumschmidt-1/+379
2024-09-26Rollup merge of #130846 - ChrisDenton:revert-break, r=NoratriebJubilee-153/+0
Revert Break into the debugger on panic (129019) This was talked about a bit at a recent libs meeting. While I think experimenting with this is worthwhile, I am nervous about this new behaviour reaching stable. We've already reverted on one tier 1 platform (Linux, https://github.com/rust-lang/rust/pull/130810) which means we have differing semantics on different tier 1 platforms. Also the fact it triggers even when `catch_unwind` is used to catch the panic means it can be very noisy in some projects. At the very least I think it could use some more discussion before being instantly stable. I think this could maybe be re-landed with an environment variable to control/override the behaviour. But that part would likely need a libs-api decision. cc ````@workingjubilee```` ````@kromych````
2024-09-25Use `&raw` in the standard libraryJosh Stone-66/+56
Since the stabilization in #127679 has reached stage0, 1.82-beta, we can start using `&raw` freely, and even the soft-deprecated `ptr::addr_of!` and `ptr::addr_of_mut!` can stop allowing the unstable feature. I intentionally did not change any documentation or tests, but the rest of those macro uses are all now using `&raw const` or `&raw mut` in the standard library.
2024-09-25Revert Break into the debugger on panic (129019)Chris Denton-153/+0
2024-09-25Auto merge of #130816 - matthiaskrgr:rollup-jy25phv, r=matthiaskrgrbors-99/+90
Rollup of 6 pull requests Successful merges: - #130549 (Add RISC-V vxworks targets) - #130595 (Initial std library support for NuttX) - #130734 (Fix: ices on virtual-function-elimination about principal trait) - #130787 (Ban combination of GCE and new solver) - #130809 (Update llvm triple for OpenHarmony targets) - #130810 (Don't trap into the debugger on panics under Linux) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-25Rollup merge of #130810 - kromych:master, r=workingjubileeMatthias Krüger-78/+1
Don't trap into the debugger on panics under Linux This breaks `rr`, see https://github.com/rust-lang/rust/pull/129019#issuecomment-2369361278 for the discussion CC `@khuey` `@workingjubilee`
2024-09-25Rollup merge of #130595 - no1wudi:master, r=ibraheemdevMatthias Krüger-21/+88
Initial std library support for NuttX This PR add the initial libstd support for NuttX platform (Tier 3), currently it depends on https://github.com/rust-lang/libc/pull/3909 which provide the essential libc definitions.
2024-09-25Rollup merge of #130549 - biabbas:riscv32_wrs_vxworks, r=nnethercoteMatthias Krüger-0/+1
Add RISC-V vxworks targets Risc-V 32 and RISC-V 64 targets are to be added in the target list.
2024-09-25Auto merge of #130803 - cuviper:file-buffered, r=joshtriplettbors-2/+2
Add `File` constructors that return files wrapped with a buffer In addition to the light convenience, these are intended to raise visibility that buffering is something you should consider when opening a file, since unbuffered I/O is a common performance footgun to Rust newcomers. ACP: https://github.com/rust-lang/libs-team/issues/446 Tracking Issue: #130804
2024-09-24Don't trap into the debugger on panics under Linuxkromych-78/+1
This breaks `rr`, see https://github.com/rust-lang/rust/pull/129019#issuecomment-2369361278 for the discussion CC @khuey @workingjubilee
2024-09-24Dogfood `feature(file_buffered)`Josh Stone-2/+2
2024-09-24add InProgress ErrorKind gated behind io_error_inprogress featureAviram Hassan-0/+1
Co-authored-by: David Tolnay <dtolnay@gmail.com> Co-authored-by: nora <48135649+Noratrieb@users.noreply.github.com>
2024-09-24Initial std library support for NuttXHuang Qi-21/+88
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-23std: switch to faster random sources on macOS and most BSDsjoboet-86/+75
2024-09-23std: implement the `random` featurejoboet-462/+615
Implements the ACP https://github.com/rust-lang/libs-team/issues/393.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-122/+119
2024-09-20Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errorsbors-0/+3
Disallow hidden references to mutable static Closes #123060 Tracking: - https://github.com/rust-lang/rust/issues/123758
2024-09-20Allow unused unsafe for vxworks in alligned_malloc to resolve build errorsB I Mohammed Abbas-0/+1
2024-09-19`pal::unsupported::process::ExitCode`: use an `u8` instead of a `bool`Lieselotte-7/+4
2024-09-18Rollup merge of #130476 - workingjubilee:more-lazy-methods-take-2, r=AmanieuJubilee-0/+27
Implement ACP 429: add `Lazy{Cell,Lock}::get[_mut]` and `force_mut` Tracking issue for `lazy_get`: https://github.com/rust-lang/rust/issues/129333
2024-09-18Rollup merge of #129934 - ChrisDenton:remove-dir-all3, r=AmanieuJubilee-3/+12
Win: Open dir for sync access in remove_dir_all A small follow up to #129800. We should explicitly open directories for synchronous access. We ultimately use `GetFileInformationByHandleEx` to read directories which should paper over any issues caused by using async directory reads (or else return an error) but it's better to do the right thing in the first place. Note though that `delete` does not read or write any data so it's not necessary there.
2024-09-17Implement ACP 429: add `Lazy{Cell,Lock}::get[_mut]` and `force_mut`Chayim Refael Friedman-0/+27
In the implementation of `force_mut`, I chose performance over safety. For `LazyLock` this isn't really a choice; the code has to be unsafe. But for `LazyCell`, we can have a full-safe implementation, but it will be a bit less performant, so I went with the unsafe approach.
2024-09-14std::net: Solaris supports `SOCK_CLOEXEC` as well since 11.4.David Carlier-0/+1
2024-09-13Update tests for hidden references to mutable staticObei Sideg-0/+3
2024-09-12Rollup merge of #130101 - RalfJung:const-cleanup, r=fee1-deadMatthias Krüger-1/+1
some const cleanup: remove unnecessary attributes, add const-hack indications I learned that we use `FIXME(const-hack)` on top of the "const-hack" label. That seems much better since it marks the right place in the code and moves around with the code. So I went through the PRs with that label and added appropriate FIXMEs in the code. IMO this means we can then remove the label -- Cc ``@rust-lang/wg-const-eval.`` I also noticed some const stability attributes that don't do anything useful, and removed them. r? ``@fee1-dead``
2024-09-11Rollup merge of #130248 - nyurik:fix-129895, r=workingjubileeJubilee-1/+1
Limit `libc::link` usage to `nto70` target only, not NTO OS It seems QNX 7.0 does not support `linkat` at all (most tests were failing). Limiting to QNX 7.0 only, while using `linkat` for the future versions seems like the right path forward (tested on 7.0). Fixes #129895 CC: `@japaric` `@flba-eb` `@saethlin`
2024-09-11Rollup merge of #130077 - madsmtm:watchos-arm-unwind, r=workingjubileeJubilee-9/+10
Fix linking error when compiling for 32-bit watchOS In https://github.com/rust-lang/rust/pull/124494 (or https://github.com/rust-lang/rust/pull/124748), I mistakenly conflated "not SjLj" to mean "ARM EHABI", which isn't true, 32-bit watchOS uses a third unwinding method called "DWARF CFI". So this PR is effectively a revert of https://github.com/rust-lang/rust/pull/124494, with a few more comments explaining what's going on. Fixes https://github.com/rust-lang/rust/issues/130071. r? Mark-Simulacrum (since you reviewed the original)
2024-09-11Limit `libc::link` usage to `nto70` target only, not NTO OSYuri Astrakhan-1/+1
It seems QNX 7.0 does not support `linkat` at all (most tests were failing). Limiting to QNX 7.0 only, while using `linkat` for the future versions seems like the right path forward (tested on 7.0). Fixes 129895
2024-09-11Rollup merge of #130207 - GrigorenkoPV:ERROR_CANT_RESOLVE_FILENAME, ↵Matthias Krüger-0/+1
r=ChrisDenton Map `ERROR_CANT_RESOLVE_FILENAME` to `ErrorKind::FilesystemLoop` cc #86442 As summarized in #130188, there seems to be a consensus that this should be done.
2024-09-11Map `ERROR_CANT_RESOLVE_FILENAME` to `ErrorKind::FilesystemLoop`Pavel Grigorenko-0/+1
2024-09-11Map `WSAEDQUOT` to `ErrorKind::FilesystemQuotaExceeded`Pavel Grigorenko-0/+1
2024-09-09Rollup merge of #130132 - sunshowers:illumos-sigsegv, r=NoratriebJubilee-4/+11
[illumos] enable SIGSEGV handler to detect stack overflows Use the same code as Solaris. I couldn't find any tests regarding this, but I did test a stage0 build against my stack-exhaust-test binary [1]. Before: ``` running with use_stacker = No, new_thread = false, make_large_local = false zsh: segmentation fault (core dumped) cargo run ``` After: ``` running with use_stacker = No, new_thread = false, make_large_local = false thread 'main' has overflowed its stack fatal runtime error: stack overflow zsh: IOT instruction (core dumped) cargo +stage0 run ``` Fixes #128568. [1] https://github.com/sunshowers/stack-exhaust-test/
2024-09-09[illumos] enable SIGSEGV handler to detect stack overflowsRain-4/+11
Use the same code as Solaris. I couldn't find any tests regarding this, but I did test a stage0 build against my stack-exhaust-test binary [1]. Before: ``` running with use_stacker = No, new_thread = false, make_large_local = false zsh: segmentation fault (core dumped) cargo run ``` After: ``` running with use_stacker = No, new_thread = false, make_large_local = false thread 'main' has overflowed its stack fatal runtime error: stack overflow zsh: IOT instruction (core dumped) cargo +stage0 run ``` Fixes #128568. [1] https://github.com/sunshowers/stack-exhaust-test/
2024-09-08add FIXME(const-hack)Ralf Jung-1/+1
2024-09-08Remove needless returns detected by clippy in librariesEduardo Sánchez Muñoz-8/+9