about summary refs log tree commit diff
path: root/library/std/src/sys/pal/solid
AgeCommit message (Collapse)AuthorLines
2025-09-12Revert "Constify SystemTime methods"Ralf Jung-6/+3
This reverts commit 7ce620dd7c6fc3371290b40a1ea28146f0d37031. The const-hacks introduces bugs, and they make the code harder to maintain. Let's wait until we can constify these functions without changing their implementation.
2025-09-10std: move `thread` into `sys`joboet-3/+1
2025-08-26remove deprecated Error::description in implsMarijn Schouten-7/+1
2025-08-12Constify SystemTime methodsltdk-3/+6
2025-04-21Move `sys::pal::os::Env` into `sys::env`Thalia Archibald-140/+2
Although `Env` (as `Vars`), `Args`, path functions, and OS constants are publicly exposed via `std::env`, their implementations are each self-contained. Keep them separate in `std::sys` and make a new module, `sys::env`, for `Env`.
2025-04-18Combine env consts into std::sys::env_constsThalia Archibald-10/+0
2025-04-12Move args into std::sysThalia Archibald-2/+0
2025-03-22std: move process implementations to `sys`joboet-2/+0
As per #117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
2025-03-09std: move stdio to `sys`joboet-81/+0
As per #117276, this moves the platform definitions of `Stdout` and friends into `sys`. This PR also unifies the UNIX and Hermit implementations and moves the `__rust_print_err` function needed by libunwind on SGX into the dedicated module for such helper functions.
2025-03-08Move fs into sysThalia Archibald-611/+1
2025-02-17Rollup merge of #137165 - thaliaarchi:file-tell, r=ChrisDentonMatthias Krüger-1/+4
Use `tell` for `<File as Seek>::stream_position` Some platforms have a more efficient way to get the current offset of the file than by seeking. For example, Wasi has `fd_tell` and SOLID has `SOLID_FS_Ftell`. Implement `<File as Seek>::stream_position()` in terms of those. I do not use any APIs that were not already used in `std`. Although, the `libc` crate has [`ftell`](https://docs.rs/libc/latest/libc/fn.ftell.html), [`ftello`](https://docs.rs/libc/latest/libc/fn.ftello.html), and [`ftello64`](https://docs.rs/libc/latest/libc/fn.ftello64.html), I do not know platform coverage. It appears that Windows has no `tell`-like API. I have checked that it builds on each relevant platform.
2025-02-17Use tell for <File as Seek>::stream_positionThalia Archibald-1/+4
2025-02-17Rollup merge of #136844 - thaliaarchi:const-io-error, r=ChrisDentonMatthias Krüger-1/+1
Use `const_error!` when possible Replace usages of `io::Error::new(io::ErrorKind::Variant, "constant string")` with `io::const_error!(io::ErrorKind::Variant, "constant string")` to avoid allocations when possible. Additionally, fix `&&str` error messages in SGX and missing/misplaced trailing commas in `const_error!`.
2025-02-14Add safe new to NotAllOnesKornel-5/+2
2025-02-10Fix &&str and trailing commas in io::const_error!Thalia Archibald-1/+1
2025-02-09Mark extern blocks as unsafeMichael Goulet-8/+8
2025-02-07std: move `io` module out of `pal`joboet-87/+0
2025-02-02std: move network code into `sys`joboet-428/+3
As per #117276, this PR moves `sys_common::net` and the `sys::pal::net` into the newly created `sys::net` module. In order to support #135141, I've moved all the current network code into a separate `connection` module, future functions like `hostname` can live in separate modules. I'll probably do a follow-up PR and clean up some of the actual code, this is mostly just a reorganization.
2025-01-09Update a bunch of library types for MCP807Scott McMurray-8/+6
This greatly reduces the number of places that actually use the `rustc_layout_scalar_valid_range_*` attributes down to just 3: ``` library/core\src\ptr\non_null.rs 68:#[rustc_layout_scalar_valid_range_start(1)] library/core\src\num\niche_types.rs 19: #[rustc_layout_scalar_valid_range_start($low)] 20: #[rustc_layout_scalar_valid_range_end($high)] ``` Everything else -- PAL Nanoseconds, alloc's `Cap`, niched FDs, etc -- all just wrap those `niche_types` types.
2024-11-26std: update internal uses of `io::const_error!`joboet-10/+7
2024-11-14Rollup merge of #132790 - aDotInTheVoid:ioslice-asslice-rides-again, r=cuviperJubilee-1/+6
Add as_slice/into_slice for IoSlice/IoSliceMut. ACP: https://github.com/rust-lang/libs-team/issues/93 Tracking issue: #132818 Based on a623c5233ae7f6b540e5c00f2be02f40b33b0793 (CC `@mpdn)` and #111277 (CC `@Lucretiel).` Closes: #124659 Tracking Issue: TODO try-job: test-various try-job: dist-various-1 try-job: dist-various-2 r? libs
2024-11-09Add as_slice/into_slice for IoSlice/IoSliceMut.Alona Enraght-Moony-1/+6
Co-authored-by: Mike Pedersen <mike@mikepedersen.dk> Co-authored-by: Nathan West <Lucretiel@gmail.com>
2024-10-13Implement file_lock featureChristopher Berner-0/+20
This adds lock(), lock_shared(), try_lock(), try_lock_shared(), and unlock() to File gated behind the file_lock feature flag
2024-09-23std: implement the `random` featurejoboet-10/+0
Implements the ACP https://github.com/rust-lang/libs-team/issues/393.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-5/+5
2024-09-02Fix compile error in solid's remove_dir_allBen Kimock-1/+1
2024-08-27std: move allocators to `sys`joboet-31/+0
2024-08-22fix: fs::remove_dir_all: treat ENOENT as successbinarycat-7/+16
fixes #127576 windows implementation still needs some work
2024-07-29Reformat `use` declarations.Nicholas Nethercote-56/+41
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-19kmc-solid: forbid(unsafe_op_in_unsafe_fn)Jubilee Young-1/+1
2024-06-24Auto merge of #126523 - joboet:the_great_big_tls_refactor, r=Mark-Simulacrumbors-66/+0
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
2024-06-22Rollup merge of #126140 - eduardosm:stabilize-fs_try_exists, r=AmanieuMatthias Krüger-1/+1
Rename `std::fs::try_exists` to `std::fs::exists` and stabilize fs_try_exists FCP completed in tracking issue. Tracking issue: https://github.com/rust-lang/rust/issues/83186 Closes https://github.com/rust-lang/rust/issues/83186 Stabilized API: ```rust mod fs { pub fn exists<P: AsRef<Path>>(path: P) -> io::Result<bool>; } ```
2024-06-20Add blank lines after module-level `//!` comments.Nicholas Nethercote-0/+1
Most modules have such a blank line, but some don't. Inserting the blank line makes it clearer that the `//!` comments are describing the entire module, rather than the `use` declaration(s) that immediately follows.
2024-06-15std: refactor the TLS implementationjoboet-66/+0
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
2024-06-11Rename `std::fs::try_exists` to `std::fs::exists` and stabilize fs_try_existsEduardo Sánchez Muñoz-1/+1
2024-05-29Make `std::env::{set_var, remove_var}` unsafe in edition 2024Tobias Bucher-2/+2
Allow calling these functions without `unsafe` blocks in editions up until 2021, but don't trigger the `unused_unsafe` lint for `unsafe` blocks containing these functions. Fixes #27970. Fixes #90308. CC #124866.
2024-04-11Factor some common `io::Error` constantsBenoît du Garreau-12/+3
2024-02-20Delete architecture-specific memchr code in std::sysArthur Carcano-23/+3
Currently all architecture-specific memchr code is only used in `std::io`. Most of the actual `memchr` capacity exposed to the user through the slice API is instead implemented in core::slice::memchr. Hence this commit deletes memchr from std::sys[_common] and replace calls to it by calls to core::slice::memchr functions. This deletes (r)memchr from the list of symbols linked to libc.
2024-02-19Auto merge of #121177 - joboet:move_pal_locks, r=ChrisDentonbors-114/+10
Move locks to `sys` Part of #117276. r? `@ChrisDenton`
2024-02-18Dyn erase at call siteDavid Thomas-4/+4
2024-02-17Auto merge of #120741 - a1phyr:safe_buffer_advance, r=m-ou-sebors-2/+2
Make `io::BorrowedCursor::advance` safe This also keeps the old `advance` method under `advance_unchecked` name. This makes pattern like `std::io::default_read_buf` safe to write.
2024-02-16std: move locks to `sys` on µITRONjoboet-114/+10
2024-02-08std: move path into `sys`joboet-26/+0
2024-02-07Make `io::BorrowedCursor::advance` safeBenoît du Garreau-2/+2
This also keeps the old `advance` method under `advance_unchecked` name. This makes pattern like `std::io::default_read_buf` safe to write.
2024-01-22std: move cmath into `sys`joboet-2/+0
2024-01-15std: move OS String implementation into `sys`joboet-2/+0
2024-01-12update paths in commentsjoboet-1/+1
2024-01-11std: begin moving platform support modules into `pal`joboet-0/+2259