Skip to content

Commit 907ed38

Browse files
authored
Miscellaneous documentaion cleanups. (#1343)
- Update documentation links to Linux 6.13. - Use shorter forms of docs.rs links. - Fix typos in comments. - Update some maybe_polyfill comments to match upstream. - Comment formatting. - Update io_uring documentation links to point to man7.org. - Add some useful docs. - Tidying the not_implmented docs. - Fix a doc link in CHANGES.md. - Add doc aliases.
1 parent e48b93c commit 907ed38

39 files changed

Lines changed: 193 additions & 168 deletions

CHANGES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ constant.
4646
`rustix::process::WaitidOptions` and `rustix::process::WaitidStatus` are
4747
renamed to
4848
[`rustix::process::WaitIdOptions`] and [`rustix::process::WaitIdStatus`] (note
49-
the capitalization), for consistency with [`crate::process::WaitId`].
49+
the capitalization), for consistency with [`rustix::process::WaitId`].
5050

5151
[`rustix::process::WaitIdOptions`]: https://docs.rs/rustix/1.0.0/rustix/process/struct.WaitIdOptions.html
5252
[`rustix::process::WaitIdStatus`]: https://docs.rs/rustix/1.0.0/rustix/process/struct.WaitIdStatus.html
@@ -198,7 +198,7 @@ be used in place of `mount2`, and `mount2` is now removed.
198198
The [`rustix::net`] functions ending with `_v4`, `_v6`, `_unix` and `_xdp` have
199199
been merged into a single function that accepts any address type.
200200

201-
Specically, the following functions are removed:
201+
Specifically, the following functions are removed:
202202

203203
* `bind_any`, `bind_unix`, `bind_v4`, `bind_v6`, `bind_xdp` in favor of
204204
[`bind`],

src/backend/libc/c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub(crate) const XCASE: tcflag_t = linux_raw_sys::general::XCASE as _;
8787
pub(crate) const MSG_DONTWAIT: c_int = MSG_NONBLOCK;
8888

8989
// `O_LARGEFILE` can be automatically set by the kernel on Linux:
90-
// <https://github.com/torvalds/linux/blob/v6.7/fs/open.c#L1458-L1459>
90+
// <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/open.c?h=v6.13#n1423>
9191
// so libc implementations may leave it undefined or defined to zero.
9292
#[cfg(linux_kernel)]
9393
pub(crate) const O_LARGEFILE: c_int = linux_raw_sys::general::O_LARGEFILE as _;

src/backend/libc/event/syscalls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ pub(crate) fn epoll_wait(
575575
.map(|i| i as usize)
576576
}
577577

