Skip to content

Commit abd6e8e

Browse files
authored
Miscellaneous documentation cleanups. (#837)
1 parent 218a214 commit abd6e8e

5 files changed

Lines changed: 12 additions & 8 deletions

File tree

src/fs/fd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub fn tell<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
105105
backend::fs::syscalls::tell(fd.as_fd())
106106
}
107107

108-
/// `fchmod(fd)`—Sets open file or directory permissions.
108+
/// `fchmod(fd, mode)`—Sets open file or directory permissions.
109109
///
110110
/// This implementation does not support `O_PATH` file descriptors, even on
111111
/// platforms where the host libc emulates it.
@@ -122,7 +122,7 @@ pub fn fchmod<Fd: AsFd>(fd: Fd, mode: Mode) -> io::Result<()> {
122122
backend::fs::syscalls::fchmod(fd.as_fd(), mode)
123123
}
124124

125-
/// `fchown(fd)`—Sets open file or directory ownership.
125+
/// `fchown(fd, owner, group)`—Sets open file or directory ownership.
126126
///
127127
/// # References
128128
/// - [POSIX]

src/fs/statx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use compat::statx as _statx;
2828
/// # use std::io;
2929
/// # use rustix::fs::{AtFlags, StatxFlags};
3030
/// # use rustix::fd::BorrowedFd;
31-
/// /// Try to determine if the provided path is a mount root. Will return `Ok(None)` if
31+
/// /// Try to determine if the provided path is a mount root. Will return `Ok(None)` if
3232
/// /// the kernel is not new enough to support statx() or [`libc::STATX_ATTR_MOUNT_ROOT`].
3333
/// fn is_mountpoint(root: BorrowedFd<'_>, path: &Path) -> io::Result<Option<bool>> {
3434
/// use rustix::fs::{AtFlags, StatxFlags};

src/ioctl/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub unsafe trait Ioctl {
160160
/// making this `false` enables optimizations that can make the call
161161
/// faster. When in doubt, set this to `true`.
162162
///
163-
/// # SAFETY
163+
/// # Safety
164164
///
165165
/// This should only be set to `false` if the `ioctl` call does not mutate
166166
/// any data in the userspace. Undefined behavior may occur if this is

src/runtime.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
//! [origin].
33
//!
44
//! Do not use the functions in this module unless you've read all of their
5-
//! code, *and* you know all the relevant internal implementation details of
6-
//! any libc in the process they'll be used.
5+
//! code. They don't always behave the same way as functions with similar names
6+
//! in `libc`. Sometimes information about the differences is included in the
7+
//! Linux documentation under "C library/kernel differences" sections. And, if
8+
//! there is a libc in the process, these functions may have surprising
9+
//! interactions with it.
710
//!
811
//! These functions are for implementing thread-local storage (TLS), managing
912
//! threads, loaded libraries, and other process-wide resources. Most of
@@ -143,7 +146,7 @@ pub unsafe fn exit_thread(status: i32) -> ! {
143146
///
144147
/// This is equivalent to `_exit` and `_Exit` in libc.
145148
///
146-
/// This does not all any `__cxa_atexit`, `atexit`, or any other destructors.
149+
/// This does not call any `__cxa_atexit`, `atexit`, or any other destructors.
147150
/// Most programs should use [`std::process::exit`] instead of calling this
148151
/// directly.
149152
///

src/termios/tty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ fn _ttyname(dirfd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CString> {
5454
buffer.reserve(buffer.capacity() + 1); // use `Vec` reallocation strategy to grow capacity exponentially
5555
}
5656
Ok(len) => {
57-
// SAFETY: assume the backend returns the length of the string excluding the NUL.
57+
// SAFETY: assume the backend returns the length of the string excluding the
58+
// NUL.
5859
unsafe {
5960
buffer.set_len(len + 1);
6061
}

0 commit comments

Comments
 (0)