about summary refs log tree commit diff
path: root/library/std/src/os
AgeCommit message (Collapse)AuthorLines
2025-01-14wasi/io: remove dead filesRalf Jung-29/+4
2025-01-14remove unnecessary rustc_allowed_through_unstable_modulesRalf Jung-5/+0
2025-01-09Update a bunch of library types for MCP807Scott McMurray-59/+41
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.
2025-01-01Avoid use of LFS64 symbols on EmscriptenKleis Auke Wolthuizen-3/+1
Since Emscripten uses musl libc internally. Non-functional change: all LFS64 symbols were aliased to their non-LFS64 counterparts in rust-lang/libc@7c952dceaad4cdc35e00884fcb12a713d41a87e0.
2024-12-21Rollup merge of #123604 - michaelvanstraten:proc_thread_attribute_list, ↵Matthias Krüger-55/+273
r=ChrisDenton Abstract `ProcThreadAttributeList` into its own struct As extensively discussed in issue #114854, the current implementation of the unstable `windows_process_extensions_raw_attribute` features lacks support for passing a raw pointer. This PR wants to explore the opportunity to abstract away the `ProcThreadAttributeList` into its own struct to for one improve safety and usability and secondly make it possible to maybe also use it to spawn new threads. try-job: x86_64-mingw
2024-12-15Auto merge of #133223 - zachs18:uniquerc-impls, r=Noratriebbors-0/+32
`UniqueRc` trait impls UniqueRc tracking Issue: #112566 Stable traits: (i.e. impls behind only the `unique_rc_arc` feature gate) * Support the same formatting as `Rc`: * `fmt::Debug` and `fmt::Display` delegate to the pointee. * `fmt::Pointer` prints the address of the pointee. * Add explicit `!Send` and `!Sync` impls, to mirror `Rc`. * Borrowing traits: `Borrow`, `BorrowMut`, `AsRef`, `AsMut` * `Rc` does not implement `BorrowMut` and `AsMut`, but `UniqueRc` can. * Unconditional `Unpin`, like other heap-allocated types. * Comparison traits `(Partial)Ord` and `(Partial)Eq` delegate to the pointees. * `PartialEq for UniqueRc` does not do `Rc`'s specialization shortcut for pointer equality when `T: Eq`, since by definition two `UniqueRc`s cannot share an allocation. * `Hash` delegates to the pointee. * `AsRawFd`, `AsFd`, `AsHandle`, `AsSocket` delegate to the pointee like `Rc`. * Sidenote: The bounds on `T` for the existing `Pointer<T>` impls for specifically `AsRawFd` and `AsSocket` do not allow `T: ?Sized`. For the added `UniqueRc` impls I allowed `T: ?Sized` for all four traits, but I did not change the existing (stable) impls. Unstable traits: * `DispatchFromDyn`, allows using `UniqueRc<Self>` as a method receiver under `feature(arbitrary_self_types)`. * Existing `PinCoerceUnsized for UniqueRc` is generalized to allow non-`Global` allocators, like `Rc`. * `DerefPure`, allows using `UniqueRc` in deref-patterns under `feature(deref_patterns)`, like `Rc`. For documentation, `Rc` only has documentation on the comparison traits' methods, so I copied/adapted the documentation for those, and left the rest without impl-specific docs. ~~Edit: Marked as draft while I figure out `UnwindSafe`.~~ Edit: Ignoring `UnwindSafe` for this PR
2024-12-11Forbid unsafe_op_in_unsafe_fn in hurd-specific os and sys filesSamuel Thibault-0/+1
Adding it did not cause any error. Most of this falls back on Unix already. See #127747
2024-12-01Rollup merge of #133515 - SteveLauC:fix/hurd, r=ChrisDentonMatthias Krüger-1/+1
fix: hurd build, stat64.st_fsid was renamed to st_dev On hurd, `stat64.st_fsid` was renamed to `st_dev` in https://github.com/rust-lang/libc/pull/3785, so if you have a new libc with this patch included, and you build std from source, you get this error: ```sh error[E0609]: no field `st_fsid` on type `&stat64` --> /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/os/hurd/fs.rs:301:36 | 301 | self.as_inner().as_inner().st_fsid as u64 | ^^^^^^^ unknown field | help: a field with a similar name exists | 301 | self.as_inner().as_inner().st_uid as u64 | ~~~~~~ ``` Full CI log: https://github.com/nix-rust/nix/actions/runs/12033180710/job/33546728266?pr=2544
2024-11-30fix: hurd build, stat64.st_fsid was renamed to st_devSteve Lau-1/+1
2024-11-30Abstract `ProcThreadAttributeList` into its own structMichael van Straten-55/+273
2024-11-29Auto merge of #133533 - BoxyUwU:bump-boostrap, r=jieyouxu,Mark-Simulacrumbors-1/+1
Bump boostrap compiler to new beta Currently failing due to something about the const stability checks and `panic!`. I'm not sure why though since I wasn't able to see any PRs merged in the past few days that would result in a `cfg(bootstrap)` that shouldn't be removed. cc `@RalfJung` #131349
2024-11-28Rollup merge of #129409 - grinapo:patch-1, r=AmanieuGuillaume Gomez-0/+5
Expand std::os::unix::fs::chown() doc with a warning Include warning about losing setuid/gid when chowning, per POSIX. It is about the underlying system call but it is rather useful to mention it in the help in case someone accidentally forgets (don't look at me :)).
2024-11-27replace placeholder versionBoxy-1/+1
2024-11-26std: update internal uses of `io::const_error!`joboet-8/+7
2024-11-22library: update comment around close()Ralf Jung-10/+11
2024-11-19UniqueRc: platform-specific AsFd/Handle/etc impls to mirror RcZachary S-0/+32
2024-11-14Remove one stray space.Peter Gervai-1/+1
2024-11-14Fix a copy-paste issue in the NuttX raw type definitionHuang Qi-1/+1
This file is copied from the rtems as initial implementation, and forgot to change the OS name in the comment. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-11-04docs: fix grammar in doc comment at unix/process.rsNotWearingPants-1/+1
2024-11-03Auto merge of #123723 - madsmtm:apple-std-os, r=dtolnaybors-15/+37
Make `std::os::darwin` public I'm not sure of the reasoning behind them not being public before, but I think they should be, just like `std::os::ios` and `std::os::macos` are public. Additionally, I've merged their source code, as it was otherwise just a bunch of unnecessary duplication. Ultimately, I've done this PR to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings. Since you reviewed https://github.com/rust-lang/rust/pull/121419 r? davidtwco Fixes https://github.com/rust-lang/rust/issues/121640. `@rustbot` label O-tvos O-watchos O-visionos
2024-10-25library: consistently use American spelling for 'behavior'Ralf Jung-1/+1
2024-10-18Rollup merge of #131654 - betrusted-io:xous-various-fixes, r=thomccMatthias Krüger-1/+1
Various fixes for Xous This patchset includes several fixes for Xous that have crept in over the last few months: * The `adjust_process()` syscall was incorrect * Warnings have started appearing in `alloc` -- adopt the same approach as wasm, until wasm figures out a workaround * Dead code warnings have appeared in the networking code. Add `allow(dead_code)` as these structs are used as IPC values * Add support for `args` and `env`, which have been useful for running tests * Update `unwinding` to `0.2.3` which fixes the recent regression due to changes in `asm!()` code
2024-10-17Add must_use to CommandExt::execCallum Ryan-0/+1
2024-10-13xous: ffi: correct syscall number for adjust_processSean Cross-1/+1
The AdjustProcessLimit syscall was using the correct call number. Signed-off-by: Sean Cross <sean@xobs.io>
2024-10-09Decouple WASIp2 sockets from WasiFdNicola Krumschmidt-0/+2
2024-09-27Rollup merge of #130861 - cuviper:sun-path-offset, r=ibraheemdevGuillaume Gomez-12/+9
Use `mem::offset_of!` for `sockaddr_un.sun_path` We don't need manual pointer math here anymore! try-job: dist-i686-msvc
2024-09-26Add `sun_path` to the fake doc `sockaddr_un`Josh Stone-1/+3
2024-09-25Use `&raw` in the standard libraryJosh Stone-20/+16
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-25Use `mem::offset_of!` for `sockaddr_un.sun_path`Josh Stone-11/+6
2024-09-24Initial std library support for NuttXHuang Qi-0/+133
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-54/+48
2024-09-19[Clippy] Swap `non_octal_unix_permissions` to use diagnostic item instead of ↵GnomedDev-0/+1
path
2024-09-11Rollup merge of #130168 - juliusl:pr/fix-win-fs-change-time-links, r=ChrisDentonJubilee-10/+14
maint: update docs for change_time ext and doc links maint: update docs for change_time ext and doc links Related: https://github.com/rust-lang/rust/issues/121478 r? tgross35
2024-09-11chore: remove struct detailsJulius Liu-2/+2
2024-09-11docs: remove struct infoJulius Liu-1/+1
2024-09-09chore: removing supporting links in favor of existing doc-comment styleJulius Liu-13/+6
2024-09-09maint: update docs for change_time ext and doc linksJulius Liu-9/+20
2024-09-07Auto merge of #129941 - BoxyUwU:bump-boostrap, r=albertlarsan68bors-5/+1
Bump boostrap compiler to new beta Accidentally left some comments on the update cfgs commit directly xd
2024-09-05update cfgsBoxy-5/+1
2024-09-03Port std library to RTEMSJan Sommer-0/+415
2024-08-22Update chown help with a link and adding cap warningPeter Gervai-1/+2
Linked to chown(2) manpage on the web which expands on chown call behaviour.
2024-08-22Expand std::os::unix::fs::chown() doc with a warningPeter Gervai-0/+4
Include warning about losing setuid/gid when chowning, per POSIX.
2024-08-22Rollup merge of #128432 - g0djan:godjan/wasi_prohibit_implicit_unsafe, ↵Matthias Krüger-2/+2
r=tgross35 WASI: forbid `unsafe_op_in_unsafe_fn` for `std::{os, sys}` Part of https://github.com/rust-lang/rust/issues/127747 for WASI try-job: test-various
2024-08-14CommandExt::before_exec: deprecate safety in edition 2024Ralf Jung-3/+11
2024-08-13Make `std::os::darwin` publicMads Marquart-15/+37
This includes `std::os::darwin::fs`, which is re-exported under `std::os::macos::fs` and `std::os::ios::fs`. `std::os::darwin::raw` is not exposed, which means that `MetadataExt::as_raw_stat` isn't available on tvOS, visionOS and watchOS.
2024-08-07Rollup merge of #128539 - biabbas:deny_unsafe, r=workingjubileeMatthias Krüger-0/+1
Forbid unused unsafe in vxworks-specific std modules Tracking issue #127747 Adding deny(unsafe_op_in_unsafe_fn) in VxWorks specific files did not cause any error. Most of VxWorks falls back on Unix libraries. So we'll have to wait for Unix changes. r? ```@workingjubilee```
2024-08-05WASI fixing unsafe_op_in_unsafe_fn for std::{os, sys}Georgii Rylov-2/+2
2024-08-03Rollup merge of #127586 - zachs18:more-must-use, r=cuviperMatthias Krüger-0/+4
Add `#[must_use]` to some `into_raw*` functions. cc #121287 r? ``@cuviper`` Adds `#[must_use = "losing the pointer will leak memory"]`[^1] to `Box::into_raw(_with_allocator)`, `Vec::into_raw_parts(_with_alloc)`, `String::into_raw_parts`[^2], and `rc::{Rc, Weak}::into_raw_with_allocator` (Rc's normal `into_raw` and all of `Arc`'s `into_raw*`s are already `must_use`). Adds `#[must_use = "losing the raw <resource name may leak resources"]` to `IntoRawFd::into_raw_fd`, `IntoRawSocket::into_raw_socket`, and `IntoRawHandle::into_raw_handle`. [^1]: "*will* leak memory" may be too-strong wording (since `Box`/`Vec`/`String`/`rc::Weak` might not have a backing allocation), but I left it as-is for simplicity and consistency. [^2]: `String::into_raw_parts`'s `must_use` message is changed from the previous (possibly misleading) "`self` will be dropped if the result is not used".
2024-08-03Forbid unsafe_op_in_unsafe_fn in vxworks specific os and sys filesB I Mohammed Abbas-0/+1
2024-08-01fix(os/hermit): `deny(unsafe_op_in_unsafe_fn)`Martin Kröning-0/+1
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>