From 64225decb89bfcec9d59e87197e45943de484c3e Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 7 Dec 2023 20:42:35 -0800 Subject: [PATCH] Miscellaneous documentation cleanups. --- Cargo.toml | 4 +- README.md | 13 ++--- src/backend/libc/fs/types.rs | 6 +-- src/backend/libc/io/errno.rs | 4 +- src/backend/libc/mod.rs | 18 +++---- src/backend/libc/mount/types.rs | 2 +- src/backend/libc/pipe/types.rs | 4 +- src/backend/libc/pty/syscalls.rs | 2 +- src/backend/libc/winsock_c.rs | 2 +- src/backend/linux_raw/event/epoll.rs | 6 +-- src/backend/linux_raw/fs/inotify.rs | 2 +- src/backend/linux_raw/fs/types.rs | 6 +-- src/backend/linux_raw/io/errno.rs | 4 +- src/backend/linux_raw/mount/types.rs | 2 +- src/backend/linux_raw/pipe/types.rs | 6 ++- src/event/kqueue.rs | 2 +- src/event/poll.rs | 4 +- src/io/close.rs | 4 +- src/io/ioctl.rs | 8 +-- src/ioctl/mod.rs | 4 +- src/lib.rs | 2 +- src/net/send_recv/mod.rs | 38 +++++++------- src/net/socket.rs | 76 ++++++++++++++-------------- src/net/sockopt.rs | 24 ++++----- src/net/wsa.rs | 8 +-- src/rand/getrandom.rs | 6 +-- src/termios/types.rs | 10 ++-- 27 files changed, 136 insertions(+), 131 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ecbe89909..1466a8f86 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ authors = [ "Dan Gohman ", "Jakub Konka ", ] -description = "Safe Rust bindings to POSIX/Unix/Linux/Winsock2-like syscalls" +description = "Safe Rust bindings to POSIX/Unix/Linux/Winsock-like syscalls" documentation = "https://docs.rs/rustix" license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT" repository = "https://github.com/bytecodealliance/rustix" @@ -55,7 +55,7 @@ libc = { version = "0.2.150", default-features = false, features = ["extra_trait [target.'cfg(all(any(target_os = "android", target_os = "linux"), any(rustix_use_libc, miri, not(all(target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64")))))))'.dependencies] linux-raw-sys = { version = "0.4.11", default-features = false, features = ["general", "ioctl", "no_std"] } -# For the libc backend on Windows, use the Winsock2 API in windows-sys. +# For the libc backend on Windows, use the Winsock API in windows-sys. [target.'cfg(windows)'.dependencies.windows-sys] version = "0.52.0" features = [ diff --git a/README.md b/README.md index d1add170d..9f437b1a4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

rustix

- Safe Rust bindings to POSIX/Unix/Linux/Winsock2 syscalls + Safe Rust bindings to POSIX/Unix/Linux/Winsock syscalls

