Skip to content

Commit

Permalink
Miscellaneous documentation cleanups. (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode authored Sep 19, 2023
1 parent 218a214 commit abd6e8e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/fs/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn tell<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
backend::fs::syscalls::tell(fd.as_fd())
}

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

/// `fchown(fd)`—Sets open file or directory ownership.
/// `fchown(fd, owner, group)`—Sets open file or directory ownership.
///
/// # References
/// - [POSIX]
Expand Down
2 changes: 1 addition & 1 deletion src/fs/statx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use compat::statx as _statx;
/// # use std::io;
/// # use rustix::fs::{AtFlags, StatxFlags};
/// # use rustix::fd::BorrowedFd;
/// /// Try to determine if the provided path is a mount root. Will return `Ok(None)` if
/// /// Try to determine if the provided path is a mount root. Will return `Ok(None)` if
/// /// the kernel is not new enough to support statx() or [`libc::STATX_ATTR_MOUNT_ROOT`].
/// fn is_mountpoint(root: BorrowedFd<'_>, path: &Path) -> io::Result<Option<bool>> {
/// use rustix::fs::{AtFlags, StatxFlags};
Expand Down
2 changes: 1 addition & 1 deletion src/ioctl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub unsafe trait Ioctl {
/// making this `false` enables optimizations that can make the call
/// faster. When in doubt, set this to `true`.
///
/// # SAFETY
/// # Safety
///
/// This should only be set to `false` if the `ioctl` call does not mutate
/// any data in the userspace. Undefined behavior may occur if this is
Expand Down
9 changes: 6 additions & 3 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
//! [origin].
//!
//! Do not use the functions in this module unless you've read all of their
//! code, *and* you know all the relevant internal implementation details of
//! any libc in the process they'll be used.
//! code. They don't always behave the same way as functions with similar names
//! in `libc`. Sometimes information about the differences is included in the
//! Linux documentation under "C library/kernel differences" sections. And, if
//! there is a libc in the process, these functions may have surprising
//! interactions with it.
//!
//! These functions are for implementing thread-local storage (TLS), managing
//! threads, loaded libraries, and other process-wide resources. Most of
Expand Down Expand Up @@ -143,7 +146,7 @@ pub unsafe fn exit_thread(status: i32) -> ! {
///
/// This is equivalent to `_exit` and `_Exit` in libc.
///
/// This does not all any `__cxa_atexit`, `atexit`, or any other destructors.
/// This does not call any `__cxa_atexit`, `atexit`, or any other destructors.
/// Most programs should use [`std::process::exit`] instead of calling this
/// directly.
///
Expand Down
3 changes: 2 additions & 1 deletion src/termios/tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ fn _ttyname(dirfd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CString> {
buffer.reserve(buffer.capacity() + 1); // use `Vec` reallocation strategy to grow capacity exponentially
}
Ok(len) => {
// SAFETY: assume the backend returns the length of the string excluding the NUL.
// SAFETY: assume the backend returns the length of the string excluding the
// NUL.
unsafe {
buffer.set_len(len + 1);
}
Expand Down

0 comments on commit abd6e8e

Please sign in to comment.