about summary refs log tree commit diff
path: root/library/std/src/os/wasi
AgeCommit message (Collapse)AuthorLines
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