Skip to content

Commit 592fea1

Browse files
authored
Miscellaneous documentation fixes. (#1144)
* Miscellaneous documentation fixes. * More miscellaneous documentation fixes.
1 parent 629de02 commit 592fea1

File tree

15 files changed

+33
-42
lines changed

15 files changed

+33
-42
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
</div>
1717

1818
`rustix` provides efficient memory-safe and [I/O-safe] wrappers to POSIX-like,
19-
Unix-like, Linux, and Winsock syscall-like APIs, with configurable backends.
20-
It uses Rust references, slices, and return values instead of raw pointers, and
19+
Unix-like, Linux, and Winsock syscall-like APIs, with configurable backends. It
20+
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
@@ -46,14 +46,14 @@ more portable APIs built on this functionality, see the [`cap-std`], [`memfd`],
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
49-
enable the libc backend instead, either enable the "use-libc" cargo feature,
50-
or set the `RUSTFLAGS` environment variable to `--cfg=rustix_use_libc` when
49+
enable the libc backend instead, either enable the "use-libc" cargo feature, or
50+
set the `RUSTFLAGS` environment variable to `--cfg=rustix_use_libc` when
5151
building.
5252

5353
## Cargo features
5454

55-
The modules [`rustix::io`], [`rustix::fd`], and [`rustix::ffi`] are enabled
56-
by default. The rest of the API is conditional with cargo feature flags:
55+
The modules [`rustix::io`], [`rustix::fd`], and [`rustix::ffi`] are enabled by
56+
default. The rest of the API is conditional with cargo feature flags:
5757

5858
| Name | Description |
5959
| ---------- | -------------------------------------------------------------- |

src/backend/libc/fs/inotify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! inotify support for working with inotifies
1+
//! inotify support for working with inotify objects.
22
33
use crate::backend::c;
44
use bitflags::bitflags;

src/backend/linux_raw/fs/inotify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! inotify support for working with inotifies
1+
//! inotify support for working with inotify objects.
22
33
use crate::backend::c;
44
use bitflags::bitflags;

src/backend/linux_raw/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! # Safety
66
//!
77
//! These files performs raw system calls, and sometimes passes them
8-
//! uninitialized memory buffers. The signatures in this file are currently
8+
//! uninitialized memory buffers. The signatures in this module are currently
99
//! manually maintained and must correspond with the signatures of the actual
1010
//! Linux syscalls.
1111
//!

src/fs/at.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::R
110110
}
111111

112112
// SAFETY:
113-
// - “readlink places the contents of the symbolic link pathname in
114-
// the buffer buf”
115-
// - [POSIX definition 3.271: Pathname]: “A string that is used to
116-
// identify a file.”
113+
// - “readlink places the contents of the symbolic link pathname
114+
// in the buffer buf”
115+
// - [POSIX definition 3.271: Pathname]: “A string that is used
116+
// to identify a file.”
117117
// - [POSIX definition 3.375: String]: “A contiguous sequence of
118118
// bytes terminated by and including the first null byte.”
119119
// - “readlink does not append a terminating null byte to buf.”

src/fs/inotify.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! inotify support for working with inotifies
1+
//! inotify support for working with inotify objects.
22
//!
33
//! # Examples
44
//!
@@ -9,7 +9,7 @@
99
//!
1010
//! # fn test() -> io::Result<()> {
1111
//! // Create an inotify object. In this example, we use `NONBLOCK` so that the
12-
//! // reader fails with `WOULDBLOCk` when no events are ready. Otherwise it
12+
//! // reader fails with `WOULDBLOCK` when no events are ready. Otherwise it
1313
//! // will block until at least one event is ready.
1414
//! let inotify = inotify::init(inotify::CreateFlags::NONBLOCK)?;
1515
//!
@@ -200,7 +200,7 @@ impl<'buf, Fd: AsFd> Reader<'buf, Fd> {
200200
// - This data is initialized by the check above.
201201
// - Assumption: the kernel will not give us partial structs.
202202
// - Assumption: the kernel uses proper alignment between structs.
203-
// - The starting pointer is aligned (performed in RawDir::new)
203+
// - The starting pointer is aligned (performed in `Reader::new`).
204204
let event = unsafe { &*ptr.cast::<inotify_event>() };
205205

206206
self.offset += size_of::<inotify_event>() + usize::try_from(event.len).unwrap();

src/fs/raw_dir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl<'buf, Fd: AsFd> RawDir<'buf, Fd> {
213213
// - This data is initialized by the check above.
214214
// - Assumption: the kernel will not give us partial structs.
215215
// - Assumption: the kernel uses proper alignment between structs.
216-
// - The starting pointer is aligned (performed in RawDir::new)
216+
// - The starting pointer is aligned (performed in `RawDir::new`).
217217
let dirent = unsafe { &*dirent_ptr.cast::<linux_dirent64>() };
218218

219219
self.offset += usize::from(dirent.d_reclen);

src/io/read_write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! `read` and `write`, optionally positioned, optionally vectored
1+
//! `read` and `write`, optionally positioned, optionally vectored.
22
33
#![allow(unsafe_code)]
44

src/process/chdir.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ fn _getcwd(mut buffer: Vec<u8>) -> io::Result<CString> {
7373
}
7474
Ok(_) => {
7575
// SAFETY:
76-
// - "These functions return a null-terminated string"
77-
// - [POSIX definition 3.375: String]: "A contiguous sequence
78-
// of bytes terminated by and including the first null byte."
76+
// - These functions return a null-terminated string
77+
// - [POSIX definition 3.375: String]: A contiguous sequence
78+
// of bytes terminated by and including the first null byte.
7979
//
8080
// Thus, there will be a single NUL byte at the end of the
8181
// string.

src/process/id.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,8 @@ use alloc::vec::Vec;
1313
#[cfg(linux_kernel)]
1414
use backend::process::types::RawCpuid;
1515

16-
/// The raw integer value of a Unix user ID.
17-
pub use crate::ugid::RawUid;
18-
19-
/// The raw integer value of a Unix group ID.
20-
pub use crate::ugid::RawGid;
21-
22-
/// The raw integer value of a Unix process ID.
23-
pub use crate::pid::RawPid;
24-
25-
pub use crate::pid::Pid;
26-
pub use crate::ugid::{Gid, Uid};
16+
pub use crate::pid::{Pid, RawPid};
17+
pub use crate::ugid::{Gid, RawGid, RawUid, Uid};
2718

2819
/// A Linux CPU ID.
2920
#[cfg(linux_kernel)]

0 commit comments

Comments
 (0)