Skip to content

Commit ce11b6c

Browse files
authored
Miscellaneous documentation cleanups. (#887)
1 parent a59a191 commit ce11b6c

27 files changed

Lines changed: 95 additions & 98 deletions

File tree

src/backend/libc/fs/inotify.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,14 @@ pub fn inotify_init(flags: CreateFlags) -> io::Result<OwnedFd> {
9090
unsafe { ret_owned_fd(c::inotify_init1(bitflags_bits!(flags))) }
9191
}
9292

93-
/// `inotify_add_watch(self, path, flags)`—Adds a watch to inotify
93+
/// `inotify_add_watch(self, path, flags)`—Adds a watch to inotify.
9494
///
95-
/// This registers or updates a watch for the filesystem path `path`
96-
/// and returns a watch descriptor corresponding to this watch.
95+
/// This registers or updates a watch for the filesystem path `path` and
96+
/// returns a watch descriptor corresponding to this watch.
9797
///
98-
/// Note: Due to the existence of hardlinks, providing two
99-
/// different paths to this method may result in it returning
100-
/// the same watch descriptor. An application should keep track of this
101-
/// externally to avoid logic errors.
98+
/// Note: Due to the existence of hardlinks, providing two different paths to
99+
/// this method may result in it returning the same watch descriptor. An
100+
/// application should keep track of this externally to avoid logic errors.
102101
pub fn inotify_add_watch<P: crate::path::Arg>(
103102
inot: BorrowedFd<'_>,
104103
path: P,
@@ -117,7 +116,7 @@ pub fn inotify_add_watch<P: crate::path::Arg>(
117116
})
118117
}
119118

120-
/// `inotify_rm_watch(self, wd)`—Removes a watch from this inotify
119+
/// `inotify_rm_watch(self, wd)`—Removes a watch from this inotify.
121120
///
122121
/// The watch descriptor provided should have previously been returned by
123122
/// [`inotify_add_watch`] and not previously have been removed.

src/backend/libc/mm/syscalls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ pub(crate) unsafe fn userfaultfd(flags: UserfaultfdFlags) -> io::Result<OwnedFd>
225225

226226
/// Locks all pages mapped into the address space of the calling process.
227227
///
228-
/// This includes the pages of the code, data and stack segment, as well as
228+
/// This includes the pages of the code, data, and stack segment, as well as
229229
/// shared libraries, user space kernel data, shared memory, and memory-mapped
230230
/// files. All mapped pages are guaranteed to be resident in RAM when the call
231231
/// returns successfully; the pages are guaranteed to stay in RAM until later

