about summary refs log tree commit diff
path: root/library/std/src/os/fd/raw.rs
AgeCommit message (Collapse)AuthorLines
2025-04-09replace version placeholderBoxy-6/+6
2025-03-23Trusty: Fix build for anonymous pipes and std::sys::processThalia Archibald-2/+7
PRs #136842 (Add libstd support for Trusty targets), #137793 (Stablize anonymous pipe), and #136929 (std: move process implementations to `sys`) merged around the same time, so update Trusty to take them into account.
2025-03-14Mv os-specific trait impl of `Pipe*` into `std::os::*`Jiahao XU-0/+43
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-03-10Format after patches have been appliedNicole LeGare-3/+3
2025-03-10Apply rustc-0054-Add-std-os-fd-support-for-Trusty.patchNicole LeGare-1/+9
2025-01-14remove unnecessary rustc_allowed_through_unstable_modulesRalf Jung-5/+0
2024-11-19UniqueRc: platform-specific AsFd/Handle/etc impls to mirror RcZachary S-0/+8
2024-08-03Rollup merge of #127586 - zachs18:more-must-use, r=cuviperMatthias Krüger-0/+1
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-07-29Reformat `use` declarations.Nicholas Nethercote-4/+4
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-10Add `must_use` to IntoRawFd/IntoRawSocket/IntoRawHandle's methods.Zachary S-0/+1
2023-08-14sync the various FromRawFd trait docs, and remove 'valid'Ralf Jung-1/+1
2023-08-13add more explicit I/O safety documentationRalf Jung-1/+4
2023-03-15Bump version placeholdersMark Rousskov-1/+1
2023-02-24avoid the usage of libc during the creation of documentationStefan Lankes-9/+7
2023-02-24remove code duplicationsStefan Lankes-6/+18
2023-01-26Implement `AsFd` and `AsRawFd` for `Rc`Ian Douglas Scott-0/+8
Fixes https://github.com/rust-lang/rust/issues/105931.
2022-09-02Fix compilation of the doc tests on Windows.Dan Gohman-0/+3
2022-08-29Make `std::os::fd` public.Dan Gohman-12/+3
`std::os::fd` defines types like `OwnedFd` and `RawFd` and is common between Unix and non-Unix platforms that share a basic file-descriptor concept. Rust currently uses this internally to simplify its own code, but it would be useful for external users in the same way, so make it public. This means that `OwnedFd` etc. will all appear in three places, for example on unix platforms: - `std::os::fd::OwnedFd` - `std::os::unix::io::OwnedFd` - `std::os::unix::prelude::OwnedFd`
2022-08-12Adjust cfgsMark Rousskov-4/+4
2022-07-27Allow using stable os::fd::raw items through unstable os::wasi modulebstrie-0/+4
This fixes a regression from stable to nightly. Closes #99502.
2022-07-06Fix typo in file descriptor docsFlorian Spieß-1/+1
2022-06-21`impl<T: AsFd> AsFd for {Arc,Box}<T>`Joshua Nelson-3/+2
2022-06-21`impl<T: AsRawFd> for {Arc,Box}<T>`Joshua Nelson-0/+32
This allows implementing traits that require a raw FD on Arc and Box. Previously, you'd have to add the function to the trait itself: ```rust trait MyTrait { fn as_raw_fd(&self) -> RawFd; } impl<T: MyTrait> MyTrait for Arc<T> { fn as_raw_fd(&self) -> RawFd { (**self).as_raw_fd() } } ```
2022-04-11Fix documentation for wasm32-unknown-unknownO01eg-1/+1
2022-03-02Fix a broken doc link on Windows.Dan Gohman-3/+1
2022-02-01x.py fmtDan Gohman-2/+2
2022-02-01Use `From`/`Into` rather than the traits they replaced.Dan Gohman-6/+8
2022-02-01Fix errors.Dan Gohman-2/+2
2022-02-01Fix unresolved doc links.Dan Gohman-0/+4
2022-02-01Fix two copy+pastos.Dan Gohman-1/+1
2022-02-01Update the documentation for `{As,Into,From}Raw{Fd,Handle,Socket}`.Dan Gohman-14/+24
This change weakens the descriptions of the `{as,into,from}_raw_{fd,handle,socket}` descriptions from saying that they *do* express ownership relations to say that they are *typically used* in ways that express ownership relations. This needed needed since, for example, std's own [`RawFd`] implements `{As,From,Into}Fd` without any of the ownership relationships. This adds proper `# Safety` comments to `from_raw_{fd,handle,socket}`, adds the requirement that raw handles be not opened with the `FILE_FLAG_OVERLAPPED` flag, and merges the `OwnedHandle::from_raw_handle` comment into the main `FromRawHandle::from_raw_handle` comment. And, this changes `HandleOrNull` and `HandleOrInvalid` to not implement `FromRawHandle`, since they are intended for limited use in FFI situations, and not for generic use, and they have constraints that are stronger than the those of `FromRawHandle`. [`RawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/type.RawFd.html
2021-08-19Fix doc test failures on Windows.Dan Gohman-0/+4
2021-08-19Factor out a common `RawFd`/`AsRawFd`/etc for Unix and WASI.Dan Gohman-0/+206