Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ caps = "0.5.3"
sysctl = "0.4"

[build-dependencies]
cfg_aliases = "0.2.1"
cfg_aliases = "0.2.2"

[[test]]
name = "test"
Expand All @@ -107,3 +107,7 @@ path = "test/test_clearenv.rs"
[[test]]
name = "test-prctl"
path = "test/sys/test_prctl.rs"

[patch.crates-io]
bitflags = { git = "https://github.com/bitflags/bitflags", rev = "4a70da889f212c13244a0d64cbb1b627e12c59e1" }
libc = { git = "https://github.com/rust-lang/libc", branch = "libc-0.2" }
Comment thread
xtqqczze marked this conversation as resolved.
9 changes: 4 additions & 5 deletions src/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ use crate::Result;

/// This is a wrapper around `libc::pollfd`.
///
/// It's meant to be used as an argument to the [`poll`](fn.poll.html) and
/// [`ppoll`](fn.ppoll.html) functions to specify the events of interest
/// for a specific file descriptor.
/// It's meant to be used as an argument to the [`poll`] and `ppoll` functions
/// to specify the events of interest for a specific file descriptor.
///
/// After a call to `poll` or `ppoll`, the events that occurred can be retrieved by calling
/// [`revents()`](#method.revents) on the `PollFd` object from the array passed to `poll`.
Expand All @@ -34,7 +33,7 @@ impl<'fd> PollFd<'fd> {
/// let (r, w) = pipe().unwrap();
/// let pfd = PollFd::new(r.as_fd(), PollFlags::POLLIN);
/// ```
/// These are placed in an array and passed to [`poll`] or [`ppoll`](fn.ppoll.html).
/// These are placed in an array and passed to [`poll`] or `ppoll`.
// Unlike I/O functions, constructors like this must take `BorrowedFd`
// instead of AsFd or &AsFd. Otherwise, an `OwnedFd` argument would be
// dropped at the end of the method, leaving the structure referencing a
Expand Down Expand Up @@ -176,7 +175,7 @@ libc_bitflags! {
/// `poll` waits for one of a set of file descriptors to become ready to perform I/O.
/// ([`poll(2)`](https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html))
///
/// `fds` contains all [`PollFd`](struct.PollFd.html) to poll.
/// `fds` contains all [`PollFd`] to poll.
/// The function will return as soon as any event occur for any of these `PollFd`s.
///
/// The `timeout` argument specifies the number of milliseconds that `poll()`
Expand Down
21 changes: 10 additions & 11 deletions src/sys/aio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@
//! platform support. Completion
//! notifications can optionally be delivered via
//! [signals](../signal/enum.SigevNotify.html#variant.SigevSignal), via the
//! [`aio_suspend`](fn.aio_suspend.html) function, or via polling. Some
//! platforms support other completion
//! notifications, such as
//! [`aio_suspend`] function, or via polling. Some platforms support other
//! completion notifications, such as
//! [kevent](../signal/enum.SigevNotify.html#variant.SigevKevent).
//!
//! Multiple operations may be submitted in a batch with
//! [`lio_listio`](fn.lio_listio.html), though the standard does not guarantee
//! that they will be executed atomically.
//! [`lio_listio`], though the standard does not guarantee that they will be
//! executed atomically.
//!
//! Outstanding operations may be cancelled with
//! [`cancel`](trait.Aio.html#method.cancel) or
//! [`aio_cancel_all`](fn.aio_cancel_all.html), though the operating system may
//! not support this for all filesystems and devices.
//! [`aio_cancel_all`], though the operating system may not support this for
//! all filesystems and devices.
#![allow(clippy::doc_overindented_list_items)] // It looks better this way
#[cfg(target_os = "freebsd")]
use std::io::{IoSlice, IoSliceMut};
Expand Down Expand Up @@ -64,19 +63,19 @@ libc_enum! {
}

libc_enum! {
/// Mode for [`lio_listio`](fn.lio_listio.html)
/// Mode for [`lio_listio`]
#[repr(i32)]
pub enum LioMode {
/// Requests that [`lio_listio`](fn.lio_listio.html) block until all
/// Requests that [`lio_listio`] block until all
/// requested operations have been completed
LIO_WAIT,
/// Requests that [`lio_listio`](fn.lio_listio.html) return immediately
/// Requests that [`lio_listio`] return immediately
LIO_NOWAIT,
}
}

/// Return values for [`AioCb::cancel`](struct.AioCb.html#method.cancel) and
/// [`aio_cancel_all`](fn.aio_cancel_all.html)
/// [`aio_cancel_all`]
#[repr(i32)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum AioCancelStat {
Expand Down
8 changes: 3 additions & 5 deletions src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,12 +942,12 @@ pub unsafe fn sigaction(signal: Signal, sigaction: &SigAction) -> Result<SigActi
/// Installs `handler` for the given `signal`, returning the previous signal
/// handler. `signal` should only be used following another call to `signal` or
/// if the current handler is the default. The return value of `signal` is
/// undefined after setting the handler with [`sigaction`][SigActionFn].
/// undefined after setting the handler with [`sigaction`].
///
/// # Safety
///
/// If the pointer to the previous signal handler is invalid, undefined
/// behavior could be invoked when casting it back to a [`SigAction`][SigActionStruct].
/// behavior could be invoked when casting it back to a [`SigAction`].
///
/// # Examples
///
Expand Down Expand Up @@ -980,15 +980,13 @@ pub unsafe fn sigaction(signal: Signal, sigaction: &SigAction) -> Result<SigActi
/// # Errors
///
/// Returns [`Error(Errno::EOPNOTSUPP)`](Errno::EOPNOTSUPP) if `handler` is
/// [`SigAction`][SigActionStruct]. Use [`sigaction`][SigActionFn] instead.
/// [`SigAction`]. Use [`sigaction`] instead.
///
/// `signal` also returns any error from `libc::signal`, such as when an attempt
/// is made to catch a signal that cannot be caught or to ignore a signal that
/// cannot be ignored.
///
/// [`Error::UnsupportedOperation`]: ../../enum.Error.html#variant.UnsupportedOperation
/// [SigActionStruct]: struct.SigAction.html
/// [sigactionFn]: fn.sigaction.html
pub unsafe fn signal(signal: Signal, handler: SigHandler) -> Result<SigHandler> {
let signal = signal as libc::c_int;
let res = match handler {
Expand Down
8 changes: 2 additions & 6 deletions src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ impl TryFrom<i32> for SockType {
}
}

/// Constants used in [`socket`](fn.socket.html) and [`socketpair`](fn.socketpair.html)
/// to specify the protocol to use.
/// Constants used in [`socket`] and [`socketpair`] to specify the protocol to use.
#[repr(i32)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[non_exhaustive]
Expand Down Expand Up @@ -1762,7 +1761,7 @@ pub fn sendmsg<S>(fd: RawFd, iov: &[IoSlice<'_>], cmsgs: &[ControlMessage],
}


/// An extension of `sendmsg` that allows the caller to transmit multiple
/// An extension of [`sendmsg`] that allows the caller to transmit multiple
/// messages on a socket using a single system call. This has performance
/// benefits for some applications.
///
Expand All @@ -1776,9 +1775,6 @@ pub fn sendmsg<S>(fd: RawFd, iov: &[IoSlice<'_>], cmsgs: &[ControlMessage],
///
/// # Returns
/// `Vec` with numbers of sent bytes on each sent message.
///
/// # References
/// [`sendmsg`](fn.sendmsg.html)
#[cfg(any(linux_android, target_os = "freebsd", target_os = "netbsd"))]
pub fn sendmmsg<'a, XS, AS, C, I, S>(
fd: RawFd,
Expand Down
4 changes: 2 additions & 2 deletions src/sys/uio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn readv<Fd: AsFd>(fd: Fd, iov: &mut [IoSliceMut<'_>]) -> Result<usize> {
/// Buffers in `iov` will be written in order until all buffers have been written
/// or an error occurs. The file offset is not changed.
///
/// See also: [`writev`](fn.writev.html) and [`pwrite`](fn.pwrite.html)
/// See also: [`writev`] and [`pwrite`]
#[cfg(not(any(target_os = "redox", target_os = "haiku", target_os = "solaris", target_os = "cygwin")))]
pub fn pwritev<Fd: AsFd>(
fd: Fd,
Expand Down Expand Up @@ -81,7 +81,7 @@ pub fn pwritev<Fd: AsFd>(
/// no more bytes are available, or an error occurs. The file offset is not
/// changed.
///
/// See also: [`readv`](fn.readv.html) and [`pread`](fn.pread.html)
/// See also: [`readv`] and [`pread`]
#[cfg(not(any(target_os = "redox", target_os = "haiku", target_os = "solaris", target_os = "cygwin")))]
// Clippy doesn't know that we need to pass iov mutably only because the
// mutation happens after converting iov to a pointer
Expand Down
2 changes: 2 additions & 0 deletions test/sys/test_wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fn test_wait_signal() {
}
}

#[cfg(not(target_env = "musl"))] // https://github.com/nix-rust/nix/issues/2823
#[test]
#[cfg(any(
target_os = "android",
Expand Down Expand Up @@ -73,6 +74,7 @@ fn test_wait_exit() {
}
}

#[cfg(not(target_env = "musl"))] // https://github.com/nix-rust/nix/issues/2823
#[cfg(not(target_os = "haiku"))]
#[test]
#[cfg(any(
Expand Down
Loading