about summary refs log tree commit diff
path: root/library/std/src/os/wasi
AgeCommit message (Collapse)AuthorLines
2025-05-10Remove `stable` attribute from wasi fs (read_exact|write_all)_atPaolo Barbolini-2/+0
2025-03-06library: Use size_of from the prelude instead of importedThalia Archibald-1/+0
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-02-17Remove std::os::wasi::fs::FileExt::tellThalia Archibald-11/+0
Following #137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
2025-01-14wasi/io: remove dead filesRalf Jung-29/+4
2024-11-26std: update internal uses of `io::const_error!`joboet-3/+2
2024-10-09Decouple WASIp2 sockets from WasiFdNicola Krumschmidt-0/+2
2024-08-05WASI fixing unsafe_op_in_unsafe_fn for std::{os, sys}Georgii Rylov-2/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-5/+5
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-26Fix doc nitsJohn Arundel-13/+13
Many tiny changes to stdlib doc comments to make them consistent (for example "Returns foo", rather than "Return foo", per RFC1574), adding missing periods, paragraph breaks, backticks for monospace style, and other minor nits. https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
2024-04-11Factor some common `io::Error` constantsBenoît du Garreau-9/+2
2024-02-27Rename wasm32-wasi-preview2 to wasm32-wasip2Ryan Levick-2/+2
Signed-off-by: Ryan Levick <me@ryanlevick.com>
2024-02-27Add the wasm32-wasi-preview2 targetRyan Levick-1/+2
Signed-off-by: Ryan Levick <me@ryanlevick.com>
2024-02-18Add uncontroversial syscall doc aliases to std docsSabrinaJewson-0/+14
2024-01-28Revert "Add the wasm32-wasi-preview2 target"León Orell Valerian Liehr-2/+1
This reverts commit 31ecf341250a889ac1154b2cbe3f0b97f9d008c1. Co-authored-by: Ryan Levick <me@ryanlevick.com>
2024-01-23Add the wasm32-wasi-preview2 targetRyan Levick-1/+2
Signed-off-by: Ryan Levick <me@ryanlevick.com>
2023-09-03Use std::io::Error::is_interrupted everywhereBen Kimock-2/+2
2022-10-29Adjust stabilization version to 1.65.0 for wasi fdsMark Rousskov-2/+2
See https://github.com/rust-lang/rust/pull/103308#issuecomment-1292277645 for this ask.
2022-10-20Make the whole `std::os::wasi::io` module stable.Dan Gohman-1/+1
2022-10-20Mark `std::os::wasi::io::AsFd` etc. as stable.Dan Gohman-1/+1
io_safety was stabilized in Rust 1.63, so mark the io_safety exports in `std::os::wasi::io` as stable. Fixes #103306.
2022-08-29Make `std::os::fd` public.Dan Gohman-7/+1
`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-07-27Allow using stable os::fd::raw items through unstable os::wasi modulebstrie-0/+15
This fixes a regression from stable to nightly. Closes #99502.
2022-02-04Hide Repr details from io::Error, and rework `io::Error::new_const`.Thom Chiovoloni-6/+6
2022-01-28wasi: enable TcpListener and TcpStreamHarald Hoyer-0/+20
With the addition of `sock_accept()` to snapshot1, simple networking via a passed `TcpListener` is possible. This patch implements the basics to make a simple server work. Signed-off-by: Harald Hoyer <harald@profian.com>
2022-01-28wasi: update to wasi 0.11.0Harald Hoyer-0/+15
To make use of `sock_accept()`, update the wasi crate to `0.11.0`. Signed-off-by: Harald Hoyer <harald@profian.com>
2021-11-12Rename WASI's `is_character_device` to `is_char_device`.Dan Gohman-2/+6
Rename WASI's `FileTypeExt::is_character_device` to `FileTypeExt::is_char_device`, for consistency with the Unix `FileTypeExt::is_char_device`. Also, add a `FileTypeExt::is_socket` function, for consistency with the Unix `FileTypeExt::is_socket` function.
2021-09-17modify std::os docs to be more consistentSachin Cherian-2/+9
> add intra doc links > add a usage example for the os::windows module
2021-08-19Factor out a common `RawFd`/`AsRawFd`/etc for Unix and WASI.Dan Gohman-231/+2
2021-08-19Fix syntax for non-doc comments, and use `crate::` instead of `std::`.Dan Gohman-6/+6
2021-08-19Factor out Unix and WASI fd code into a common module.Dan Gohman-280/+1
2021-08-19Synchronize minor differences between Unix and WASI implementations.Dan Gohman-3/+4
2021-08-19Fix copypasta of "Unix" within the WASI directory.Dan Gohman-1/+1
2021-08-19Add Safety comments to the `As*` for `Owned*` implementations.Dan Gohman-0/+3
2021-08-19Add Owned*, Borrowed*, and As* to the preludes.Dan Gohman-1/+1
2021-08-19Rename `OwnedFd`'s private field to match it's debug output.Dan Gohman-17/+17
2021-08-19Add a test to ensure that RawFd is the size we assume it is.Dan Gohman-0/+15
2021-08-19I/O safety.Dan Gohman-89/+411
Introduce `OwnedFd` and `BorrowedFd`, and the `AsFd` trait, and implementations of `AsFd`, `From<OwnedFd>` and `From<T> for OwnedFd` for relevant types, along with Windows counterparts for handles and sockets. Tracking issue: - <https://github.com/rust-lang/rust/issues/87074> RFC: - <https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md>
2021-08-13Change WASI's `RawFd` from `u32` to `c_int` (`i32`).Dan Gohman-7/+14
WASI previously used `u32` as its `RawFd` type, since its "file descriptors" are unsigned table indices, and there's no fundamental reason why WASI can't have more than 2^31 handles. However, this creates myriad little incompability problems with code that also supports Unix platforms, where `RawFd` is `c_int`. While WASI isn't a Unix, it often shares code with Unix, and this difference made such shared code inconvenient. #87329 is the most recent example of such code. So, switch WASI to use `c_int`, which is `i32`. This will mean that code intending to support WASI should ideally avoid assuming that negative file descriptors are invalid, even though POSIX itself says that file descriptors are never negative. This is a breaking change, but `RawFd` is considerd an experimental feature in [the documentation]. [the documentation]: https://doc.rust-lang.org/stable/std/os/wasi/io/type.RawFd.html
2021-07-12Add tracking issue number to `wasi_ext`Benoît du Garreau-2/+2
2021-07-02Auto merge of #85746 - m-ou-se:io-error-other, r=joshtriplettbors-1/+2
Redefine `ErrorKind::Other` and stop using it in std. This implements the idea I shared yesterday in the libs meeting when we were discussing how to handle adding new `ErrorKind`s to the standard library: This redefines `Other` to be for *user defined errors only*, and changes all uses of `Other` in the standard library to a `#[doc(hidden)]` and permanently `#[unstable]` `ErrorKind` that users can not match on. This ensures that adding `ErrorKind`s at a later point in time is not a breaking change, since the user couldn't match on these errors anyway. This way, we use the `#[non_exhaustive]` property of the enum in a more effective way. Open questions: - How do we check this change doesn't cause too much breakage? Will a crate run help and be enough? - How do we ensure we don't accidentally start using `Other` again in the standard library? We don't have a `pub(not crate)` or `#[deprecated(in this crate only)]`. cc https://github.com/rust-lang/rust/pull/79965 cc `@rust-lang/libs` `@ijackson` r? `@dtolnay`
2021-06-20Move `OsStringExt` and `OsStrExt` to `std::os`Christiaan Dirkx-1/+4
2021-06-15Rename ErrorKind::Unknown to Uncategorized.Mara Bos-1/+2
2021-06-15Redefine `ErrorKind::Other` and stop using it in std.Mara Bos-1/+1
2021-05-14Expand WASI abbreviation in docsr00ster-1/+1
2021-05-03Move `std::sys::wasi::ext` to `std::os::wasi`Christiaan Dirkx-0/+796