about summary refs log tree commit diff
path: root/library/std/src/sys/wasi/net.rs
AgeCommit message (Collapse)AuthorLines
2024-01-11std: begin moving platform support modules into `pal`joboet-544/+0
2023-05-01Inline AsRawFd implementationsKonrad Borowski-0/+1
2023-05-01Inline socket function implementationsKonrad Borowski-0/+3
2023-05-01Inline AsInner implementationsKonrad Borowski-0/+3
2023-03-06Implement read_buf for a few more typesTomasz Miąsko-1/+5
Implement read_buf for TcpStream, Stdin, StdinLock, ChildStdout, ChildStderr (and internally for AnonPipe, Handle, Socket), so that it skips buffer initialization. The other provided methods like read_to_string and read_to_end are implemented in terms of read_buf and so benefit from the optimization as well. This commit also implements read_vectored and is_read_vectored where applicable.
2022-11-24feat: implement TcpStream shutdown for wasm32-wasiHarald Hoyer-2/+8
Signed-off-by: Harald Hoyer <harald@profian.com>
2022-07-30Remove socklen_t from platforms where it's no longer usedLinus Färnstrand-2/+0
2022-05-09Use Rust 2021 prelude in std itself.Mara Bos-1/+0
2022-01-28wasi: enable TcpListener and TcpStreamHarald Hoyer-13/+53
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>
2021-08-30add `TcpStream::set_linger` and `TcpStream::linger`ibraheemdev-0/+8
2021-08-19Factor out a common `RawFd`/`AsRawFd`/etc for Unix and WASI.Dan Gohman-1/+0
2021-08-19I/O safety.Dan Gohman-28/+97
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-6/+7
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-04-20Change uses of never typeChristiaan Dirkx-2/+2
2021-04-20Replace `Void` with never typeChristiaan Dirkx-2/+2
2021-02-24x.py fmtDan Gohman-1/+1
2021-02-24Use `super::` to refer to WASI-specific names.Dan Gohman-1/+1
This ensures that these names resolve to the right place even when building the WASI support on other platforms for generating the documentation.
2020-09-03Applied `#![deny(unsafe_op_in_unsafe_fn)]` in library/std/src/wasiAmjad Alsharafi-0/+2
All refactoring needed was only in `alloc.rs`, changed part of the code in `alloc` method to satisfy the SAFETY statement
2020-07-27mv std libs to library/mark-0/+411