578-
// Othewise just use `epoll_wait`.
578+
// Otherwise just use `epoll_wait`.
579579
#[cfg(not(all(linux_kernel, feature = "linux_5_11")))]
580580
unsafe {
581581
let timeout = match timeout {

src/backend/libc/fs/dir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ impl Dir {
137137

138138
/// `seekdir(self, offset)`
139139
///
140-
/// This function iso only available on 64-bit platforms because it's
140+
/// This function is only available on 64-bit platforms because it's
141141
/// implemented using [`libc::seekdir`] which only supports offsets that
142142
/// fit in a `c_long`.
143143
///
144-
/// [`libc::seekdir`]: https://docs.rs/libc/latest/arm-unknown-linux-gnueabihf/libc/fn.seekdir.html
144+
/// [`libc::seekdir`]: https://docs.rs/libc/*/arm-unknown-linux-gnueabihf/libc/fn.seekdir.html
145145
#[cfg(target_pointer_width = "64")]
146146
#[cfg_attr(docsrs, doc(cfg(target_pointer_width = "64")))]
147147
#[doc(alias = "seekdir")]

src/backend/libc/fs/syscalls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,9 +1251,9 @@ pub(crate) fn fadvise(
12511251
}
12521252
}
12531253

1254-
// Similarly, on FreeBSD, if `offset + len` would overflow an `off_t` in
1255-
// a way that users using a `u64` interface wouldn't be aware of, reduce
1256-
// the length so that we only operate on the range that doesn't overflow.
1254+
// Similarly, on FreeBSD, if `offset + len` would overflow an `off_t` in a
1255+
// way that users using a `u64` interface wouldn't be aware of, reduce the
1256+
// length so that we only operate on the range that doesn't overflow.
12571257
#[cfg(target_os = "freebsd")]
12581258
let len = if len > 0 && offset.checked_add(len).is_none() {
12591259
i64::MAX - offset

src/backend/libc/net/addr.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,17 +236,18 @@ impl fmt::Debug for SocketAddrUnix {
236236
}
237237
}
238238

239-
/// `struct sockaddr_storage`.
239+
/// `struct sockaddr_storage`
240240
///
241241
/// This type is guaranteed to be large enough to hold any encoded socket
242242
/// address.
243243
#[repr(transparent)]
244244
#[derive(Copy, Clone)]
245+
#[doc(alias = "sockaddr_storage")]
245246
pub struct SocketAddrStorage(c::sockaddr_storage);
246247

247248
impl SocketAddrStorage {
248249
/// Return a socket addr storage initialized to all zero bytes. The
249-
/// `sa_family` is set to `AddressFamily::UNSPEC`.
250+
/// `sa_family` is set to [`AddressFamily::UNSPEC`].
250251
pub fn zeroed() -> Self {
251252
assert_eq!(c::AF_UNSPEC, 0);
252253
// SAFETY: `sockaddr_storage` is meant to be zero-initializable.
@@ -264,7 +265,7 @@ impl SocketAddrStorage {
264265
}
265266

266267
/// Clear the `sa_family` of this socket address to
267-
/// `AddressFamily::UNSPEC`.
268+
/// [`AddressFamily::UNSPEC`].
268269
pub fn clear_family(&mut self) {
269270
// SAFETY: `self.0` is a `sockaddr_storage` so it has enough space.
270271
unsafe {

src/backend/linux_raw/fs/dir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ impl Dir {
8181

8282
/// `seekdir(self, offset)`
8383
///
84-
/// This function iso only available on 64-bit platforms because it's
84+
/// This function is only available on 64-bit platforms because it's
8585
/// implemented using [`libc::seekdir`] which only supports offsets that
8686
/// fit in a `c_long`.
8787
///
88-
/// [`libc::seekdir`]: https://docs.rs/libc/latest/arm-unknown-linux-gnueabihf/libc/fn.seekdir.html
88+
/// [`libc::seekdir`]: https://docs.rs/libc/*/arm-unknown-linux-gnueabihf/libc/fn.seekdir.html
8989
// In the linux_raw backend here, we don't use `libc::seekdir` and don't
9090
// have this limitation, but it's a goal of rustix to support the same API
9191
// on both the linux_raw and libc backends.

src/backend/linux_raw/fs/syscalls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ pub(crate) fn tell(fd: BorrowedFd<'_>) -> io::Result<u64> {
287287

288288
#[inline]
289289
pub(crate) fn ftruncate(fd: BorrowedFd<'_>, length: u64) -> io::Result<()> {
290-
// <https://github.com/torvalds/linux/blob/fcadab740480e0e0e9fa9bd272acd409884d431a/arch/arm64/kernel/sys32.c#L81-L83>
290+
// <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/sys32.c?h=v6.13#n89>
291291
#[cfg(all(
292292
target_pointer_width = "32",
293293
any(

src/backend/linux_raw/fs/types.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ bitflags! {
197197
/// `O_DIRECTORY`
198198
const DIRECTORY = linux_raw_sys::general::O_DIRECTORY;
199199

200-
/// `O_DSYNC`.
200+
/// `O_DSYNC`
201201
const DSYNC = linux_raw_sys::general::O_SYNC;
202202

203203
/// `O_EXCL`
204204
const EXCL = linux_raw_sys::general::O_EXCL;
205205

206-
/// `O_FSYNC`.
206+
/// `O_FSYNC`
207207
const FSYNC = linux_raw_sys::general::O_SYNC;
208208

209209
/// `O_NOFOLLOW`
@@ -226,7 +226,7 @@ bitflags! {
226226
/// `O_NOCTTY`
227227
const NOCTTY = linux_raw_sys::general::O_NOCTTY;
228228

229-
/// `O_RSYNC`.
229+
/// `O_RSYNC`
230230
const RSYNC = linux_raw_sys::general::O_SYNC;
231231

232232
/// `O_SYNC`
@@ -252,7 +252,7 @@ bitflags! {
252252

253253
/// `O_LARGEFILE`
254254
///
255-
/// Tustix and/or libc will automatically set this flag when
255+
/// Rustix and/or libc will automatically set this flag when
256256
/// appropriate in the [`rustix::fs::open`] family of functions, so
257257
/// typical users do not need to care about it. It may be reported in
258258
/// the return of `fcntl_getfl`, though.
@@ -486,13 +486,13 @@ bitflags! {
486486
#[repr(transparent)]
487487
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
488488
pub struct SealFlags: u32 {
489-
/// `F_SEAL_SEAL`.
489+
/// `F_SEAL_SEAL`
490490
const SEAL = linux_raw_sys::general::F_SEAL_SEAL;
491-
/// `F_SEAL_SHRINK`.
491+
/// `F_SEAL_SHRINK`
492492
const SHRINK = linux_raw_sys::general::F_SEAL_SHRINK;
493-
/// `F_SEAL_GROW`.
493+
/// `F_SEAL_GROW`
494494
const GROW = linux_raw_sys::general::F_SEAL_GROW;
495-
/// `F_SEAL_WRITE`.
495+
/// `F_SEAL_WRITE`
496496
const WRITE = linux_raw_sys::general::F_SEAL_WRITE;
497497
/// `F_SEAL_FUTURE_WRITE` (since Linux 5.1)
498498
const FUTURE_WRITE = linux_raw_sys::general::F_SEAL_FUTURE_WRITE;

src/backend/linux_raw/io/errno.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ impl Errno {
349349
pub const ILSEQ: Self = Self::from_errno(errno::EILSEQ);
350350
/// `EINPROGRESS`
351351
pub const INPROGRESS: Self = Self::from_errno(errno::EINPROGRESS);
352-
/// `EINTR`.
352+
/// `EINTR`
353353
///
354354
/// For a convenient way to retry system calls that exit with `INTR`, use
355355
/// [`retry_on_intr`].

0 commit comments

Comments
 (0)