A Bytecode Alliance project @@ -16,7 +16,7 @@ `rustix` provides efficient memory-safe and [I/O-safe] wrappers to POSIX-like, -Unix-like, Linux, and Winsock2 syscall-like APIs, with configurable backends. +Unix-like, Linux, and Winsock syscall-like APIs, with configurable backends. It uses Rust references, slices, and return values instead of raw pointers, and [I/O safety types] instead of raw file descriptors, providing memory safety, [I/O safety], and [provenance]. It uses `Result`s for reporting errors, @@ -24,9 +24,9 @@ It uses Rust references, slices, and return values instead of raw pointers, and to efficiently accept any Rust string type, and several other efficient conveniences. -`rustix` is low-level and, and while the `net` API supports Winsock2 on -Windows, the rest of the APIs do not support Windows; for higher-level and more -portable APIs built on this functionality, see the [`cap-std`], [`memfd`], +`rustix` is low-level and, and while the `net` API supports [Windows Sockets 2] +(Winsock), the rest of the APIs do not support Windows; for higher-level and +more portable APIs built on this functionality, see the [`cap-std`], [`memfd`], [`timerfd`], and [`io-streams`] crates, for example. `rustix` currently has two backends available: @@ -42,7 +42,7 @@ portable APIs built on this functionality, see the [`cap-std`], [`memfd`], provenance all the way down to the syscalls. * libc, which uses the [`libc`] crate which provides bindings to native `libc` - libraries on Unix-family platforms, and [`windows-sys`] for Winsock2 on + libraries on Unix-family platforms, and [`windows-sys`] for Winsock on Windows, and is portable to many OS's. The linux_raw backend is enabled by default on platforms which support it. To @@ -165,6 +165,7 @@ always reflect “very old” Linux versions. [any current Rust target]: https://doc.rust-lang.org/nightly/rustc/platform-support.html [kernel.org]: https://www.kernel.org/releases.html [Rust on Debian stable]: https://packages.debian.org/stable/rust/rustc +[Windows Sockets 2]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-start-page-2 [`nix`]: https://crates.io/crates/nix [`unix`]: https://crates.io/crates/unix [`nc`]: https://crates.io/crates/nc diff --git a/src/backend/libc/fs/types.rs b/src/backend/libc/fs/types.rs index 876757715..19508c241 100644 --- a/src/backend/libc/fs/types.rs +++ b/src/backend/libc/fs/types.rs @@ -159,13 +159,13 @@ bitflags! { #[cfg(not(target_os = "espidf"))] impl Mode { /// Construct a `Mode` from the mode bits of the `st_mode` field of a - /// `Stat`. + /// `Mode`. #[inline] pub const fn from_raw_mode(st_mode: RawMode) -> Self { Self::from_bits_truncate(st_mode) } - /// Construct an `st_mode` value from `Stat`. + /// Construct an `st_mode` value from a `Mode`. #[inline] pub const fn as_raw_mode(self) -> RawMode { self.bits() @@ -503,7 +503,7 @@ impl FileType { } } - /// Construct an `st_mode` value from `Stat`. + /// Construct an `st_mode` value from a `FileType`. #[inline] pub const fn as_raw_mode(self) -> RawMode { match self { diff --git a/src/backend/libc/io/errno.rs b/src/backend/libc/io/errno.rs index 731086b4f..805ea6799 100644 --- a/src/backend/libc/io/errno.rs +++ b/src/backend/libc/io/errno.rs @@ -14,7 +14,7 @@ use libc_errno::errno; /// # References /// - [POSIX] /// - [Linux] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -24,7 +24,7 @@ use libc_errno::errno; /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html /// [Linux]: https://man7.org/linux/man-pages/man3/errno.3.html -/// [Winsock2]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 +/// [Winsock]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?errno /// [NetBSD]: https://man.netbsd.org/errno.2 /// [OpenBSD]: https://man.openbsd.org/errno.2 diff --git a/src/backend/libc/mod.rs b/src/backend/libc/mod.rs index 729eb2489..9ecb09f12 100644 --- a/src/backend/libc/mod.rs +++ b/src/backend/libc/mod.rs @@ -1,7 +1,7 @@ //! The libc backend. //! //! On most platforms, this uses the `libc` crate to make system calls. On -//! Windows, this uses the Winsock2 API in `windows-sys`, which can be adapted +//! Windows, this uses the Winsock API in `windows-sys`, which can be adapted //! to have a very `libc`-like interface. // Every FFI call requires an unsafe block, and there are a lot of FFI @@ -21,11 +21,11 @@ pub(crate) mod fd { }; pub(crate) use windows_sys::Win32::Networking::WinSock::SOCKET as LibcFd; - /// A version of [`AsRawFd`] for use with Winsock2 API. + /// A version of [`AsRawFd`] for use with Winsock API. /// /// [`AsRawFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.AsRawFd.html pub trait AsRawFd { - /// A version of [`as_raw_fd`] for use with Winsock2 API. + /// A version of [`as_raw_fd`] for use with Winsock API. /// /// [`as_raw_fd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html#tymethod.as_raw_fd fn as_raw_fd(&self) -> RawFd; @@ -37,11 +37,11 @@ pub(crate) mod fd { } } - /// A version of [`IntoRawFd`] for use with Winsock2 API. + /// A version of [`IntoRawFd`] for use with Winsock API. /// /// [`IntoRawFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.IntoRawFd.html pub trait IntoRawFd { - /// A version of [`into_raw_fd`] for use with Winsock2 API. + /// A version of [`into_raw_fd`] for use with Winsock API. /// /// [`into_raw_fd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html#tymethod.into_raw_fd fn into_raw_fd(self) -> RawFd; @@ -53,11 +53,11 @@ pub(crate) mod fd { } } - /// A version of [`FromRawFd`] for use with Winsock2 API. + /// A version of [`FromRawFd`] for use with Winsock API. /// /// [`FromRawFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html pub trait FromRawFd { - /// A version of [`from_raw_fd`] for use with Winsock2 API. + /// A version of [`from_raw_fd`] for use with Winsock API. /// /// # Safety /// @@ -74,11 +74,11 @@ pub(crate) mod fd { } } - /// A version of [`AsFd`] for use with Winsock2 API. + /// A version of [`AsFd`] for use with Winsock API. /// /// [`AsFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.AsFd.html pub trait AsFd { - /// An `as_fd` function for Winsock2, where a `Fd` is a `Socket`. + /// An `as_fd` function for Winsock, where a `Fd` is a `Socket`. fn as_fd(&self) -> BorrowedFd; } impl AsFd for T { diff --git a/src/backend/libc/mount/types.rs b/src/backend/libc/mount/types.rs index 238f2128e..10236866c 100644 --- a/src/backend/libc/mount/types.rs +++ b/src/backend/libc/mount/types.rs @@ -227,7 +227,7 @@ bitflags! { /// `MOVE_MOUNT__MASK` const MOVE_MOUNT_SET_GROUP = 0x0000_0100; - // TODO: add when linux 6.5 is released + // TODO: add when Linux 6.5 is released // /// `MOVE_MOUNT_BENEATH` // const MOVE_MOUNT_BENEATH = 0x0000_0200; diff --git a/src/backend/libc/pipe/types.rs b/src/backend/libc/pipe/types.rs index d5cc73962..78fc2fcad 100644 --- a/src/backend/libc/pipe/types.rs +++ b/src/backend/libc/pipe/types.rs @@ -53,12 +53,14 @@ bitflags! { } } -/// A buffer type used with `vmsplice`. +/// A buffer type for use with [`vmsplice`]. /// /// It is guaranteed to be ABI compatible with the iovec type on Unix platforms /// and `WSABUF` on Windows. Unlike `IoSlice` and `IoSliceMut` it is /// semantically like a raw pointer, and therefore can be shared or mutated as /// needed. +/// +/// [`vmsplice`]: crate::pipe::vmsplice #[cfg(linux_kernel)] #[repr(transparent)] pub struct IoSliceRaw<'a> { diff --git a/src/backend/libc/pty/syscalls.rs b/src/backend/libc/pty/syscalls.rs index 86f3a6c46..2395efde4 100644 --- a/src/backend/libc/pty/syscalls.rs +++ b/src/backend/libc/pty/syscalls.rs @@ -58,7 +58,7 @@ pub(crate) fn ptsname(fd: BorrowedFd<'_>, mut buffer: Vec) -> io::Result io::Result { syscalls::epoll_create(flags) } -/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an -/// epoll object. +/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an epoll +/// object. /// /// This registers interest in any of the events set in `events` occurring on /// the file descriptor associated with `data`. diff --git a/src/backend/linux_raw/fs/inotify.rs b/src/backend/linux_raw/fs/inotify.rs index aaba71d7c..851335ba8 100644 --- a/src/backend/linux_raw/fs/inotify.rs +++ b/src/backend/linux_raw/fs/inotify.rs @@ -107,7 +107,7 @@ pub fn inotify_add_watch( path.into_with_c_str(|path| syscalls::inotify_add_watch(inot, path, flags)) } -/// `inotify_rm_watch(self, wd)`—Removes a watch from this inotify +/// `inotify_rm_watch(self, wd)`—Removes a watch from this inotify. /// /// The watch descriptor provided should have previously been returned by /// [`inotify_add_watch`] and not previously have been removed. diff --git a/src/backend/linux_raw/fs/types.rs b/src/backend/linux_raw/fs/types.rs index 71ee9f52e..39823c4e1 100644 --- a/src/backend/linux_raw/fs/types.rs +++ b/src/backend/linux_raw/fs/types.rs @@ -127,13 +127,13 @@ bitflags! { impl Mode { /// Construct a `Mode` from the mode bits of the `st_mode` field of a - /// `Stat`. + /// `Mode`. #[inline] pub const fn from_raw_mode(st_mode: RawMode) -> Self { Self::from_bits_truncate(st_mode) } - /// Construct an `st_mode` value from `Stat`. + /// Construct an `st_mode` value from a `Mode`. #[inline] pub const fn as_raw_mode(self) -> RawMode { self.bits() @@ -355,7 +355,7 @@ impl FileType { } } - /// Construct an `st_mode` value from `Stat`. + /// Construct an `st_mode` value from a `FileType`. #[inline] pub const fn as_raw_mode(self) -> RawMode { match self { diff --git a/src/backend/linux_raw/io/errno.rs b/src/backend/linux_raw/io/errno.rs index 6771ba2b2..bc40e9a8d 100644 --- a/src/backend/linux_raw/io/errno.rs +++ b/src/backend/linux_raw/io/errno.rs @@ -24,7 +24,7 @@ use linux_raw_sys::errno; /// # References /// - [POSIX] /// - [Linux] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -34,7 +34,7 @@ use linux_raw_sys::errno; /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html /// [Linux]: https://man7.org/linux/man-pages/man3/errno.3.html -/// [Winsock2]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 +/// [Winsock]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?errno /// [NetBSD]: https://man.netbsd.org/errno.2 /// [OpenBSD]: https://man.openbsd.org/errno.2 diff --git a/src/backend/linux_raw/mount/types.rs b/src/backend/linux_raw/mount/types.rs index 43a2f7b49..43cb8c0d5 100644 --- a/src/backend/linux_raw/mount/types.rs +++ b/src/backend/linux_raw/mount/types.rs @@ -223,7 +223,7 @@ bitflags! { /// `MOVE_MOUNT__MASK` const MOVE_MOUNT_SET_GROUP = linux_raw_sys::general::MOVE_MOUNT_SET_GROUP; - // TODO: add when linux 6.5 is released + // TODO: add when Linux 6.5 is released // /// `MOVE_MOUNT_BENEATH` // const MOVE_MOUNT_BENEATH = linux_raw_sys::general::MOVE_MOUNT_BENEATH; diff --git a/src/backend/linux_raw/pipe/types.rs b/src/backend/linux_raw/pipe/types.rs index cfcb75477..2d1ed9ab9 100644 --- a/src/backend/linux_raw/pipe/types.rs +++ b/src/backend/linux_raw/pipe/types.rs @@ -22,7 +22,7 @@ bitflags! { } bitflags! { - /// `SPLICE_F_*` constants for use with [`splice`] [`vmsplice`], and + /// `SPLICE_F_*` constants for use with [`splice`], [`vmsplice`], and /// [`tee`]. #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] @@ -41,12 +41,14 @@ bitflags! { } } -/// A buffer type used with `vmsplice`. +/// A buffer type for use with [`vmsplice`]. /// /// It is guaranteed to be ABI compatible with the iovec type on Unix platforms /// and `WSABUF` on Windows. Unlike `IoSlice` and `IoSliceMut` it is /// semantically like a raw pointer, and therefore can be shared or mutated as /// needed. +/// +/// [`vmsplice`]: crate::pipe::vmsplice #[repr(transparent)] pub struct IoSliceRaw<'a> { _buf: c::iovec, diff --git a/src/event/kqueue.rs b/src/event/kqueue.rs index cd996aaea..d6b7cdecf 100644 --- a/src/event/kqueue.rs +++ b/src/event/kqueue.rs @@ -13,7 +13,7 @@ use core::mem::zeroed; use core::ptr::slice_from_raw_parts_mut; use core::time::Duration; -/// A `kqueue` event. +/// A `kqueue` event for use with [`kevent`]. #[repr(transparent)] #[derive(Copy, Clone)] pub struct Event { diff --git a/src/event/poll.rs b/src/event/poll.rs index 2ee40521f..30e6a4b10 100644 --- a/src/event/poll.rs +++ b/src/event/poll.rs @@ -9,7 +9,7 @@ pub use backend::event::poll_fd::{PollFd, PollFlags}; /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -20,7 +20,7 @@ pub use backend::event::poll_fd::{PollFd, PollFlags}; /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html /// [Linux]: https://man7.org/linux/man-pages/man2/poll.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/poll.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=poll&sektion=2 /// [NetBSD]: https://man.netbsd.org/poll.2 /// [OpenBSD]: https://man.openbsd.org/poll.2 diff --git a/src/io/close.rs b/src/io/close.rs index aad2c20a3..474d252f4 100644 --- a/src/io/close.rs +++ b/src/io/close.rs @@ -25,7 +25,7 @@ use backend::fd::RawFd; /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -37,7 +37,7 @@ use backend::fd::RawFd; /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html /// [Linux]: https://man7.org/linux/man-pages/man2/close.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/close.2.html#//apple_ref/doc/man/2/close -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-closesocket +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-closesocket /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=close&sektion=2 /// [NetBSD]: https://man.netbsd.org/close.2 /// [OpenBSD]: https://man.openbsd.org/close.2 diff --git a/src/io/ioctl.rs b/src/io/ioctl.rs index f89160bf3..99dec067d 100644 --- a/src/io/ioctl.rs +++ b/src/io/ioctl.rs @@ -31,11 +31,11 @@ pub fn ioctl_fioclex(fd: Fd) -> io::Result<()> { /// `ioctl(fd, FIONBIO, &value)`—Enables or disables non-blocking mode. /// /// # References -/// - [Winsock2] +/// - [Winsock] /// - [NetBSD] /// - [OpenBSD] /// -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls#unix-ioctl-codes +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls#unix-ioctl-codes /// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS /// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS #[inline] @@ -55,13 +55,13 @@ pub fn ioctl_fionbio(fd: Fd, value: bool) -> io::Result<()> { /// /// # References /// - [Linux] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] /// /// [Linux]: https://man7.org/linux/man-pages/man2/ioctl_tty.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls#unix-ioctl-codes +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls#unix-ioctl-codes /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=ioctl&sektion=2#GENERIC%09IOCTLS /// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS /// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS diff --git a/src/ioctl/mod.rs b/src/ioctl/mod.rs index b56b82b41..494cdc829 100644 --- a/src/ioctl/mod.rs +++ b/src/ioctl/mod.rs @@ -66,7 +66,7 @@ use bsd as platform; /// /// # References /// - [Linux] -/// - [WinSock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -75,7 +75,7 @@ use bsd as platform; /// - [illumos] /// /// [Linux]: https://man7.org/linux/man-pages/man2/ioctl.2.html -/// [Winsock2]: https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-ioctlsocket +/// [Winsock]: https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-ioctlsocket /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=ioctl&sektion=2 /// [NetBSD]: https://man.netbsd.org/ioctl.2 /// [OpenBSD]: https://man.openbsd.org/ioctl.2 diff --git a/src/lib.rs b/src/lib.rs index 52006f733..51fbdbaf7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ //! `rustix` provides efficient memory-safe and [I/O-safe] wrappers to -//! POSIX-like, Unix-like, Linux, and Winsock2 syscall-like APIs, with +//! POSIX-like, Unix-like, Linux, and Winsock syscall-like APIs, with //! configurable backends. //! //! With rustix, you can write code like this: diff --git a/src/net/send_recv/mod.rs b/src/net/send_recv/mod.rs index f1ae0ea69..cad2d5c6c 100644 --- a/src/net/send_recv/mod.rs +++ b/src/net/send_recv/mod.rs @@ -37,7 +37,7 @@ pub use msg::*; /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -49,7 +49,7 @@ pub use msg::*; /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html /// [Linux]: https://man7.org/linux/man-pages/man2/recv.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/recv.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recv +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recv /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2 /// [NetBSD]: https://man.netbsd.org/recv.2 /// [OpenBSD]: https://man.openbsd.org/recv.2 @@ -86,7 +86,7 @@ pub fn recv_uninit( /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -98,7 +98,7 @@ pub fn recv_uninit( /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html /// [Linux]: https://man7.org/linux/man-pages/man2/send.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/send.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2 /// [NetBSD]: https://man.netbsd.org/send.2 /// [OpenBSD]: https://man.openbsd.org/send.2 @@ -118,7 +118,7 @@ pub fn send(fd: Fd, buf: &[u8], flags: SendFlags) -> io::Result /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -130,7 +130,7 @@ pub fn send(fd: Fd, buf: &[u8], flags: SendFlags) -> io::Result /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html /// [Linux]: https://man7.org/linux/man-pages/man2/recvfrom.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/recvfrom.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recvfrom +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recvfrom /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=recvfrom&sektion=2 /// [NetBSD]: https://man.netbsd.org/recvfrom.2 /// [OpenBSD]: https://man.openbsd.org/recvfrom.2 @@ -149,9 +149,9 @@ pub fn recvfrom( /// `recvfrom(fd, buf, flags, addr, len)`—Reads data from a socket and /// returns the sender address. /// -/// This is equivalent to [`recvfrom`], except that it can read into uninitialized -/// memory. It returns the slice that was initialized by this function and the -/// slice that remains uninitialized. +/// This is equivalent to [`recvfrom`], except that it can read into +/// uninitialized memory. It returns the slice that was initialized by this +/// function and the slice that remains uninitialized. #[allow(clippy::type_complexity)] #[inline] pub fn recvfrom_uninit( @@ -174,7 +174,7 @@ pub fn recvfrom_uninit( /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -186,7 +186,7 @@ pub fn recvfrom_uninit( /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html /// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2 /// [NetBSD]: https://man.netbsd.org/sendto.2 /// [OpenBSD]: https://man.openbsd.org/sendto.2 @@ -222,7 +222,7 @@ fn _sendto( /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -234,7 +234,7 @@ fn _sendto( /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html /// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2 /// [NetBSD]: https://man.netbsd.org/sendto.2 /// [OpenBSD]: https://man.openbsd.org/sendto.2 @@ -272,7 +272,7 @@ fn _sendto_any( /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -284,7 +284,7 @@ fn _sendto_any( /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html /// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2 /// [NetBSD]: https://man.netbsd.org/sendto.2 /// [OpenBSD]: https://man.openbsd.org/sendto.2 @@ -310,7 +310,7 @@ pub fn sendto_v4( /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -322,7 +322,7 @@ pub fn sendto_v4( /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html /// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2 /// [NetBSD]: https://man.netbsd.org/sendto.2 /// [OpenBSD]: https://man.openbsd.org/sendto.2 @@ -348,7 +348,7 @@ pub fn sendto_v6( /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -360,7 +360,7 @@ pub fn sendto_v6( /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html /// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2 /// [NetBSD]: https://man.netbsd.org/sendto.2 /// [OpenBSD]: https://man.openbsd.org/sendto.2 diff --git a/src/net/socket.rs b/src/net/socket.rs index fe7439562..c01b7a43a 100644 --- a/src/net/socket.rs +++ b/src/net/socket.rs @@ -21,7 +21,7 @@ pub use backend::net::addr::SocketAddrUnix; /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -33,7 +33,7 @@ pub use backend::net::addr::SocketAddrUnix; /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html /// [Linux]: https://man7.org/linux/man-pages/man2/socket.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/socket.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2 /// [NetBSD]: https://man.netbsd.org/socket.2 /// [OpenBSD]: https://man.openbsd.org/socket.2 @@ -64,7 +64,7 @@ pub fn socket( /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -76,7 +76,7 @@ pub fn socket( /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html /// [Linux]: https://man7.org/linux/man-pages/man2/socket.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/socket.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2 /// [NetBSD]: https://man.netbsd.org/socket.2 /// [OpenBSD]: https://man.openbsd.org/socket.2 @@ -101,7 +101,7 @@ pub fn socket_with( /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -113,7 +113,7 @@ pub fn socket_with( /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html /// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2 /// [NetBSD]: https://man.netbsd.org/bind.2 /// [OpenBSD]: https://man.openbsd.org/bind.2 @@ -138,7 +138,7 @@ fn _bind(sockfd: BorrowedFd<'_>, addr: &SocketAddr) -> io::Result<()> { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -150,7 +150,7 @@ fn _bind(sockfd: BorrowedFd<'_>, addr: &SocketAddr) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html /// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2 /// [NetBSD]: https://man.netbsd.org/bind.2 /// [OpenBSD]: https://man.openbsd.org/bind.2 @@ -179,7 +179,7 @@ fn _bind_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()> { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -191,7 +191,7 @@ fn _bind_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html /// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2 /// [NetBSD]: https://man.netbsd.org/bind.2 /// [OpenBSD]: https://man.openbsd.org/bind.2 @@ -212,7 +212,7 @@ pub fn bind_v4(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -224,7 +224,7 @@ pub fn bind_v4(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html /// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2 /// [NetBSD]: https://man.netbsd.org/bind.2 /// [OpenBSD]: https://man.openbsd.org/bind.2 @@ -245,7 +245,7 @@ pub fn bind_v6(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -257,7 +257,7 @@ pub fn bind_v6(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html /// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2 /// [NetBSD]: https://man.netbsd.org/bind.2 /// [OpenBSD]: https://man.openbsd.org/bind.2 @@ -282,7 +282,7 @@ pub fn bind_unix(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<()> /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -294,7 +294,7 @@ pub fn bind_unix(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<()> /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 /// [NetBSD]: https://man.netbsd.org/connect.2 /// [OpenBSD]: https://man.openbsd.org/connect.2 @@ -320,7 +320,7 @@ fn _connect(sockfd: BorrowedFd<'_>, addr: &SocketAddr) -> io::Result<()> { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -332,7 +332,7 @@ fn _connect(sockfd: BorrowedFd<'_>, addr: &SocketAddr) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 /// [NetBSD]: https://man.netbsd.org/connect.2 /// [OpenBSD]: https://man.openbsd.org/connect.2 @@ -361,7 +361,7 @@ fn _connect_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()> /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -373,7 +373,7 @@ fn _connect_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()> /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 /// [NetBSD]: https://man.netbsd.org/connect.2 /// [OpenBSD]: https://man.openbsd.org/connect.2 @@ -394,7 +394,7 @@ pub fn connect_v4(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -406,7 +406,7 @@ pub fn connect_v4(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 /// [NetBSD]: https://man.netbsd.org/connect.2 /// [OpenBSD]: https://man.openbsd.org/connect.2 @@ -427,7 +427,7 @@ pub fn connect_v6(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -439,7 +439,7 @@ pub fn connect_v6(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 /// [NetBSD]: https://man.netbsd.org/connect.2 /// [OpenBSD]: https://man.openbsd.org/connect.2 @@ -464,7 +464,7 @@ pub fn connect_unix(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<( /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -476,7 +476,7 @@ pub fn connect_unix(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<( /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 /// [NetBSD]: https://man.netbsd.org/connect.2 /// [OpenBSD]: https://man.openbsd.org/connect.2 @@ -498,7 +498,7 @@ pub fn connect_unspec(sockfd: Fd) -> io::Result<()> { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -510,7 +510,7 @@ pub fn connect_unspec(sockfd: Fd) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html /// [Linux]: https://man7.org/linux/man-pages/man2/listen.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/listen.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2 /// [NetBSD]: https://man.netbsd.org/listen.2 /// [OpenBSD]: https://man.openbsd.org/listen.2 @@ -535,7 +535,7 @@ pub fn listen(sockfd: Fd, backlog: i32) -> io::Result<()> { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -547,7 +547,7 @@ pub fn listen(sockfd: Fd, backlog: i32) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html /// [Linux]: https://man7.org/linux/man-pages/man2/accept.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/accept.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2 /// [NetBSD]: https://man.netbsd.org/accept.2 /// [OpenBSD]: https://man.openbsd.org/accept.2 @@ -601,7 +601,7 @@ pub fn accept_with(sockfd: Fd, flags: SocketFlags) -> io::Result(sockfd: Fd, flags: SocketFlags) -> io::Result( /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -676,7 +676,7 @@ pub fn acceptfrom_with( /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html /// [Linux]: https://man7.org/linux/man-pages/man2/shutdown.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/shutdown.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-shutdown +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-shutdown /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=shutdown&sektion=2 /// [NetBSD]: https://man.netbsd.org/shutdown.2 /// [OpenBSD]: https://man.openbsd.org/shutdown.2 @@ -694,7 +694,7 @@ pub fn shutdown(sockfd: Fd, how: Shutdown) -> io::Result<()> { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -705,7 +705,7 @@ pub fn shutdown(sockfd: Fd, how: Shutdown) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html /// [Linux]: https://man7.org/linux/man-pages/man2/getsockname.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockname.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockname +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockname /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockname&sektion=2 /// [NetBSD]: https://man.netbsd.org/getsockname.2 /// [OpenBSD]: https://man.openbsd.org/getsockname.2 @@ -725,7 +725,7 @@ pub fn getsockname(sockfd: Fd) -> io::Result { /// - [POSIX] /// - [Linux] /// - [Apple] -/// - [Winsock2] +/// - [Winsock] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -737,7 +737,7 @@ pub fn getsockname(sockfd: Fd) -> io::Result { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html /// [Linux]: https://man7.org/linux/man-pages/man2/getpeername.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getpeername.2.html -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getpeername +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getpeername /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2 /// [NetBSD]: https://man.netbsd.org/getpeername.2 /// [OpenBSD]: https://man.openbsd.org/getpeername.2 diff --git a/src/net/sockopt.rs b/src/net/sockopt.rs index afeaf0b33..df04c4aab 100644 --- a/src/net/sockopt.rs +++ b/src/net/sockopt.rs @@ -7,7 +7,7 @@ //! //! - [POSIX `getsockopt`] //! - [Linux `getsockopt`] -//! - [Winsock2 `getsockopt`] +//! - [Winsock `getsockopt`] //! - [Apple `getsockopt`] //! - [FreeBSD `getsockopt`] //! - [NetBSD `getsockopt`] @@ -18,7 +18,7 @@ //! //! [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html //! [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html -//! [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt +//! [Winsock `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt //! [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html //! [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 //! [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2 @@ -31,7 +31,7 @@ //! //! - [POSIX `setsockopt`] //! - [Linux `setsockopt`] -//! - [Winsock2 `setsockopt`] +//! - [Winsock `setsockopt`] //! - [Apple `setsockopt`] //! - [FreeBSD `setsockopt`] //! - [NetBSD `setsockopt`] @@ -42,7 +42,7 @@ //! //! [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html //! [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html -//! [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt +//! [Winsock `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt //! [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html //! [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 //! [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 @@ -57,12 +57,12 @@ //! - [References for all `set_*` functions] //! - [POSIX `sys/socket.h`] //! - [Linux `socket`] -//! - [Winsock2 `SOL_SOCKET` options] +//! - [Winsock `SOL_SOCKET` options] //! - [glibc `SOL_SOCKET` Options] //! //! [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html //! [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html -//! [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +//! [Winsock `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options //! [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html //! //! # References for `get_ip_*` and `set_ip_*` functions: @@ -71,7 +71,7 @@ //! - [References for all `set_*` functions] //! - [POSIX `netinet/in.h`] //! - [Linux `ip`] -//! - [Winsock2 `IPPROTO_IP` options] +//! - [Winsock `IPPROTO_IP` options] //! - [Apple `ip`] //! - [FreeBSD `ip`] //! - [NetBSD `ip`] @@ -81,7 +81,7 @@ //! //! [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html //! [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html -//! [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options +//! [Winsock `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options //! [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html //! [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4 //! [NetBSD `ip`]: https://man.netbsd.org/ip.4 @@ -95,7 +95,7 @@ //! - [References for all `set_*` functions] //! - [POSIX `netinet/in.h`] //! - [Linux `ipv6`] -//! - [Winsock2 `IPPROTO_IPV6` options] +//! - [Winsock `IPPROTO_IPV6` options] //! - [Apple `ip6`] //! - [FreeBSD `ip6`] //! - [NetBSD `ip6`] @@ -105,7 +105,7 @@ //! //! [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html //! [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html -//! [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +//! [Winsock `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options //! [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html //! [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 //! [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 @@ -119,7 +119,7 @@ //! - [References for all `set_*` functions] //! - [POSIX `netinet/tcp.h`] //! - [Linux `tcp`] -//! - [Winsock2 `IPPROTO_TCP` options] +//! - [Winsock `IPPROTO_TCP` options] //! - [Apple `tcp`] //! - [FreeBSD `tcp`] //! - [NetBSD `tcp`] @@ -129,7 +129,7 @@ //! //! [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html //! [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html -//! [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options +//! [Winsock `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options //! [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html //! [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4 //! [NetBSD `tcp`]: https://man.netbsd.org/tcp.4 diff --git a/src/net/wsa.rs b/src/net/wsa.rs index 3367ca95c..0ad4db5eb 100644 --- a/src/net/wsa.rs +++ b/src/net/wsa.rs @@ -8,9 +8,9 @@ use windows_sys::Win32::Networking::WinSock::{WSACleanup, WSAGetLastError, WSASt /// using sockets APIs. The function performs the necessary initialization. /// /// # References -/// - [Winsock2] +/// - [Winsock] /// -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsastartup +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsastartup pub fn wsa_startup() -> io::Result { // Request version 2.2, which has been the latest version since far older // versions of Windows than we support here. For more information about @@ -35,9 +35,9 @@ pub fn wsa_startup() -> io::Result { /// this function releases associated resources. /// /// # References -/// - [Winsock2] +/// - [Winsock] /// -/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsacleanup +/// [Winsock]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsacleanup pub fn wsa_cleanup() -> io::Result<()> { unsafe { if WSACleanup() == 0 { diff --git a/src/rand/getrandom.rs b/src/rand/getrandom.rs index 6f3f5fe2b..c7f117ad9 100644 --- a/src/rand/getrandom.rs +++ b/src/rand/getrandom.rs @@ -25,9 +25,9 @@ pub fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result { /// `getrandom(buf, flags)`—Reads a sequence of random bytes. /// -/// This is identical to [`getrandom`], except that it can read into uninitialized -/// memory. It returns the slice that was initialized by this function and the -/// slice that remains uninitialized. +/// This is identical to [`getrandom`], except that it can read into +/// uninitialized memory. It returns the slice that was initialized by this +/// function and the slice that remains uninitialized. #[inline] pub fn getrandom_uninit( buf: &mut [MaybeUninit], diff --git a/src/termios/types.rs b/src/termios/types.rs index 720352442..57e9a5d20 100644 --- a/src/termios/types.rs +++ b/src/termios/types.rs @@ -85,7 +85,7 @@ impl Termios { /// Return the input communication speed. /// - /// Unlike the `c_ispeed` field in GLIBC and others, this returns the + /// Unlike the `c_ispeed` field in glibc and others, this returns the /// integer value of the speed, rather than the `B*` encoded constant /// value. #[doc(alias = "c_ispeed")] @@ -121,7 +121,7 @@ impl Termios { /// Return the output communication speed. /// - /// Unlike the `c_ospeed` field in GLIBC and others, this returns the + /// Unlike the `c_ospeed` field in glibc and others, this returns the /// arbitrary integer value of the speed, rather than the `B*` encoded /// constant value. #[inline] @@ -154,7 +154,7 @@ impl Termios { /// Set the input and output communication speeds. /// - /// Unlike the `c_ispeed` and `c_ospeed` fields in GLIBC and others, this + /// Unlike the `c_ispeed` and `c_ospeed` fields in glibc and others, this /// takes the arbitrary integer value of the speed, rather than the `B*` /// encoded constant value. Not all implementations support all integer /// values; use the constants in the [`speed`] module for likely-supported @@ -172,7 +172,7 @@ impl Termios { /// Set the input communication speed. /// - /// Unlike the `c_ispeed` field in GLIBC and others, this takes the + /// Unlike the `c_ispeed` field in glibc and others, this takes the /// arbitrary integer value of the speed, rather than the `B*` encoded /// constant value. Not all implementations support all integer values; use /// the constants in the [`speed`] module for known-supported speeds. @@ -190,7 +190,7 @@ impl Termios { /// Set the output communication speed. /// - /// Unlike the `c_ospeed` field in GLIBC and others, this takes the + /// Unlike the `c_ospeed` field in glibc and others, this takes the /// arbitrary integer value of the speed, rather than the `B*` encoded /// constant value. Not all implementations support all integer values; use /// the constants in the [`speed`] module for known-supported speeds.