Skip to content

Commit 704611a

Browse files
authored
Miscellaneous documentation cleanups. (#967)
1 parent 287509b commit 704611a

File tree

27 files changed

+136
-131
lines changed

27 files changed

+136
-131
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = [
55
"Dan Gohman <dev@sunfishcode.online>",
66
"Jakub Konka <kubkon@jakubkonka.com>",
77
]
8-
description = "Safe Rust bindings to POSIX/Unix/Linux/Winsock2-like syscalls"
8+
description = "Safe Rust bindings to POSIX/Unix/Linux/Winsock-like syscalls"
99
documentation = "https://docs.rs/rustix"
1010
license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT"
1111
repository = "https://github.com/bytecodealliance/rustix"
@@ -55,7 +55,7 @@ libc = { version = "0.2.150", default-features = false, features = ["extra_trait
5555
[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]
5656
linux-raw-sys = { version = "0.4.11", default-features = false, features = ["general", "ioctl", "no_std"] }
5757

58-
# For the libc backend on Windows, use the Winsock2 API in windows-sys.
58+
# For the libc backend on Windows, use the Winsock API in windows-sys.
5959
[target.'cfg(windows)'.dependencies.windows-sys]
6060
version = "0.52.0"
6161
features = [

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h1><code>rustix</code></h1>
33

44
<p>
5-
<strong>Safe Rust bindings to POSIX/Unix/Linux/Winsock2 syscalls</strong>
5+
<strong>Safe Rust bindings to POSIX/Unix/Linux/Winsock syscalls</strong>
66
</p>
77

88
<strong>A <a href="https://bytecodealliance.org/">Bytecode Alliance</a> project</strong>
@@ -16,17 +16,17 @@
1616
</div>
1717

1818
`rustix` provides efficient memory-safe and [I/O-safe] wrappers to POSIX-like,
19-
Unix-like, Linux, and Winsock2 syscall-like APIs, with configurable backends.
19+
Unix-like, Linux, and Winsock syscall-like APIs, with configurable backends.
2020
It uses Rust references, slices, and return values instead of raw pointers, and
2121
[I/O safety types] instead of raw file descriptors, providing memory safety,
2222
[I/O safety], and [provenance]. It uses `Result`s for reporting errors,
2323
[`bitflags`] instead of bare integer flags, an [`Arg`] trait with optimizations
2424
to efficiently accept any Rust string type, and several other efficient
2525
conveniences.
2626

27-
`rustix` is low-level and, and while the `net` API supports Winsock2 on
28-
Windows, the rest of the APIs do not support Windows; for higher-level and more
29-
portable APIs built on this functionality, see the [`cap-std`], [`memfd`],
27+
`rustix` is low-level and, and while the `net` API supports [Windows Sockets 2]
28+
(Winsock), the rest of the APIs do not support Windows; for higher-level and
29+
more portable APIs built on this functionality, see the [`cap-std`], [`memfd`],
3030
[`timerfd`], and [`io-streams`] crates, for example.
3131

3232
`rustix` currently has two backends available:
@@ -42,7 +42,7 @@ portable APIs built on this functionality, see the [`cap-std`], [`memfd`],
4242
provenance all the way down to the syscalls.
4343

4444
* libc, which uses the [`libc`] crate which provides bindings to native `libc`
45-
libraries on Unix-family platforms, and [`windows-sys`] for Winsock2 on
45+
libraries on Unix-family platforms, and [`windows-sys`] for Winsock on
4646
Windows, and is portable to many OS's.
4747

4848
The linux_raw backend is enabled by default on platforms which support it. To
@@ -165,6 +165,7 @@ always reflect “very old” Linux versions.
165165
[any current Rust target]: https://doc.rust-lang.org/nightly/rustc/platform-support.html
166166
[kernel.org]: https://www.kernel.org/releases.html
167167
[Rust on Debian stable]: https://packages.debian.org/stable/rust/rustc
168+
[Windows Sockets 2]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-start-page-2
168169
[`nix`]: https://crates.io/crates/nix
169170
[`unix`]: https://crates.io/crates/unix
170171
[`nc`]: https://crates.io/crates/nc

src/backend/libc/fs/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ bitflags! {
159159
#[cfg(not(target_os = "espidf"))]
160160
impl Mode {
161161
/// Construct a `Mode` from the mode bits of the `st_mode` field of a
162-
/// `Stat`.
162+
/// `Mode`.
163163
#[inline]
164164
pub const fn from_raw_mode(st_mode: RawMode) -> Self {
165165
Self::from_bits_truncate(st_mode)
166166
}
167167

168-
/// Construct an `st_mode` value from `Stat`.
168+
/// Construct an `st_mode` value from a `Mode`.
169169
#[inline]
170170
pub const fn as_raw_mode(self) -> RawMode {
171171
self.bits()
@@ -503,7 +503,7 @@ impl FileType {
503503
}
504504
}
505505

506-
/// Construct an `st_mode` value from `Stat`.
506+
/// Construct an `st_mode` value from a `FileType`.
507507
#[inline]
508508
pub const fn as_raw_mode(self) -> RawMode {
509509
match self {

src/backend/libc/io/errno.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use libc_errno::errno;
1414
/// # References
1515
/// - [POSIX]
1616
/// - [Linux]
17-
/// - [Winsock2]
17+
/// - [Winsock]
1818
/// - [FreeBSD]
1919
/// - [NetBSD]
2020
/// - [OpenBSD]
@@ -24,7 +24,7 @@ use libc_errno::errno;
2424
///
2525
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html
2626
/// [Linux]: https://man7.org/linux/man-pages/man3/errno.3.html
27-
/// [Winsock2]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2
27+
/// [Winsock]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2
2828
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?errno
2929
/// [NetBSD]: https://man.netbsd.org/errno.2
3030
/// [OpenBSD]: https://man.openbsd.org/errno.2

src/backend/libc/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! The libc backend.
22
//!
33
//! On most platforms, this uses the `libc` crate to make system calls. On
4-
//! Windows, this uses the Winsock2 API in `windows-sys`, which can be adapted
4+
//! Windows, this uses the Winsock API in `windows-sys`, which can be adapted
55
//! to have a very `libc`-like interface.
66
77
// Every FFI call requires an unsafe block, and there are a lot of FFI
@@ -21,11 +21,11 @@ pub(crate) mod fd {
2121
};
2222
pub(crate) use windows_sys::Win32::Networking::WinSock::SOCKET as LibcFd;
2323

24-
/// A version of [`AsRawFd`] for use with Winsock2 API.
24+
/// A version of [`AsRawFd`] for use with Winsock API.
2525
///
2626
/// [`AsRawFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.AsRawFd.html
2727
pub trait AsRawFd {
28-
/// A version of [`as_raw_fd`] for use with Winsock2 API.
28+
/// A version of [`as_raw_fd`] for use with Winsock API.
2929
///
3030
/// [`as_raw_fd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html#tymethod.as_raw_fd
3131
fn as_raw_fd(&self) -> RawFd;
@@ -37,11 +37,11 @@ pub(crate) mod fd {
3737
}
3838
}
3939

40-
/// A version of [`IntoRawFd`] for use with Winsock2 API.
40+
/// A version of [`IntoRawFd`] for use with Winsock API.
4141
///
4242
/// [`IntoRawFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.IntoRawFd.html
4343
pub trait IntoRawFd {
44-
/// A version of [`into_raw_fd`] for use with Winsock2 API.
44+
/// A version of [`into_raw_fd`] for use with Winsock API.
4545
///
4646
/// [`into_raw_fd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html#tymethod.into_raw_fd
4747
fn into_raw_fd(self) -> RawFd;
@@ -53,11 +53,11 @@ pub(crate) mod fd {
5353
}
5454
}
5555

56-
/// A version of [`FromRawFd`] for use with Winsock2 API.
56+
/// A version of [`FromRawFd`] for use with Winsock API.
5757
///
5858
/// [`FromRawFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html
5959
pub trait FromRawFd {
60-
/// A version of [`from_raw_fd`] for use with Winsock2 API.
60+
/// A version of [`from_raw_fd`] for use with Winsock API.
6161
///
6262
/// # Safety
6363
///
@@ -74,11 +74,11 @@ pub(crate) mod fd {
7474
}
7575
}
7676

77-
/// A version of [`AsFd`] for use with Winsock2 API.
77+
/// A version of [`AsFd`] for use with Winsock API.
7878
///
7979
/// [`AsFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.AsFd.html
8080
pub trait AsFd {
81-
/// An `as_fd` function for Winsock2, where a `Fd` is a `Socket`.
81+
/// An `as_fd` function for Winsock, where a `Fd` is a `Socket`.
8282
fn as_fd(&self) -> BorrowedFd;
8383
}
8484
impl<T: AsSocket> AsFd for T {

src/backend/libc/mount/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ bitflags! {
227227
/// `MOVE_MOUNT__MASK`
228228
const MOVE_MOUNT_SET_GROUP = 0x0000_0100;
229229

230-
// TODO: add when linux 6.5 is released
230+
// TODO: add when Linux 6.5 is released
231231
// /// `MOVE_MOUNT_BENEATH`
232232
// const MOVE_MOUNT_BENEATH = 0x0000_0200;
233233

src/backend/libc/pipe/types.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@ bitflags! {
5353
}
5454
}
5555

56-
/// A buffer type used with `vmsplice`.
56+
/// A buffer type for use with [`vmsplice`].
5757
///
5858
/// It is guaranteed to be ABI compatible with the iovec type on Unix platforms
5959
/// and `WSABUF` on Windows. Unlike `IoSlice` and `IoSliceMut` it is
6060
/// semantically like a raw pointer, and therefore can be shared or mutated as
6161
/// needed.
62+
///
63+
/// [`vmsplice`]: crate::pipe::vmsplice
6264
#[cfg(linux_kernel)]
6365
#[repr(transparent)]
6466
pub struct IoSliceRaw<'a> {

src/backend/libc/pty/syscalls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub(crate) fn ptsname(fd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CSt
5858
}
5959
};
6060

61-
// MacOS 10.13.4 has `ptsname_r`; use it if we have it, otherwise fall
61+
// macOS 10.13.4 has `ptsname_r`; use it if we have it, otherwise fall
6262
// back to calling the underlying ioctl directly.
6363
#[cfg(apple)]
6464
let r = unsafe {

src/backend/libc/winsock_c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Adapt the Winsock2 API to resemble a POSIX-style libc API.
1+
//! Adapt the Winsock API to resemble a POSIX-style libc API.
22
33
#![allow(unused_imports)]
44
#![allow(non_camel_case_types)]

src/backend/linux_raw/event/epoll.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Linx `epoll` support.
1+
//! Linux `epoll` support.
22
//!
33
//! # Examples
44
//!
@@ -160,8 +160,8 @@ pub fn create(flags: CreateFlags) -> io::Result<OwnedFd> {
160160
syscalls::epoll_create(flags)
161161
}
162162

163-
/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an
164-
/// epoll object.
163+
/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an epoll
164+
/// object.
165165
///
166166
/// This registers interest in any of the events set in `events` occurring on
167167
/// the file descriptor associated with `data`.

0 commit comments

Comments
 (0)