From 7f20002268d6c2c1b50bc77e69b4bf3975df0e5d Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Sun, 30 Aug 2026 16:36:40 +0100 Subject: [PATCH 1/4] fix: redundant_explicit_links rustdoc lint --- src/poll.rs | 9 ++++----- src/sys/aio.rs | 21 ++++++++++----------- src/sys/signal.rs | 8 +++----- src/sys/socket/mod.rs | 8 ++------ src/sys/uio.rs | 4 ++-- 5 files changed, 21 insertions(+), 29 deletions(-) diff --git a/src/poll.rs b/src/poll.rs index 48a2bf490b..f44d523b6d 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -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`. @@ -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 @@ -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()` diff --git a/src/sys/aio.rs b/src/sys/aio.rs index 9339624d85..b2bddc7f24 100644 --- a/src/sys/aio.rs +++ b/src/sys/aio.rs @@ -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}; @@ -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 { diff --git a/src/sys/signal.rs b/src/sys/signal.rs index e4d6f9d40b..d85b0728db 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -942,12 +942,12 @@ pub unsafe fn sigaction(signal: Signal, sigaction: &SigAction) -> Result Result Result { let signal = signal as libc::c_int; let res = match handler { diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 91d63fb0f3..229cbb0ddb 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -123,8 +123,7 @@ impl TryFrom 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] @@ -1762,7 +1761,7 @@ pub fn sendmsg(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. /// @@ -1776,9 +1775,6 @@ pub fn sendmsg(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, diff --git a/src/sys/uio.rs b/src/sys/uio.rs index f47083cba4..553750531d 100644 --- a/src/sys/uio.rs +++ b/src/sys/uio.rs @@ -52,7 +52,7 @@ pub fn readv(fd: Fd, iov: &mut [IoSliceMut<'_>]) -> Result { /// 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: Fd, @@ -81,7 +81,7 @@ pub fn pwritev( /// 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 From 35a1c3c2ce049385711dbcf3a04fa7988ebe50aa Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Mon, 27 Jul 2026 13:49:38 +0100 Subject: [PATCH 2/4] fix: update cfg_aliases dependency to version 0.2.2 needed to fix semicolon_in_expressions_from_macros error in minver ```log error: trailing semicolon in macro used in expression position --> build.rs:4:5 | 4 | / cfg_aliases! { 5 | | android: { target_os = "android" }, 6 | | dragonfly: { target_os = "dragonfly" }, 7 | | ios: { target_os = "ios" }, ... | 27 | | solarish: { any(illumos, solaris) }, 28 | | } | |_____^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #79813 = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `$crate::cfg_aliases` which comes from the expansion of the macro `cfg_aliases` (in Nightly builds, run with -Z macro-backtrace for more info) ``` --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c4c109a4b6..55de4b4e25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" From c4d3b6f30fcd43bb58e18e679c0133e9593b5f06 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Thu, 10 Sep 2026 00:59:55 +0100 Subject: [PATCH 3/4] fix: mark macOS-only items --- src/sys/ptrace/bsd.rs | 16 ++++++++-------- src/sys/ptrace/mod.rs | 4 ++-- src/sys/socket/addr.rs | 16 ++++++++-------- src/sys/socket/mod.rs | 4 ++-- src/sys/socket/sockopt.rs | 8 ++++---- test/sys/mod.rs | 2 +- test/sys/test_socket.rs | 2 +- test/sys/test_sockopt.rs | 2 +- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/sys/ptrace/bsd.rs b/src/sys/ptrace/bsd.rs index 3dd486210c..32a53085af 100644 --- a/src/sys/ptrace/bsd.rs +++ b/src/sys/ptrace/bsd.rs @@ -9,7 +9,7 @@ use std::ptr; pub type RequestType = c_int; cfg_if! { - if #[cfg(any(freebsdlike, apple_targets, target_os = "openbsd"))] { + if #[cfg(any(freebsdlike, target_os = "macos", target_os = "openbsd"))] { #[doc(hidden)] pub type AddressType = *mut ::libc::c_char; } else { @@ -26,26 +26,26 @@ libc_enum! { PT_TRACE_ME, PT_READ_I, PT_READ_D, - #[cfg(apple_targets)] + #[cfg(target_os = "macos")] PT_READ_U, PT_WRITE_I, PT_WRITE_D, - #[cfg(apple_targets)] + #[cfg(target_os = "macos")] PT_WRITE_U, PT_CONTINUE, PT_KILL, - #[cfg(any(any(freebsdlike, apple_targets), + #[cfg(any(any(freebsdlike, target_os = "macos"), all(target_os = "openbsd", target_arch = "x86_64"), all(target_os = "netbsd", any(target_arch = "x86_64", target_arch = "powerpc"))))] PT_STEP, PT_ATTACH, PT_DETACH, - #[cfg(apple_targets)] + #[cfg(target_os = "macos")] PT_SIGEXC, - #[cfg(apple_targets)] + #[cfg(target_os = "macos")] PT_THUPDATE, - #[cfg(apple_targets)] + #[cfg(target_os = "macos")] PT_ATTACHEXC } } @@ -149,7 +149,7 @@ pub fn kill(pid: Pid) -> Result<()> { /// } /// ``` #[cfg(any( - any(freebsdlike, apple_targets), + any(freebsdlike, target_os = "macos"), all(target_os = "openbsd", target_arch = "x86_64"), all( target_os = "netbsd", diff --git a/src/sys/ptrace/mod.rs b/src/sys/ptrace/mod.rs index c059797df9..b35af5e177 100644 --- a/src/sys/ptrace/mod.rs +++ b/src/sys/ptrace/mod.rs @@ -6,8 +6,8 @@ mod linux; #[cfg(linux_android)] pub use self::linux::*; -#[cfg(bsd)] +#[cfg(any(bsd_without_apple, target_os = "macos"))] mod bsd; -#[cfg(bsd)] +#[cfg(any(bsd_without_apple, target_os = "macos"))] pub use self::bsd::*; diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 09be1d68b5..4d7716921a 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -16,7 +16,7 @@ use crate::errno::Errno; use crate::sys::socket::addr::alg::AlgAddr; #[cfg(linux_android)] use crate::sys::socket::addr::netlink::NetlinkAddr; -#[cfg(all(feature = "ioctl", apple_targets))] +#[cfg(all(feature = "ioctl", target_os = "macos"))] use crate::sys::socket::addr::sys_control::SysControlAddr; use crate::{NixPath, Result}; use cfg_if::cfg_if; @@ -1134,7 +1134,7 @@ pub union SockaddrStorage { dl: LinkAddr, #[cfg(linux_android)] nl: NetlinkAddr, - #[cfg(all(feature = "ioctl", apple_targets))] + #[cfg(all(feature = "ioctl", target_os = "macos"))] #[cfg_attr(docsrs, doc(cfg(feature = "ioctl")))] sctl: SysControlAddr, #[cfg(feature = "net")] @@ -1216,7 +1216,7 @@ impl SockaddrLike for SockaddrStorage { libc::AF_PACKET => unsafe { LinkAddr::from_raw(addr, l).map(|dl| Self { dl }) }, - #[cfg(all(feature = "ioctl", apple_targets))] + #[cfg(all(feature = "ioctl", target_os = "macos"))] libc::AF_SYSTEM => unsafe { SysControlAddr::from_raw(addr, l).map(|sctl| Self { sctl }) }, @@ -1375,7 +1375,7 @@ impl SockaddrStorage { accessors! {as_netlink_addr, as_netlink_addr_mut, NetlinkAddr, AddressFamily::Netlink, libc::sockaddr_nl, nl} - #[cfg(all(feature = "ioctl", apple_targets))] + #[cfg(all(feature = "ioctl", target_os = "macos"))] #[cfg_attr(docsrs, doc(cfg(feature = "ioctl")))] accessors! {as_sys_control_addr, as_sys_control_addr_mut, SysControlAddr, AddressFamily::System, libc::sockaddr_ctl, sctl} @@ -1413,7 +1413,7 @@ impl fmt::Display for SockaddrStorage { #[cfg(any(linux_android, target_os = "fuchsia"))] #[cfg(feature = "net")] libc::AF_PACKET => self.dl.fmt(f), - #[cfg(apple_targets)] + #[cfg(target_os = "macos")] #[cfg(feature = "ioctl")] libc::AF_SYSTEM => self.sctl.fmt(f), libc::AF_UNIX => self.su.fmt(f), @@ -1475,7 +1475,7 @@ impl Hash for SockaddrStorage { #[cfg(any(linux_android, target_os = "fuchsia"))] #[cfg(feature = "net")] libc::AF_PACKET => self.dl.hash(s), - #[cfg(apple_targets)] + #[cfg(target_os = "macos")] #[cfg(feature = "ioctl")] libc::AF_SYSTEM => self.sctl.hash(s), libc::AF_UNIX => self.su.hash(s), @@ -1505,7 +1505,7 @@ impl PartialEq for SockaddrStorage { #[cfg(any(linux_android, target_os = "fuchsia"))] #[cfg(feature = "net")] (libc::AF_PACKET, libc::AF_PACKET) => self.dl == other.dl, - #[cfg(apple_targets)] + #[cfg(target_os = "macos")] #[cfg(feature = "ioctl")] (libc::AF_SYSTEM, libc::AF_SYSTEM) => self.sctl == other.sctl, (libc::AF_UNIX, libc::AF_UNIX) => self.su == other.su, @@ -1727,7 +1727,7 @@ pub mod alg { feature! { #![feature = "ioctl"] -#[cfg(apple_targets)] +#[cfg(target_os = "macos")] pub mod sys_control { use crate::sys::socket::addr::AddressFamily; use libc::{self, c_uchar}; diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 229cbb0ddb..5dbbb7defc 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -62,7 +62,7 @@ pub use self::addr::{SockaddrIn, SockaddrIn6}; pub use crate::sys::socket::addr::alg::AlgAddr; #[cfg(linux_android)] pub use crate::sys::socket::addr::netlink::NetlinkAddr; -#[cfg(apple_targets)] +#[cfg(target_os = "macos")] #[cfg(feature = "ioctl")] pub use crate::sys::socket::addr::sys_control::SysControlAddr; #[cfg(any(linux_android, apple_targets))] @@ -136,7 +136,7 @@ pub enum SockProtocol { Raw = libc::IPPROTO_RAW, /// Allows applications to configure and control a KEXT /// ([ref](https://developer.apple.com/library/content/documentation/Darwin/Conceptual/NKEConceptual/control/control.html)) - #[cfg(apple_targets)] + #[cfg(target_os = "macos")] KextControl = libc::SYSPROTO_CONTROL, /// Receives routing and link updates and may be used to modify the routing tables (both IPv4 and IPv6), IP addresses, link // parameters, neighbor setups, queueing disciplines, traffic classes and packet classifiers diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index cc5ed20051..4c22f783ab 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -6,7 +6,7 @@ use crate::sys::time::TimeVal; use crate::{errno::Errno, Result}; use cfg_if::cfg_if; use libc::{self, c_int, c_void, socklen_t}; -#[cfg(apple_targets)] +#[cfg(target_os = "macos")] use std::ffi::CString; use std::ffi::{CStr, OsStr, OsString}; use std::mem::{self, MaybeUninit}; @@ -1297,7 +1297,7 @@ sockopt_impl!( libc::IPV6_DONTFRAG, bool ); -#[cfg(apple_targets)] +#[cfg(target_os = "macos")] #[cfg(feature = "net")] sockopt_impl!( /// Get the utun interface name. @@ -2005,14 +2005,14 @@ impl<'a> Set<'a, OsString> for SetOsString<'a> { } /// Getter for a `CString` value. -#[cfg(apple_targets)] +#[cfg(target_os = "macos")] #[cfg(feature = "net")] struct GetCString> { len: socklen_t, val: MaybeUninit, } -#[cfg(apple_targets)] +#[cfg(target_os = "macos")] #[cfg(feature = "net")] impl> Get for GetCString { fn uninit() -> Self { diff --git a/test/sys/mod.rs b/test/sys/mod.rs index 1188b39266..82ba15c6a1 100644 --- a/test/sys/mod.rs +++ b/test/sys/mod.rs @@ -52,7 +52,7 @@ mod test_fanotify; mod test_inotify; mod test_pthread; -#[cfg(any(linux_android, freebsdlike, netbsdlike, apple_targets))] +#[cfg(any(linux_android, freebsdlike, netbsdlike, target_os = "macos"))] mod test_ptrace; #[cfg(linux_android)] mod test_timerfd; diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs index 9f309b42db..8afdafd41f 100644 --- a/test/sys/test_socket.rs +++ b/test/sys/test_socket.rs @@ -1777,7 +1777,7 @@ pub fn test_unnamed_unixdomain_autobind() { } // Test creating and using named system control sockets -#[cfg(apple_targets)] +#[cfg(target_os = "macos")] #[test] pub fn test_syscontrol() { use nix::errno::Errno; diff --git a/test/sys/test_sockopt.rs b/test/sys/test_sockopt.rs index c3e1d5ed07..d08a28b412 100644 --- a/test/sys/test_sockopt.rs +++ b/test/sys/test_sockopt.rs @@ -952,7 +952,7 @@ fn test_ktls() { } #[test] -#[cfg(apple_targets)] +#[cfg(target_os = "macos")] fn test_utun_ifname() { skip_if_not_root!("test_utun_ifname"); From 20e1c2cbd70b65a7882ff18c22e0e2ece907e840 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Wed, 9 Sep 2026 18:59:33 +0100 Subject: [PATCH 4/4] NOMERGE: disable tests failing with musl --- test/sys/test_wait.rs | 8 ++++++++ test/test_pty.rs | 16 ++++++++++++++-- test/test_unistd.rs | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/test/sys/test_wait.rs b/test/sys/test_wait.rs index 365b0165f8..9f263a09ca 100644 --- a/test/sys/test_wait.rs +++ b/test/sys/test_wait.rs @@ -26,6 +26,8 @@ fn test_wait_signal() { } } +// https://github.com/nix-rust/nix/issues/2823 +#[cfg(not(target_env = "musl"))] #[test] #[cfg(any( target_os = "android", @@ -73,6 +75,8 @@ fn test_wait_exit() { } } +// https://github.com/nix-rust/nix/issues/2823 +#[cfg(not(target_env = "musl"))] #[cfg(not(target_os = "haiku"))] #[test] #[cfg(any( @@ -202,6 +206,8 @@ mod ptrace { } #[cfg(not(target_env = "uclibc"))] + // https://github.com/nix-rust/nix/issues/2823 + #[cfg(not(target_env = "musl"))] fn ptrace_waitid_parent(child: Pid) { // Wait for the raised SIGTRAP // @@ -254,6 +260,8 @@ mod ptrace { } #[test] + // https://github.com/nix-rust/nix/issues/2823 + #[cfg(not(target_env = "musl"))] #[cfg(not(target_env = "uclibc"))] fn test_waitid_ptrace() { require_capability!("test_waitid_ptrace", CAP_SYS_PTRACE); diff --git a/test/test_pty.rs b/test/test_pty.rs index a580832705..3b6c371980 100644 --- a/test/test_pty.rs +++ b/test/test_pty.rs @@ -1,15 +1,25 @@ use std::fs::File; -use std::io::{stdout, Read, Write}; +// https://github.com/nix-rust/nix/issues/2823 +#[cfg(not(target_env = "musl"))] +use std::io::stdout; +use std::io::{Read, Write}; use std::os::unix::prelude::*; use std::path::Path; +// https://github.com/nix-rust/nix/issues/2823 +#[cfg(not(target_env = "musl"))] use libc::_exit; use nix::fcntl::{open, OFlag}; use nix::pty::*; use nix::sys::stat; use nix::sys::termios::*; +// https://github.com/nix-rust/nix/issues/2823 +#[cfg(not(target_env = "musl"))] use nix::sys::wait::WaitStatus; -use nix::unistd::{pause, write}; +// https://github.com/nix-rust/nix/issues/2823 +#[cfg(not(target_env = "musl"))] +use nix::unistd::pause; +use nix::unistd::write; /// Test equivalence of `ptsname` and `ptsname_r` #[test] @@ -250,6 +260,8 @@ fn test_openpty_with_termios() { } #[test] +// https://github.com/nix-rust/nix/issues/2823 +#[cfg(not(target_env = "musl"))] fn test_forkpty() { use nix::sys::signal::*; use nix::sys::wait::wait; diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 7641752a21..7584c41521 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -97,6 +97,8 @@ fn test_rfork_and_waitpid() { } #[test] +// https://github.com/nix-rust/nix/issues/2823 +#[cfg(not(target_env = "musl"))] fn test_wait() { // Grab FORK_MTX so wait doesn't reap a different test's child process let _m = crate::FORK_MTX.lock();