src/backend/libc/mm/types.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,14 +453,13 @@ bitflags! {
453453
pub struct MlockAllFlags: u32 {
454454
// libc doesn't define `MCL_ONFAULT` yet.
455455
// const ONFAULT = libc::MCL_ONFAULT;
456-
/// Lock all pages which will become mapped into the address
457-
/// space of the process in the future. These could be, for
458-
/// instance, new pages required by a growing heap and stack
459-
/// as well as new memory-mapped files or shared memory
460-
/// regions.
456+
/// Lock all pages which will become mapped into the address space of
457+
/// the process in the future. These could be, for instance, new pages
458+
/// required by a growing heap and stack as well as new memory-mapped
459+
/// files or shared memory regions.
461460
const FUTURE = bitcast!(libc::MCL_FUTURE);
462-
/// Lock all pages which are currently mapped into the address
463-
/// space of the process.
461+
/// Lock all pages which are currently mapped into the address space of
462+
/// the process.
464463
const CURRENT = bitcast!(libc::MCL_CURRENT);
465464

466465
/// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>

src/backend/linux_raw/fs/inotify.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,12 @@ pub fn inotify_init(flags: CreateFlags) -> io::Result<OwnedFd> {
9292

9393
/// `inotify_add_watch(self, path, flags)`—Adds a watch to inotify.
9494
///
95-
/// This registers or updates a watch for the filesystem path `path`
96-
/// and returns a watch descriptor corresponding to this watch.
95+
/// This registers or updates a watch for the filesystem path `path` and
96+
/// returns a watch descriptor corresponding to this watch.
9797
///
98-
/// Note: Due to the existence of hardlinks, providing two
99-
/// different paths to this method may result in it returning
100-
/// the same watch descriptor. An application should keep track of this
101-
/// externally to avoid logic errors.
98+
/// Note: Due to the existence of hardlinks, providing two different paths to
99+
/// this method may result in it returning the same watch descriptor. An
100+
/// application should keep track of this externally to avoid logic errors.
102101
#[inline]
103102
pub fn inotify_add_watch<P: crate::path::Arg>(
104103
inot: BorrowedFd<'_>,

src/backend/linux_raw/io/errno.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl Errno {
6060
#[inline]
6161
pub fn from_io_error(io_err: &std::io::Error) -> Option<Self> {
6262
io_err.raw_os_error().and_then(|raw| {
63-
// `std::io::Error` could theoretically have arbitrary "OS error"
63+
// `std::io::Error` could theoretically have arbitrary OS error
6464
// values, so check that they're in Linux's range.
6565
if (1..4096).contains(&raw) {
6666
Some(Self::from_errno(raw as u32))

src/backend/linux_raw/mm/syscalls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ pub(crate) unsafe fn userfaultfd(flags: UserfaultfdFlags) -> io::Result<OwnedFd>
215215

216216
/// Locks all pages mapped into the address space of the calling process.
217217
///
218-
/// This includes the pages of the code, data and stack segment, as well as
218+
/// This includes the pages of the code, data, and stack segment, as well as
219219
/// shared libraries, user space kernel data, shared memory, and memory-mapped
220220
/// files. All mapped pages are guaranteed to be resident in RAM when the call
221221
/// returns successfully; the pages are guaranteed to stay in RAM until later

src/backend/linux_raw/mm/types.rs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ pub enum Advice {
240240
impl Advice {
241241
/// `POSIX_MADV_DONTNEED`
242242
///
243-
/// On Linux, this is mapped to `POSIX_MADV_NORMAL` because
244-
/// Linux's `MADV_DONTNEED` differs from `POSIX_MADV_DONTNEED`. See
245-
/// `LinuxDontNeed` for the Linux behavior.
243+
/// On Linux, this is mapped to `POSIX_MADV_NORMAL` because Linux's
244+
/// `MADV_DONTNEED` differs from `POSIX_MADV_DONTNEED`. See `LinuxDontNeed`
245+
/// for the Linux behavior.
246246
pub const DontNeed: Self = Self::Normal;
247247
}
248248

@@ -271,25 +271,23 @@ bitflags! {
271271
#[repr(transparent)]
272272
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
273273
pub struct MlockAllFlags: u32 {
274-
/// Used together with `MCL_CURRENT`, `MCL_FUTURE`, or both. Mark
275-
/// all current (with `MCL_CURRENT`) or future (with `MCL_FUTURE`)
276-
/// mappings to lock pages when they are faulted in. When
277-
/// used with `MCL_CURRENT`, all present pages are locked, but
278-
/// `mlockall()` will not fault in non-present pages. When used
279-
/// with `MCL_FUTURE`, all future mappings will be marked to
280-
/// lock pages when they are faulted in, but they will not be
281-
/// populated by the lock when the mapping is created.
282-
/// `MCL_ONFAULT` must be used with either `MCL_CURRENT` or
274+
/// Used together with `MCL_CURRENT`, `MCL_FUTURE`, or both. Mark all
275+
/// current (with `MCL_CURRENT`) or future (with `MCL_FUTURE`) mappings
276+
/// to lock pages when they are faulted in. When used with
277+
/// `MCL_CURRENT`, all present pages are locked, but `mlockall` will
278+
/// not fault in non-present pages. When used with `MCL_FUTURE`, all
279+
/// future mappings will be marked to lock pages when they are faulted
280+
/// in, but they will not be populated by the lock when the mapping is
281+
/// created. `MCL_ONFAULT` must be used with either `MCL_CURRENT` or
283282
/// `MCL_FUTURE` or both.
284283
const ONFAULT = linux_raw_sys::general::MCL_ONFAULT;
285-
/// Lock all pages which will become mapped into the address
286-
/// space of the process in the future. These could be, for
287-
/// instance, new pages required by a growing heap and stack
288-
/// as well as new memory-mapped files or shared memory
289-
/// regions.
284+
/// Lock all pages which will become mapped into the address space of
285+
/// the process in the future. These could be, for instance, new pages
286+
/// required by a growing heap and stack as well as new memory-mapped
287+
/// files or shared memory regions.
290288
const FUTURE = linux_raw_sys::general::MCL_FUTURE;
291-
/// Lock all pages which are currently mapped into the address
292-
/// space of the process.
289+
/// Lock all pages which are currently mapped into the address space of
290+
/// the process.
293291
const CURRENT = linux_raw_sys::general::MCL_CURRENT;
294292

295293
/// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>

src/backend/linux_raw/param/auxv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ unsafe fn init_from_aux_iter(aux_iter: impl Iterator<Item = Elf_auxv_t>) -> Opti
337337
#[cfg(feature = "runtime")]
338338
assert_eq!(phent, size_of::<Elf_Phdr>());
339339

340-
// If we're running set-uid or set-gid, enable "secure execution" mode,
340+
// If we're running set-uid or set-gid, enable secure execution mode,
341341
// which doesn't do much, but users may be depending on the things that
342342
// it does do.
343343
#[cfg(feature = "runtime")]

src/backend/linux_raw/process/syscalls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub(crate) fn getpgrp() -> Pid {
141141
#[inline]
142142
pub(crate) fn sched_getaffinity(pid: Option<Pid>, cpuset: &mut RawCpuSet) -> io::Result<()> {
143143
unsafe {
144-
// The raw linux syscall returns the size (in bytes) of the `cpumask_t`
144+
// The raw Linux syscall returns the size (in bytes) of the `cpumask_t`
145145
// data type that is used internally by the kernel to represent the CPU
146146
// set bit mask.
147147
let size = ret_usize(syscall!(

src/backend/linux_raw/termios/syscalls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ pub(crate) fn ttyname(fd: BorrowedFd<'_>, buf: &mut [MaybeUninit<u8>]) -> io::Re
278278
// Check that `fd` is really a tty.
279279
tcgetwinsize(fd)?;
280280

281-
// Get a fd to '/proc/self/fd'.
281+
// Get a fd to "/proc/self/fd".
282282
let proc_self_fd = procfs::proc_self_fd()?;
283283

284284
// Gather the ttyname by reading the "fd" file inside `proc_self_fd`.

0 commit comments

Comments
 (0)