summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/src')
-rw-r--r--vendor/rustix/src/backend/libc/conv.rs18
-rw-r--r--vendor/rustix/src/backend/libc/fs/dir.rs172
-rw-r--r--vendor/rustix/src/backend/libc/fs/syscalls.rs342
-rw-r--r--vendor/rustix/src/backend/libc/fs/types.rs35
-rw-r--r--vendor/rustix/src/backend/libc/io/syscalls.rs192
-rw-r--r--vendor/rustix/src/backend/libc/io/types.rs11
-rw-r--r--vendor/rustix/src/backend/libc/mm/types.rs2
-rw-r--r--vendor/rustix/src/backend/libc/mod.rs4
-rw-r--r--vendor/rustix/src/backend/libc/net/send_recv.rs10
-rw-r--r--vendor/rustix/src/backend/libc/net/syscalls.rs118
-rw-r--r--vendor/rustix/src/backend/libc/net/types.rs26
-rw-r--r--vendor/rustix/src/backend/libc/offset.rs20
-rw-r--r--vendor/rustix/src/backend/libc/process/syscalls.rs94
-rw-r--r--vendor/rustix/src/backend/libc/process/types.rs27
-rw-r--r--vendor/rustix/src/backend/libc/rand/syscalls.rs6
-rw-r--r--vendor/rustix/src/backend/libc/termios/syscalls.rs4
-rw-r--r--vendor/rustix/src/backend/libc/termios/types.rs230
-rw-r--r--vendor/rustix/src/backend/libc/time/types.rs22
-rw-r--r--vendor/rustix/src/backend/libc/weak.rs226
-rw-r--r--vendor/rustix/src/backend/libc/winsock_c.rs73
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs12
-rw-r--r--vendor/rustix/src/backend/linux_raw/c.rs20
-rw-r--r--vendor/rustix/src/backend/linux_raw/conv.rs32
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/inotify.rs2
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/syscalls.rs168
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/types.rs5
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/errno.rs2
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/syscalls.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/mm/types.rs2
-rw-r--r--vendor/rustix/src/backend/linux_raw/mod.rs5
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/send_recv.rs10
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/syscalls.rs61
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/types.rs25
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/syscalls.rs97
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/types.rs9
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/wait.rs31
-rw-r--r--vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs148
-rw-r--r--vendor/rustix/src/backend/linux_raw/termios/syscalls.rs8
-rw-r--r--vendor/rustix/src/backend/linux_raw/thread/syscalls.rs2
-rw-r--r--vendor/rustix/src/backend/linux_raw/time/types.rs2
-rw-r--r--vendor/rustix/src/backend/linux_raw/vdso.rs2
-rw-r--r--vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs2
-rw-r--r--vendor/rustix/src/fs/abs.rs4
-rw-r--r--vendor/rustix/src/fs/at.rs5
-rw-r--r--vendor/rustix/src/fs/constants.rs5
-rw-r--r--vendor/rustix/src/fs/fd.rs12
-rw-r--r--vendor/rustix/src/fs/memfd_create.rs4
-rw-r--r--vendor/rustix/src/fs/mod.rs11
-rw-r--r--vendor/rustix/src/fs/raw_dir.rs2
-rw-r--r--vendor/rustix/src/fs/statx.rs2
-rw-r--r--vendor/rustix/src/fs/xattr.rs197
-rw-r--r--vendor/rustix/src/io/close.rs14
-rw-r--r--vendor/rustix/src/io/dup.rs32
-rw-r--r--vendor/rustix/src/io/errno.rs16
-rw-r--r--vendor/rustix/src/io/eventfd.rs4
-rw-r--r--vendor/rustix/src/io/fcntl.rs56
-rw-r--r--vendor/rustix/src/io/ioctl.rs36
-rw-r--r--vendor/rustix/src/io/is_read_write.rs2
-rw-r--r--vendor/rustix/src/io/kqueue.rs92
-rw-r--r--vendor/rustix/src/io/mod.rs14
-rw-r--r--vendor/rustix/src/io/pipe.rs24
-rw-r--r--vendor/rustix/src/io/poll.rs12
-rw-r--r--vendor/rustix/src/io/procfs.rs6
-rw-r--r--vendor/rustix/src/io/read_write.rs84
-rw-r--r--vendor/rustix/src/io/stdio.rs148
-rw-r--r--vendor/rustix/src/io_uring.rs2
-rw-r--r--vendor/rustix/src/lib.rs17
-rw-r--r--vendor/rustix/src/mm/madvise.rs14
-rw-r--r--vendor/rustix/src/mm/mmap.rs92
-rw-r--r--vendor/rustix/src/mm/msync.rs18
-rw-r--r--vendor/rustix/src/net/send_recv.rs112
-rw-r--r--vendor/rustix/src/net/socket.rs318
-rw-r--r--vendor/rustix/src/net/socketpair.rs14
-rw-r--r--vendor/rustix/src/net/sockopt.rs1012
-rw-r--r--vendor/rustix/src/path/arg.rs4
-rw-r--r--vendor/rustix/src/process/chroot.rs12
-rw-r--r--vendor/rustix/src/process/exit.rs4
-rw-r--r--vendor/rustix/src/process/id.rs64
-rw-r--r--vendor/rustix/src/process/kill.rs46
-rw-r--r--vendor/rustix/src/process/mod.rs12
-rw-r--r--vendor/rustix/src/process/prctl.rs15
-rw-r--r--vendor/rustix/src/process/procctl.rs44
-rw-r--r--vendor/rustix/src/process/system.rs (renamed from vendor/rustix/src/process/uname.rs)38
-rw-r--r--vendor/rustix/src/process/wait.rs150
-rw-r--r--vendor/rustix/src/rand/getrandom.rs2
-rw-r--r--vendor/rustix/src/runtime.rs149
-rw-r--r--vendor/rustix/src/termios/tty.rs1
-rw-r--r--vendor/rustix/src/thread/id.rs10
-rw-r--r--vendor/rustix/src/thread/prctl.rs21
-rw-r--r--vendor/rustix/src/time/clock.rs30
-rw-r--r--vendor/rustix/src/utils.rs20
-rw-r--r--vendor/rustix/src/weak.rs (renamed from vendor/rustix/src/backend/linux_raw/weak.rs)6
93 files changed, 4179 insertions, 1115 deletions
diff --git a/vendor/rustix/src/backend/libc/conv.rs b/vendor/rustix/src/backend/libc/conv.rs
index 1e74ea9ba..b827d0bbc 100644
--- a/vendor/rustix/src/backend/libc/conv.rs
+++ b/vendor/rustix/src/backend/libc/conv.rs
@@ -88,20 +88,22 @@ pub(super) fn ret_u32(raw: c::c_int) -> io::Result<u32> {
}
#[inline]
-pub(super) fn ret_ssize_t(raw: c::ssize_t) -> io::Result<c::ssize_t> {
+pub(super) fn ret_usize(raw: c::ssize_t) -> io::Result<usize> {
if raw == -1 {
Err(io::Errno::last_os_error())
} else {
- Ok(raw)
+ debug_assert!(raw >= 0);
+ Ok(raw as usize)
}
}
#[inline]
-pub(super) fn syscall_ret_ssize_t(raw: c::c_long) -> io::Result<c::ssize_t> {
+pub(super) fn syscall_ret_usize(raw: c::c_long) -> io::Result<usize> {
if raw == -1 {
Err(io::Errno::last_os_error())
} else {
- Ok(raw as c::ssize_t)
+ debug_assert!(raw >= 0);
+ Ok(raw as c::ssize_t as usize)
}
}
@@ -210,13 +212,13 @@ pub(super) fn send_recv_len(len: usize) -> i32 {
/// Convert the return value of a `send` or `recv` call.
#[cfg(not(windows))]
#[inline]
-pub(super) fn ret_send_recv(len: isize) -> io::Result<c::ssize_t> {
- ret_ssize_t(len)
+pub(super) fn ret_send_recv(len: isize) -> io::Result<usize> {
+ ret_usize(len)
}
/// Convert the return value of a `send` or `recv` call.
#[cfg(windows)]
#[inline]
-pub(super) fn ret_send_recv(len: i32) -> io::Result<c::ssize_t> {
- ret_ssize_t(len as isize)
+pub(super) fn ret_send_recv(len: i32) -> io::Result<usize> {
+ ret_usize(len as isize)
}
diff --git a/vendor/rustix/src/backend/libc/fs/dir.rs b/vendor/rustix/src/backend/libc/fs/dir.rs
index d1c901323..b6eb32580 100644
--- a/vendor/rustix/src/backend/libc/fs/dir.rs
+++ b/vendor/rustix/src/backend/libc/fs/dir.rs
@@ -1,11 +1,10 @@
use super::super::c;
use super::super::conv::owned_fd;
+use super::super::offset::libc_ino_t;
#[cfg(not(any(solarish, target_os = "haiku")))]
use super::types::FileType;
use crate::fd::{AsFd, BorrowedFd};
-use crate::ffi::CStr;
-#[cfg(target_os = "wasi")]
-use crate::ffi::CString;
+use crate::ffi::{CStr, CString};
use crate::fs::{fcntl_getfl, fstat, openat, Mode, OFlags, Stat};
#[cfg(not(any(
solarish,
@@ -22,14 +21,11 @@ use crate::io;
use crate::process::fchdir;
#[cfg(target_os = "wasi")]
use alloc::borrow::ToOwned;
-#[cfg(not(any(linux_like, target_os = "openbsd")))]
-use c::dirent as libc_dirent;
#[cfg(not(linux_like))]
use c::readdir as libc_readdir;
#[cfg(linux_like)]
-use c::{dirent64 as libc_dirent, readdir64 as libc_readdir};
+use c::readdir64 as libc_readdir;
use core::fmt;
-use core::mem::zeroed;
use core::ptr::NonNull;
use libc_errno::{errno, set_errno, Errno};
@@ -91,16 +87,24 @@ impl Dir {
} else {
// We successfully read an entry.
unsafe {
+ let dirent = &*dirent_ptr;
+
// We have our own copy of OpenBSD's dirent; check that the
// layout minimally matches libc's.
#[cfg(target_os = "openbsd")]
- check_dirent_layout(&*dirent_ptr);
+ check_dirent_layout(dirent);
let result = DirEntry {
- dirent: read_dirent(&*dirent_ptr.cast()),
+ #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
+ d_type: dirent.d_type,
+
+ #[cfg(not(any(freebsdlike, netbsdlike)))]
+ d_ino: dirent.d_ino,
+
+ #[cfg(any(freebsdlike, netbsdlike))]
+ d_fileno: dirent.d_fileno,
- #[cfg(target_os = "wasi")]
- name: CStr::from_ptr((*dirent_ptr).d_name.as_ptr()).to_owned(),
+ name: CStr::from_ptr(dirent.d_name.as_ptr()).to_owned(),
};
Some(Ok(result))
@@ -142,130 +146,6 @@ impl Dir {
}
}
-// A `dirent` pointer returned from `readdir` may not point to a full `dirent`
-// struct, as the name is NUL-terminated and memory may not be allocated for
-// the full extent of the struct. Copy the fields one at a time.
-unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
- #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
- let d_type = input.d_type;
-
- #[cfg(not(any(
- apple,
- freebsdlike,
- target_os = "aix",
- target_os = "haiku",
- target_os = "netbsd",
- target_os = "wasi",
- )))]
- let d_off = input.d_off;
-
- #[cfg(target_os = "aix")]
- let d_offset = input.d_offset;
-
- #[cfg(not(any(freebsdlike, netbsdlike)))]
- let d_ino = input.d_ino;
-
- #[cfg(any(freebsdlike, netbsdlike))]
- let d_fileno = input.d_fileno;
-
- #[cfg(not(any(target_os = "dragonfly", target_os = "wasi")))]
- let d_reclen = input.d_reclen;
-
- #[cfg(any(bsd, target_os = "aix"))]
- let d_namlen = input.d_namlen;
-
- #[cfg(apple)]
- let d_seekoff = input.d_seekoff;
-
- #[cfg(target_os = "haiku")]
- let d_dev = input.d_dev;
- #[cfg(target_os = "haiku")]
- let d_pdev = input.d_pdev;
- #[cfg(target_os = "haiku")]
- let d_pino = input.d_pino;
-
- // Construct the input. Rust will give us an error if any OS has a input
- // with a field that we missed here. And we can avoid blindly copying the
- // whole `d_name` field, which may not be entirely allocated.
- #[cfg_attr(target_os = "wasi", allow(unused_mut))]
- #[cfg(not(freebsdlike))]
- let mut dirent = libc_dirent {
- #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
- d_type,
- #[cfg(not(any(
- apple,
- target_os = "aix",
- target_os = "freebsd", // Until FreeBSD 12
- target_os = "haiku",
- target_os = "netbsd",
- target_os = "wasi",
- )))]
- d_off,
- #[cfg(target_os = "aix")]
- d_offset,
- #[cfg(not(any(netbsdlike, target_os = "freebsd")))]
- d_ino,
- #[cfg(any(netbsdlike, target_os = "freebsd"))]
- d_fileno,
- #[cfg(not(target_os = "wasi"))]
- d_reclen,
- #[cfg(any(apple, netbsdlike, target_os = "aix", target_os = "freebsd"))]
- d_namlen,
- #[cfg(apple)]
- d_seekoff,
- // The `d_name` field is NUL-terminated, and we need to be careful not
- // to read bytes past the NUL, even though they're within the nominal
- // extent of the `struct dirent`, because they may not be allocated. So
- // don't read it from `dirent_ptr`.
- //
- // In theory this could use `MaybeUninit::uninit().assume_init()`, but
- // that [invokes undefined behavior].
- //
- // [invokes undefined behavior]: https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#initialization-invariant
- d_name: zeroed(),
- #[cfg(target_os = "openbsd")]
- __d_padding: zeroed(),
- #[cfg(target_os = "haiku")]
- d_dev,
- #[cfg(target_os = "haiku")]
- d_pdev,
- #[cfg(target_os = "haiku")]
- d_pino,
- };
- /*
- pub d_ino: ino_t,
- pub d_pino: i64,
- pub d_reclen: ::c_ushort,
- pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
- */
-
- // On dragonfly and FreeBSD 12, `dirent` has some non-public padding fields
- // so we can't directly initialize it.
- #[cfg(freebsdlike)]
- let mut dirent = {
- let mut dirent: libc_dirent = zeroed();
- dirent.d_fileno = d_fileno;
- dirent.d_namlen = d_namlen;
- dirent.d_type = d_type;
- #[cfg(target_os = "freebsd")]
- {
- dirent.d_reclen = d_reclen;
- }
- dirent
- };
-
- // Copy from d_name, reading up to and including the first NUL.
- #[cfg(not(target_os = "wasi"))]
- {
- let name_len = CStr::from_ptr(input.d_name.as_ptr())
- .to_bytes_with_nul()
- .len();
- dirent.d_name[..name_len].copy_from_slice(&input.d_name[..name_len]);
- }
-
- dirent
-}
-
/// `Dir` implements `Send` but not `Sync`, because we use `readdir` which is
/// not guaranteed to be thread-safe. Users can wrap this in a `Mutex` if they
/// need `Sync`, which is effectively what'd need to do to implement `Sync`
@@ -299,9 +179,15 @@ impl fmt::Debug for Dir {
/// `struct dirent`
#[derive(Debug)]
pub struct DirEntry {
- dirent: libc_dirent,
+ #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
+ d_type: u8,
+
+ #[cfg(not(any(freebsdlike, netbsdlike)))]
+ d_ino: libc_ino_t,
+
+ #[cfg(any(freebsdlike, netbsdlike))]
+ d_fileno: libc_ino_t,
- #[cfg(target_os = "wasi")]
name: CString,
}
@@ -309,12 +195,6 @@ impl DirEntry {
/// Returns the file name of this directory entry.
#[inline]
pub fn file_name(&self) -> &CStr {
- #[cfg(not(target_os = "wasi"))]
- unsafe {
- CStr::from_ptr(self.dirent.d_name.as_ptr())
- }
-
- #[cfg(target_os = "wasi")]
&self.name
}
@@ -322,14 +202,14 @@ impl DirEntry {
#[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
#[inline]
pub fn file_type(&self) -> FileType {
- FileType::from_dirent_d_type(self.dirent.d_type)
+ FileType::from_dirent_d_type(self.d_type)
}
/// Return the inode number of this directory entry.
#[cfg(not(any(freebsdlike, netbsdlike)))]
#[inline]
pub fn ino(&self) -> u64 {
- self.dirent.d_ino as u64
+ self.d_ino as u64
}
/// Return the inode number of this directory entry.
@@ -337,7 +217,7 @@ impl DirEntry {
#[inline]
pub fn ino(&self) -> u64 {
#[allow(clippy::useless_conversion)]
- self.dirent.d_fileno.into()
+ self.d_fileno.into()
}
}
diff --git a/vendor/rustix/src/backend/libc/fs/syscalls.rs b/vendor/rustix/src/backend/libc/fs/syscalls.rs
index 77b49ee3e..40c160182 100644
--- a/vendor/rustix/src/backend/libc/fs/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/fs/syscalls.rs
@@ -1,11 +1,9 @@
//! libc syscalls supporting `rustix::fs`.
use super::super::c;
-use super::super::conv::{
- borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd, ret_ssize_t,
-};
+use super::super::conv::{borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd, ret_usize};
#[cfg(any(target_os = "android", target_os = "linux"))]
-use super::super::conv::{syscall_ret, syscall_ret_owned_fd, syscall_ret_ssize_t};
+use super::super::conv::{syscall_ret, syscall_ret_owned_fd, syscall_ret_usize};
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
use super::super::offset::libc_fallocate;
#[cfg(not(any(
@@ -38,7 +36,7 @@ use super::super::offset::{libc_fstat, libc_fstatat, libc_ftruncate, libc_lseek,
target_os = "wasi",
)))]
use super::super::offset::{libc_fstatfs, libc_statfs};
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
use super::super::offset::{libc_fstatvfs, libc_statvfs};
#[cfg(all(
any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
@@ -49,8 +47,6 @@ use crate::fd::{BorrowedFd, OwnedFd};
use crate::ffi::CStr;
#[cfg(apple)]
use crate::ffi::CString;
-#[cfg(not(solarish))]
-use crate::fs::Access;
#[cfg(not(any(
apple,
netbsdlike,
@@ -87,12 +83,14 @@ use crate::fs::SealFlags;
target_os = "wasi",
)))]
use crate::fs::StatFs;
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+use crate::fs::XattrFlags;
#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::fs::{cwd, RenameFlags, ResolveFlags, Statx, StatxFlags};
+use crate::fs::{Access, Mode, OFlags, Stat, Timestamps};
#[cfg(not(any(apple, target_os = "redox", target_os = "wasi")))]
use crate::fs::{Dev, FileType};
-use crate::fs::{Mode, OFlags, Stat, Timestamps};
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
use crate::fs::{StatVfs, StatVfsMountFlags};
use crate::io::{self, SeekFrom};
#[cfg(not(target_os = "wasi"))]
@@ -162,7 +160,7 @@ pub(crate) fn openat(
mode: Mode,
) -> io::Result<OwnedFd> {
// Work around <https://sourceware.org/bugzilla/show_bug.cgi?id=17523>.
- // GLIBC versions before 2.25 don't handle `O_TMPFILE` correctly.
+ // glibc versions before 2.25 don't handle `O_TMPFILE` correctly.
#[cfg(all(unix, target_env = "gnu"))]
if oflags.contains(OFlags::TMPFILE) && crate::backend::if_glibc_is_less_than_2_25() {
return openat_via_syscall(dirfd, path, oflags, mode);
@@ -196,7 +194,7 @@ pub(crate) fn statfs(filename: &CStr) -> io::Result<StatFs> {
}
}
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
unsafe {
@@ -210,13 +208,12 @@ pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
#[inline]
pub(crate) fn readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
unsafe {
- ret_ssize_t(c::readlinkat(
+ ret_usize(c::readlinkat(
borrowed_fd(dirfd),
c_str(path),
buf.as_mut_ptr().cast::<c::c_char>(),
buf.len(),
))
- .map(|nread| nread as usize)
}
}
@@ -237,14 +234,13 @@ pub(crate) fn getdents_uninit(
buf: &mut [MaybeUninit<u8>],
) -> io::Result<usize> {
unsafe {
- syscall_ret_ssize_t(c::syscall(
+ syscall_ret_usize(c::syscall(
c::SYS_getdents64,
fd,
buf.as_mut_ptr().cast::<c::c_char>(),
buf.len(),
))
}
- .map(|nread| nread as usize)
}
#[cfg(not(target_os = "redox"))]
@@ -402,7 +398,7 @@ fn statat_old(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<
}
}
-#[cfg(not(any(solarish, target_os = "emscripten", target_os = "redox")))]
+#[cfg(not(any(target_os = "emscripten", target_os = "redox")))]
pub(crate) fn accessat(
dirfd: BorrowedFd<'_>,
path: &CStr,
@@ -549,7 +545,7 @@ pub(crate) fn utimensat(
flags_arg,
) != 0
{
- // Translate expected errno codes into ad-hoc integer
+ // Translate expected `errno` codes into ad-hoc integer
// values suitable for exit statuses.
let code = match libc_errno::errno().0 {
c::EACCES => 2,
@@ -573,7 +569,8 @@ pub(crate) fn utimensat(
let mut wstatus = 0;
let _ = ret_c_int(c::waitpid(child_pid, &mut wstatus, 0))?;
if c::WIFEXITED(wstatus) {
- // Translate our ad-hoc exit statuses back to errno codes.
+ // Translate our ad-hoc exit statuses back to `errno`
+ // codes.
match c::WEXITSTATUS(wstatus) {
0 => Ok(()),
2 => Err(io::Errno::ACCESS),
@@ -769,7 +766,7 @@ pub(crate) fn copy_file_range(
null_mut()
};
let copied = unsafe {
- syscall_ret_ssize_t(c::syscall(
+ syscall_ret_usize(c::syscall(
c::SYS_copy_file_range,
borrowed_fd(fd_in),
off_in_ptr,
@@ -785,7 +782,7 @@ pub(crate) fn copy_file_range(
if let Some(off_out) = off_out {
*off_out = off_out_val as u64;
}
- Ok(copied as usize)
+ Ok(copied)
}
#[cfg(not(any(
@@ -961,23 +958,23 @@ pub(crate) fn flock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::Result
#[cfg(any(target_os = "android", target_os = "linux"))]
pub(crate) fn syncfs(fd: BorrowedFd<'_>) -> io::Result<()> {
- unsafe { ret(c::syncfs(borrowed_fd(fd))) }
-}
-
-#[cfg(not(any(solarish, target_os = "redox", target_os = "wasi")))]
-pub(crate) fn sync() {
- // TODO: Remove this when upstream libc adds `sync`.
+ // Some versions of Android libc lack a `syncfs` function.
#[cfg(target_os = "android")]
unsafe {
- syscall_ret(c::syscall(c::SYS_sync)).ok();
+ syscall_ret(c::syscall(c::SYS_syncfs, borrowed_fd(fd)))
}
#[cfg(not(target_os = "android"))]
unsafe {
- c::sync()
+ ret(c::syncfs(borrowed_fd(fd)))
}
}
+#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
+pub(crate) fn sync() {
+ unsafe { c::sync() }
+}
+
pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result<Stat> {
// 32-bit and mips64 Linux: `struct stat64` is not y2038 compatible; use
// `statx`.
@@ -1033,7 +1030,7 @@ pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result<StatFs> {
}
}
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result<StatVfs> {
let mut statvfs = MaybeUninit::<libc_statvfs>::uninit();
unsafe {
@@ -1042,7 +1039,7 @@ pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result<StatVfs> {
}
}
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
fn libc_statvfs_to_statvfs(from: libc_statvfs) -> StatVfs {
StatVfs {
f_bsize: from.f_bsize as u64,
@@ -1322,13 +1319,12 @@ pub(crate) fn sendfile(
count: usize,
) -> io::Result<usize> {
unsafe {
- let nsent = ret_ssize_t(c::sendfile64(
+ ret_usize(c::sendfile64(
borrowed_fd(out_fd),
borrowed_fd(in_fd),
offset.map_or(null_mut(), crate::utils::as_mut_ptr).cast(),
count,
- ))?;
- Ok(nsent as usize)
+ ))
}
}
@@ -1525,7 +1521,7 @@ pub(crate) fn statx(
//
// [it's deprecated]: https://patchwork.kernel.org/project/linux-fsdevel/patch/20200505095915.11275-7-mszeredi@redhat.com/
#[cfg(not(any(target_os = "android", target_env = "musl")))]
- const STATX__RESERVED: u32 = libc::STATX__RESERVED as u32;
+ const STATX__RESERVED: u32 = c::STATX__RESERVED as u32;
#[cfg(any(target_os = "android", target_env = "musl"))]
const STATX__RESERVED: u32 = linux_raw_sys::general::STATX__RESERVED;
if (mask.bits() & STATX__RESERVED) == STATX__RESERVED {
@@ -1638,11 +1634,11 @@ pub(crate) fn getpath(fd: BorrowedFd<'_>) -> io::Result<CString> {
// instead.
let mut buf = alloc::vec![0; c::PATH_MAX as usize];
- // From the [macOS `fcntl` man page]:
+ // From the [macOS `fcntl` manual page]:
// `F_GETPATH` - Get the path of the file descriptor `Fildes`. The argument
// must be a buffer of size `MAXPATHLEN` or greater.
//
- // [macOS `fcntl` man page]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
+ // [macOS `fcntl` manual page]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
unsafe {
ret(c::fcntl(borrowed_fd(fd), c::F_GETPATH, buf.as_mut_ptr()))?;
}
@@ -1659,7 +1655,7 @@ pub(crate) fn getpath(fd: BorrowedFd<'_>) -> io::Result<CString> {
#[cfg(apple)]
pub(crate) fn fcntl_rdadvise(fd: BorrowedFd<'_>, offset: u64, len: u64) -> io::Result<()> {
- // From the [macOS `fcntl` man page]:
+ // From the [macOS `fcntl` manual page]:
// `F_RDADVISE` - Issue an advisory read async with no copy to user.
//
// The `F_RDADVISE` command operates on the following structure which holds
@@ -1672,7 +1668,7 @@ pub(crate) fn fcntl_rdadvise(fd: BorrowedFd<'_>, offset: u64, len: u64) -> io::R
// };
// ```
//
- // [macOS `fcntl` man page]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
+ // [macOS `fcntl` manual page]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
let ra_offset = match offset.try_into() {
Ok(len) => len,
// If this conversion fails, the user is providing an offset outside
@@ -1808,3 +1804,273 @@ pub(crate) fn mount(
pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> {
unsafe { ret(c::umount2(target.as_ptr(), flags.bits())) }
}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn getxattr(path: &CStr, name: &CStr, value: &mut [u8]) -> io::Result<usize> {
+ let value_ptr = value.as_mut_ptr();
+
+ #[cfg(not(apple))]
+ unsafe {
+ ret_usize(c::getxattr(
+ path.as_ptr(),
+ name.as_ptr(),
+ value_ptr.cast::<c::c_void>(),
+ value.len(),
+ ))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret_usize(c::getxattr(
+ path.as_ptr(),
+ name.as_ptr(),
+ value_ptr.cast::<c::c_void>(),
+ value.len(),
+ 0,
+ 0,
+ ))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn lgetxattr(path: &CStr, name: &CStr, value: &mut [u8]) -> io::Result<usize> {
+ let value_ptr = value.as_mut_ptr();
+
+ #[cfg(not(apple))]
+ unsafe {
+ ret_usize(c::lgetxattr(
+ path.as_ptr(),
+ name.as_ptr(),
+ value_ptr.cast::<c::c_void>(),
+ value.len(),
+ ))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret_usize(c::getxattr(
+ path.as_ptr(),
+ name.as_ptr(),
+ value_ptr.cast::<c::c_void>(),
+ value.len(),
+ 0,
+ c::XATTR_NOFOLLOW,
+ ))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn fgetxattr(fd: BorrowedFd<'_>, name: &CStr, value: &mut [u8]) -> io::Result<usize> {
+ let value_ptr = value.as_mut_ptr();
+
+ #[cfg(not(apple))]
+ unsafe {
+ ret_usize(c::fgetxattr(
+ borrowed_fd(fd),
+ name.as_ptr(),
+ value_ptr.cast::<c::c_void>(),
+ value.len(),
+ ))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret_usize(c::fgetxattr(
+ borrowed_fd(fd),
+ name.as_ptr(),
+ value_ptr.cast::<c::c_void>(),
+ value.len(),
+ 0,
+ 0,
+ ))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn setxattr(
+ path: &CStr,
+ name: &CStr,
+ value: &[u8],
+ flags: XattrFlags,
+) -> io::Result<()> {
+ #[cfg(not(apple))]
+ unsafe {
+ ret(c::setxattr(
+ path.as_ptr(),
+ name.as_ptr(),
+ value.as_ptr().cast::<c::c_void>(),
+ value.len(),
+ flags.bits() as i32,
+ ))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret(c::setxattr(
+ path.as_ptr(),
+ name.as_ptr(),
+ value.as_ptr().cast::<c::c_void>(),
+ value.len(),
+ 0,
+ flags.bits() as i32,
+ ))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn lsetxattr(
+ path: &CStr,
+ name: &CStr,
+ value: &[u8],
+ flags: XattrFlags,
+) -> io::Result<()> {
+ #[cfg(not(apple))]
+ unsafe {
+ ret(c::lsetxattr(
+ path.as_ptr(),
+ name.as_ptr(),
+ value.as_ptr().cast::<c::c_void>(),
+ value.len(),
+ flags.bits() as i32,
+ ))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret(c::setxattr(
+ path.as_ptr(),
+ name.as_ptr(),
+ value.as_ptr().cast::<c::c_void>(),
+ value.len(),
+ 0,
+ flags.bits() as i32 | c::XATTR_NOFOLLOW,
+ ))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn fsetxattr(
+ fd: BorrowedFd<'_>,
+ name: &CStr,
+ value: &[u8],
+ flags: XattrFlags,
+) -> io::Result<()> {
+ #[cfg(not(apple))]
+ unsafe {
+ ret(c::fsetxattr(
+ borrowed_fd(fd),
+ name.as_ptr(),
+ value.as_ptr().cast::<c::c_void>(),
+ value.len(),
+ flags.bits() as i32,
+ ))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret(c::fsetxattr(
+ borrowed_fd(fd),
+ name.as_ptr(),
+ value.as_ptr().cast::<c::c_void>(),
+ value.len(),
+ 0,
+ flags.bits() as i32,
+ ))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn listxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usize> {
+ #[cfg(not(apple))]
+ unsafe {
+ ret_usize(c::listxattr(path.as_ptr(), list.as_mut_ptr(), list.len()))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret_usize(c::listxattr(
+ path.as_ptr(),
+ list.as_mut_ptr(),
+ list.len(),
+ 0,
+ ))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn llistxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usize> {
+ #[cfg(not(apple))]
+ unsafe {
+ ret_usize(c::llistxattr(path.as_ptr(), list.as_mut_ptr(), list.len()))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret_usize(c::listxattr(
+ path.as_ptr(),
+ list.as_mut_ptr(),
+ list.len(),
+ c::XATTR_NOFOLLOW,
+ ))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn flistxattr(fd: BorrowedFd<'_>, list: &mut [c::c_char]) -> io::Result<usize> {
+ let fd = borrowed_fd(fd);
+
+ #[cfg(not(apple))]
+ unsafe {
+ ret_usize(c::flistxattr(fd, list.as_mut_ptr(), list.len()))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret_usize(c::flistxattr(fd, list.as_mut_ptr(), list.len(), 0))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn removexattr(path: &CStr, name: &CStr) -> io::Result<()> {
+ #[cfg(not(apple))]
+ unsafe {
+ ret(c::removexattr(path.as_ptr(), name.as_ptr()))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret(c::removexattr(path.as_ptr(), name.as_ptr(), 0))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn lremovexattr(path: &CStr, name: &CStr) -> io::Result<()> {
+ #[cfg(not(apple))]
+ unsafe {
+ ret(c::lremovexattr(path.as_ptr(), name.as_ptr()))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret(c::removexattr(
+ path.as_ptr(),
+ name.as_ptr(),
+ c::XATTR_NOFOLLOW,
+ ))
+ }
+}
+
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub(crate) fn fremovexattr(fd: BorrowedFd<'_>, name: &CStr) -> io::Result<()> {
+ let fd = borrowed_fd(fd);
+
+ #[cfg(not(apple))]
+ unsafe {
+ ret(c::fremovexattr(fd, name.as_ptr()))
+ }
+
+ #[cfg(apple)]
+ unsafe {
+ ret(c::fremovexattr(fd, name.as_ptr(), 0))
+ }
+}
diff --git a/vendor/rustix/src/backend/libc/fs/types.rs b/vendor/rustix/src/backend/libc/fs/types.rs
index f635f2cca..0cf7fe8ff 100644
--- a/vendor/rustix/src/backend/libc/fs/types.rs
+++ b/vendor/rustix/src/backend/libc/fs/types.rs
@@ -138,8 +138,8 @@ bitflags! {
}
impl Mode {
- /// Construct a `Mode` from the mode bits of the `st_mode` field of
- /// a `Stat`.
+ /// Construct a `Mode` from the mode bits of the `st_mode` field of a
+ /// `Stat`.
#[inline]
pub const fn from_raw_mode(st_mode: RawMode) -> Self {
Self::from_bits_truncate(st_mode)
@@ -334,7 +334,9 @@ mod copyfile {
#[cfg(apple)]
bitflags! {
- /// `COPYFILE_*` constants.
+ /// `COPYFILE_*` constants for use with [`fcopyfile`].
+ ///
+ /// [`fcopyfile`]: crate::fs::fcopyfile
pub struct CopyfileFlags: c::c_uint {
/// `COPYFILE_ACL`
const ACL = copyfile::ACL;
@@ -440,6 +442,7 @@ pub enum FileType {
impl FileType {
/// Construct a `FileType` from the `S_IFMT` bits of the `st_mode` field of
/// a `Stat`.
+ #[inline]
pub const fn from_raw_mode(st_mode: RawMode) -> Self {
match (st_mode as c::mode_t) & c::S_IFMT {
c::S_IFREG => Self::RegularFile,
@@ -456,6 +459,7 @@ impl FileType {
}
/// Construct an `st_mode` value from `Stat`.
+ #[inline]
pub const fn as_raw_mode(self) -> RawMode {
match self {
Self::RegularFile => c::S_IFREG as RawMode,
@@ -473,6 +477,7 @@ impl FileType {
/// Construct a `FileType` from the `d_type` field of a `c::dirent`.
#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox")))]
+ #[inline]
pub(crate) const fn from_dirent_d_type(d_type: u8) -> Self {
match d_type {
c::DT_REG => Self::RegularFile,
@@ -773,43 +778,43 @@ bitflags! {
}
}
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
bitflags! {
/// `ST_*` constants for use with [`StatVfs`].
pub struct StatVfsMountFlags: u64 {
/// `ST_MANDLOCK`
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
- const MANDLOCK = libc::ST_MANDLOCK as u64;
+ const MANDLOCK = c::ST_MANDLOCK as u64;
/// `ST_NOATIME`
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
- const NOATIME = libc::ST_NOATIME as u64;
+ const NOATIME = c::ST_NOATIME as u64;
/// `ST_NODEV`
#[cfg(any(target_os = "aix", target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
- const NODEV = libc::ST_NODEV as u64;
+ const NODEV = c::ST_NODEV as u64;
/// `ST_NODIRATIME`
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
- const NODIRATIME = libc::ST_NODIRATIME as u64;
+ const NODIRATIME = c::ST_NODIRATIME as u64;
/// `ST_NOEXEC`
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
- const NOEXEC = libc::ST_NOEXEC as u64;
+ const NOEXEC = c::ST_NOEXEC as u64;
/// `ST_NOSUID`
- const NOSUID = libc::ST_NOSUID as u64;
+ const NOSUID = c::ST_NOSUID as u64;
/// `ST_RDONLY`
- const RDONLY = libc::ST_RDONLY as u64;
+ const RDONLY = c::ST_RDONLY as u64;
/// `ST_RELATIME`
#[cfg(any(target_os = "android", all(target_os = "linux", target_env = "gnu")))]
- const RELATIME = libc::ST_RELATIME as u64;
+ const RELATIME = c::ST_RELATIME as u64;
/// `ST_SYNCHRONOUS`
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
- const SYNCHRONOUS = libc::ST_SYNCHRONOUS as u64;
+ const SYNCHRONOUS = c::ST_SYNCHRONOUS as u64;
}
}
@@ -915,7 +920,7 @@ pub type StatFs = c::statfs64;
///
/// [`statvfs`]: crate::fs::statvfs
/// [`fstatvfs`]: crate::fs::fstatvfs
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[allow(missing_docs)]
pub struct StatVfs {
pub f_bsize: u64,
@@ -1106,7 +1111,7 @@ bitflags! {
bitflags! {
/// `MS_*` constants for use with [`change_mount`].
///
- /// [`change_mount`]: crate::fs::mount::change_mount.
+ /// [`change_mount`]: crate::fs::mount::change_mount
pub struct MountPropagationFlags: c::c_ulong {
/// `MS_SHARED`
const SHARED = c::MS_SHARED;
diff --git a/vendor/rustix/src/backend/libc/io/syscalls.rs b/vendor/rustix/src/backend/libc/io/syscalls.rs
index 03f9294d9..b74a63fa3 100644
--- a/vendor/rustix/src/backend/libc/io/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/io/syscalls.rs
@@ -3,9 +3,12 @@
use super::super::c;
#[cfg(any(target_os = "android", target_os = "linux"))]
use super::super::conv::syscall_ret_owned_fd;
-use super::super::conv::{
- borrowed_fd, ret, ret_c_int, ret_discarded_fd, ret_owned_fd, ret_ssize_t,
-};
+#[cfg(any(
+ target_os = "android",
+ all(target_os = "linux", not(target_env = "gnu")),
+))]
+use super::super::conv::syscall_ret_usize;
+use super::super::conv::{borrowed_fd, ret, ret_c_int, ret_discarded_fd, ret_owned_fd, ret_usize};
use super::super::offset::{libc_pread, libc_pwrite};
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
use super::super::offset::{libc_preadv, libc_pwritev};
@@ -18,11 +21,18 @@ use crate::io::kqueue::Event;
use crate::io::port::Event;
#[cfg(not(any(target_os = "aix", target_os = "wasi")))]
use crate::io::DupFlags;
+#[cfg(any(
+ target_os = "android",
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "linux"
+))]
+use crate::io::EventfdFlags;
#[cfg(not(any(apple, target_os = "aix", target_os = "haiku", target_os = "wasi")))]
use crate::io::PipeFlags;
use crate::io::{self, FdFlags, IoSlice, IoSliceMut, PollFd};
#[cfg(any(target_os = "android", target_os = "linux"))]
-use crate::io::{EventfdFlags, IoSliceRaw, ReadWriteFlags, SpliceFlags};
+use crate::io::{IoSliceRaw, ReadWriteFlags, SpliceFlags};
use core::cmp::min;
use core::convert::TryInto;
use core::mem::MaybeUninit;
@@ -32,25 +42,23 @@ use core::ptr;
use libc_errno::errno;
pub(crate) fn read(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> {
- let nread = unsafe {
- ret_ssize_t(c::read(
+ unsafe {
+ ret_usize(c::read(
borrowed_fd(fd),
buf.as_mut_ptr().cast(),
min(buf.len(), READ_LIMIT),
- ))?
- };
- Ok(nread as usize)
+ ))
+ }
}
pub(crate) fn write(fd: BorrowedFd<'_>, buf: &[u8]) -> io::Result<usize> {
- let nwritten = unsafe {
- ret_ssize_t(c::write(
+ unsafe {
+ ret_usize(c::write(
borrowed_fd(fd),
buf.as_ptr().cast(),
min(buf.len(), READ_LIMIT),
- ))?
- };
- Ok(nwritten as usize)
+ ))
+ }
}
pub(crate) fn pread(fd: BorrowedFd<'_>, buf: &mut [u8], offset: u64) -> io::Result<usize> {
@@ -59,15 +67,14 @@ pub(crate) fn pread(fd: BorrowedFd<'_>, buf: &mut [u8], offset: u64) -> io::Resu
// Silently cast; we'll get `EINVAL` if the value is negative.
let offset = offset as i64;
- let nread = unsafe {
- ret_ssize_t(libc_pread(
+ unsafe {
+ ret_usize(libc_pread(
borrowed_fd(fd),
buf.as_mut_ptr().cast(),
len,
offset,
- ))?
- };
- Ok(nread as usize)
+ ))
+ }
}
pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], offset: u64) -> io::Result<usize> {
@@ -76,37 +83,34 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], offset: u64) -> io::Result<
// Silently cast; we'll get `EINVAL` if the value is negative.
let offset = offset as i64;
- let nwritten = unsafe {
- ret_ssize_t(libc_pwrite(
+ unsafe {
+ ret_usize(libc_pwrite(
borrowed_fd(fd),
buf.as_ptr().cast(),
len,
offset,
- ))?
- };
- Ok(nwritten as usize)
+ ))
+ }
}
pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut]) -> io::Result<usize> {
- let nread = unsafe {
- ret_ssize_t(c::readv(
+ unsafe {
+ ret_usize(c::readv(
borrowed_fd(fd),
bufs.as_ptr().cast::<c::iovec>(),
min(bufs.len(), max_iov()) as c::c_int,
- ))?
- };
- Ok(nread as usize)
+ ))
+ }
}
pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice]) -> io::Result<usize> {
- let nwritten = unsafe {
- ret_ssize_t(c::writev(
+ unsafe {
+ ret_usize(c::writev(
borrowed_fd(fd),
bufs.as_ptr().cast::<c::iovec>(),
min(bufs.len(), max_iov()) as c::c_int,
- ))?
- };
- Ok(nwritten as usize)
+ ))
+ }
}
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
@@ -117,30 +121,28 @@ pub(crate) fn preadv(
) -> io::Result<usize> {
// Silently cast; we'll get `EINVAL` if the value is negative.
let offset = offset as i64;
- let nread = unsafe {
- ret_ssize_t(libc_preadv(
+ unsafe {
+ ret_usize(libc_preadv(
borrowed_fd(fd),
bufs.as_ptr().cast::<c::iovec>(),
min(bufs.len(), max_iov()) as c::c_int,
offset,
- ))?
- };
- Ok(nread as usize)
+ ))
+ }
}
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice], offset: u64) -> io::Result<usize> {
// Silently cast; we'll get `EINVAL` if the value is negative.
let offset = offset as i64;
- let nwritten = unsafe {
- ret_ssize_t(libc_pwritev(
+ unsafe {
+ ret_usize(libc_pwritev(
borrowed_fd(fd),
bufs.as_ptr().cast::<c::iovec>(),
min(bufs.len(), max_iov()) as c::c_int,
offset,
- ))?
- };
- Ok(nwritten as usize)
+ ))
+ }
}
#[cfg(all(target_os = "linux", target_env = "gnu"))]
@@ -152,20 +154,19 @@ pub(crate) fn preadv2(
) -> io::Result<usize> {
// Silently cast; we'll get `EINVAL` if the value is negative.
let offset = offset as i64;
- let nread = unsafe {
- ret_ssize_t(libc_preadv2(
+ unsafe {
+ ret_usize(libc_preadv2(
borrowed_fd(fd),
bufs.as_ptr().cast::<c::iovec>(),
min(bufs.len(), max_iov()) as c::c_int,
offset,
flags.bits(),
- ))?
- };
- Ok(nread as usize)
+ ))
+ }
}
/// At present, `libc` only has `preadv2` defined for glibc. On other
-/// ABIs, use `libc::syscall`.
+/// ABIs, use `c::syscall`.
#[cfg(any(
target_os = "android",
all(target_os = "linux", not(target_env = "gnu")),
@@ -179,17 +180,16 @@ pub(crate) fn preadv2(
) -> io::Result<usize> {
// Silently cast; we'll get `EINVAL` if the value is negative.
let offset = offset as i64;
- let nread = unsafe {
- ret_ssize_t(libc::syscall(
- libc::SYS_preadv2,
+ unsafe {
+ syscall_ret_usize(c::syscall(
+ c::SYS_preadv2,
borrowed_fd(fd),
bufs.as_ptr().cast::<c::iovec>(),
min(bufs.len(), max_iov()) as c::c_int,
offset,
flags.bits(),
- ) as c::ssize_t)?
- };
- Ok(nread as usize)
+ ))
+ }
}
#[cfg(all(target_os = "linux", target_env = "gnu"))]
@@ -201,20 +201,19 @@ pub(crate) fn pwritev2(
) -> io::Result<usize> {
// Silently cast; we'll get `EINVAL` if the value is negative.
let offset = offset as i64;
- let nwritten = unsafe {
- ret_ssize_t(libc_pwritev2(
+ unsafe {
+ ret_usize(libc_pwritev2(
borrowed_fd(fd),
bufs.as_ptr().cast::<c::iovec>(),
min(bufs.len(), max_iov()) as c::c_int,
offset,
flags.bits(),
- ))?
- };
- Ok(nwritten as usize)
+ ))
+ }
}
/// At present, `libc` only has `pwritev2` defined for glibc. On other
-/// ABIs, use `libc::syscall`.
+/// ABIs, use `c::syscall`.
#[cfg(any(
target_os = "android",
all(target_os = "linux", not(target_env = "gnu")),
@@ -228,25 +227,24 @@ pub(crate) fn pwritev2(
) -> io::Result<usize> {
// Silently cast; we'll get `EINVAL` if the value is negative.
let offset = offset as i64;
- let nwritten = unsafe {
- ret_ssize_t(libc::syscall(
- libc::SYS_pwritev2,
+ unsafe {
+ syscall_ret_usize(c::syscall(
+ c::SYS_pwritev2,
borrowed_fd(fd),
bufs.as_ptr().cast::<c::iovec>(),
min(bufs.len(), max_iov()) as c::c_int,
offset,
flags.bits(),
- ) as c::ssize_t)?
- };
- Ok(nwritten as usize)
+ ))
+ }
}
// These functions are derived from Rust's library/std/src/sys/unix/fd.rs at
// revision 326ef470a8b379a180d6dc4bbef08990698a737a.
// The maximum read limit on most POSIX-like systems is `SSIZE_MAX`, with the
-// man page quoting that if the count of bytes to read is greater than
-// `SSIZE_MAX` the result is "unspecified".
+// manual page quoting that if the count of bytes to read is greater than
+// `SSIZE_MAX` the result is “unspecified”.
//
// On macOS, however, apparently the 64-bit libc is either buggy or
// intentionally showing odd behavior by rejecting any read with a size larger
@@ -293,6 +291,11 @@ pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd>
unsafe { syscall_ret_owned_fd(c::syscall(c::SYS_eventfd2, initval, flags.bits())) }
}
+#[cfg(any(target_os = "freebsd", target_os = "illumos"))]
+pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd> {
+ unsafe { ret_owned_fd(c::eventfd(initval, flags.bits())) }
+}
+
#[cfg(any(target_os = "android", target_os = "linux"))]
#[inline]
pub(crate) fn ioctl_blksszget(fd: BorrowedFd) -> io::Result<u32> {
@@ -338,13 +341,15 @@ pub(crate) fn ioctl_fionbio(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> {
#[cfg(any(target_os = "android", target_os = "linux"))]
pub(crate) fn ioctl_ficlone(fd: BorrowedFd<'_>, src_fd: BorrowedFd<'_>) -> io::Result<()> {
- // TODO: Enable `ioctl_ficlone` for android when upstream is updated.
- // TODO: Enable `ioctl_ficlone` for more architectures when upstream is
- // updated.
- #[cfg(all(
- target_os = "linux",
- any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")
- ))]
+ // TODO: Enable this on mips and power once libc is updated.
+ #[cfg(not(any(
+ target_arch = "mips",
+ target_arch = "mips64",
+ target_arch = "powerpc",
+ target_arch = "powerpc64",
+ target_arch = "sparc",
+ target_arch = "sparc64"
+ )))]
unsafe {
ret(c::ioctl(
borrowed_fd(fd),
@@ -352,10 +357,15 @@ pub(crate) fn ioctl_ficlone(fd: BorrowedFd<'_>, src_fd: BorrowedFd<'_>) -> io::R
borrowed_fd(src_fd),
))
}
- #[cfg(not(all(
- target_os = "linux",
- any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")
- )))]
+
+ #[cfg(any(
+ target_arch = "mips",
+ target_arch = "mips64",
+ target_arch = "powerpc",
+ target_arch = "powerpc64",
+ target_arch = "sparc",
+ target_arch = "sparc64"
+ ))]
{
let _ = fd;
let _ = src_fd;
@@ -475,7 +485,13 @@ pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, _flags: DupFlags) -> i
#[cfg(apple)]
pub(crate) fn ioctl_fioclex(fd: BorrowedFd<'_>) -> io::Result<()> {
- unsafe { ret(c::ioctl(borrowed_fd(fd), c::FIOCLEX)) }
+ unsafe {
+ ret(c::ioctl(
+ borrowed_fd(fd),
+ c::FIOCLEX,
+ core::ptr::null_mut::<u8>(),
+ ))
+ }
}
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
@@ -565,17 +581,16 @@ pub fn splice(
.map(|off| (off as *mut u64).cast())
.unwrap_or(ptr::null_mut());
- ret_ssize_t(unsafe {
- c::splice(
+ unsafe {
+ ret_usize(c::splice(
borrowed_fd(fd_in),
off_in,
borrowed_fd(fd_out),
off_out,
len,
flags.bits(),
- )
- })
- .map(|spliced| spliced as usize)
+ ))
+ }
}
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -585,13 +600,12 @@ pub unsafe fn vmsplice(
bufs: &[IoSliceRaw],
flags: SpliceFlags,
) -> io::Result<usize> {
- ret_ssize_t(c::vmsplice(
+ ret_usize(c::vmsplice(
borrowed_fd(fd),
bufs.as_ptr().cast::<c::iovec>(),
min(bufs.len(), max_iov()),
flags.bits(),
))
- .map(|spliced| spliced as usize)
}
#[cfg(solarish)]
diff --git a/vendor/rustix/src/backend/libc/io/types.rs b/vendor/rustix/src/backend/libc/io/types.rs
index cbdd734b9..90a5e15b5 100644
--- a/vendor/rustix/src/backend/libc/io/types.rs
+++ b/vendor/rustix/src/backend/libc/io/types.rs
@@ -87,7 +87,12 @@ bitflags! {
}
}
-#[cfg(any(target_os = "android", target_os = "linux"))]
+#[cfg(any(
+ target_os = "android",
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "linux"
+))]
bitflags! {
/// `EFD_*` flags for use with [`eventfd`].
///
@@ -129,7 +134,7 @@ pub struct IoSliceRaw<'a> {
#[cfg(any(target_os = "android", target_os = "linux"))]
impl<'a> IoSliceRaw<'a> {
- /// Creates a new IoSlice wrapping a byte slice.
+ /// Creates a new `IoSlice` wrapping a byte slice.
pub fn from_slice(buf: &'a [u8]) -> Self {
IoSliceRaw {
_buf: c::iovec {
@@ -140,7 +145,7 @@ impl<'a> IoSliceRaw<'a> {
}
}
- /// Creates a new IoSlice wrapping a mutable byte slice.
+ /// Creates a new `IoSlice` wrapping a mutable byte slice.
pub fn from_slice_mut(buf: &'a mut [u8]) -> Self {
IoSliceRaw {
_buf: c::iovec {
diff --git a/vendor/rustix/src/backend/libc/mm/types.rs b/vendor/rustix/src/backend/libc/mm/types.rs
index cd6e521d2..798fda86b 100644
--- a/vendor/rustix/src/backend/libc/mm/types.rs
+++ b/vendor/rustix/src/backend/libc/mm/types.rs
@@ -346,9 +346,9 @@ pub enum Advice {
}
#[cfg(target_os = "emscripten")]
+#[allow(non_upper_case_globals)]
impl Advice {
/// `POSIX_MADV_DONTNEED`
- #[allow(non_upper_case_globals)]
pub const DontNeed: Self = Self::Normal;
}
diff --git a/vendor/rustix/src/backend/libc/mod.rs b/vendor/rustix/src/backend/libc/mod.rs
index 1961d1291..f3433903d 100644
--- a/vendor/rustix/src/backend/libc/mod.rs
+++ b/vendor/rustix/src/backend/libc/mod.rs
@@ -11,10 +11,6 @@
// one platform where it's redundant on another.
#![allow(clippy::useless_conversion)]
-#[cfg(not(any(windows, target_os = "wasi")))]
-#[macro_use]
-mod weak;
-
mod conv;
mod offset;
diff --git a/vendor/rustix/src/backend/libc/net/send_recv.rs b/vendor/rustix/src/backend/libc/net/send_recv.rs
index 114807808..49c6f2c22 100644
--- a/vendor/rustix/src/backend/libc/net/send_recv.rs
+++ b/vendor/rustix/src/backend/libc/net/send_recv.rs
@@ -2,7 +2,10 @@ use super::super::c;
use bitflags::bitflags;
bitflags! {
- /// `MSG_*`
+ /// `MSG_* flags for use with [`send`], [`send_to`], and related functions.
+ ///
+ /// [`send`]: crate::net::send
+ /// [`sendto`]: crate::net::sendto
pub struct SendFlags: i32 {
/// `MSG_CONFIRM`
#[cfg(not(any(
@@ -37,7 +40,10 @@ bitflags! {
}
bitflags! {
- /// `MSG_*`
+ /// `MSG_* flags for use with [`recv`], [`recvfrom`], and related functions.
+ ///
+ /// [`recv`]: crate::net::recv
+ /// [`recvfrom`]: crate::net::recvfrom
pub struct RecvFlags: i32 {
#[cfg(not(any(apple, solarish, windows, target_os = "haiku")))]
/// `MSG_CMSG_CLOEXEC`
diff --git a/vendor/rustix/src/backend/libc/net/syscalls.rs b/vendor/rustix/src/backend/libc/net/syscalls.rs
index ed4494394..ac260e552 100644
--- a/vendor/rustix/src/backend/libc/net/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/net/syscalls.rs
@@ -12,7 +12,7 @@ use super::read_sockaddr::{maybe_read_sockaddr_os, read_sockaddr_os};
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
use super::send_recv::{RecvFlags, SendFlags};
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-use super::types::{AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType};
+use super::types::{AddressFamily, Protocol, Shutdown, SocketFlags, SocketType};
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
use super::write_sockaddr::{encode_sockaddr_v4, encode_sockaddr_v6};
use crate::fd::{BorrowedFd, OwnedFd};
@@ -26,28 +26,26 @@ use core::ptr::null_mut;
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
pub(crate) fn recv(fd: BorrowedFd<'_>, buf: &mut [u8], flags: RecvFlags) -> io::Result<usize> {
- let nrecv = unsafe {
+ unsafe {
ret_send_recv(c::recv(
borrowed_fd(fd),
buf.as_mut_ptr().cast(),
send_recv_len(buf.len()),
flags.bits(),
- ))?
- };
- Ok(nrecv as usize)
+ ))
+ }
}
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
pub(crate) fn send(fd: BorrowedFd<'_>, buf: &[u8], flags: SendFlags) -> io::Result<usize> {
- let nwritten = unsafe {
+ unsafe {
ret_send_recv(c::send(
borrowed_fd(fd),
buf.as_ptr().cast(),
send_recv_len(buf.len()),
flags.bits(),
- ))?
- };
- Ok(nwritten as usize)
+ ))
+ }
}
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
@@ -65,18 +63,20 @@ pub(crate) fn recvfrom(
// `AF_UNSPEC` so that we can detect this case.
initialize_family_to_unspec(storage.as_mut_ptr());
- let nread = ret_send_recv(c::recvfrom(
+ ret_send_recv(c::recvfrom(
borrowed_fd(fd),
buf.as_mut_ptr().cast(),
send_recv_len(buf.len()),
flags.bits(),
storage.as_mut_ptr().cast(),
&mut len,
- ))?;
- Ok((
- nread as usize,
- maybe_read_sockaddr_os(storage.as_ptr(), len.try_into().unwrap()),
))
+ .map(|nread| {
+ (
+ nread,
+ maybe_read_sockaddr_os(storage.as_ptr(), len.try_into().unwrap()),
+ )
+ })
}
}
@@ -87,7 +87,7 @@ pub(crate) fn sendto_v4(
flags: SendFlags,
addr: &SocketAddrV4,
) -> io::Result<usize> {
- let nwritten = unsafe {
+ unsafe {
ret_send_recv(c::sendto(
borrowed_fd(fd),
buf.as_ptr().cast(),
@@ -95,9 +95,8 @@ pub(crate) fn sendto_v4(
flags.bits(),
as_ptr(&encode_sockaddr_v4(addr)).cast::<c::sockaddr>(),
size_of::<SocketAddrV4>() as _,
- ))?
- };
- Ok(nwritten as usize)
+ ))
+ }
}
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
@@ -107,7 +106,7 @@ pub(crate) fn sendto_v6(
flags: SendFlags,
addr: &SocketAddrV6,
) -> io::Result<usize> {
- let nwritten = unsafe {
+ unsafe {
ret_send_recv(c::sendto(
borrowed_fd(fd),
buf.as_ptr().cast(),
@@ -115,9 +114,8 @@ pub(crate) fn sendto_v6(
flags.bits(),
as_ptr(&encode_sockaddr_v6(addr)).cast::<c::sockaddr>(),
size_of::<SocketAddrV6>() as _,
- ))?
- };
- Ok(nwritten as usize)
+ ))
+ }
}
#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
@@ -127,7 +125,7 @@ pub(crate) fn sendto_unix(
flags: SendFlags,
addr: &SocketAddrUnix,
) -> io::Result<usize> {
- let nwritten = unsafe {
+ unsafe {
ret_send_recv(c::sendto(
borrowed_fd(fd),
buf.as_ptr().cast(),
@@ -135,9 +133,8 @@ pub(crate) fn sendto_unix(
flags.bits(),
as_ptr(&addr.unix).cast(),
addr.addr_len(),
- ))?
- };
- Ok(nwritten as usize)
+ ))
+ }
}
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
@@ -257,7 +254,7 @@ pub(crate) fn accept(sockfd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
target_os = "redox",
target_os = "wasi",
)))]
-pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, flags: AcceptFlags) -> io::Result<OwnedFd> {
+pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, flags: SocketFlags) -> io::Result<OwnedFd> {
unsafe {
let owned_fd = ret_owned_fd(c::accept4(
borrowed_fd(sockfd),
@@ -295,7 +292,7 @@ pub(crate) fn acceptfrom(sockfd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option<
)))]
pub(crate) fn acceptfrom_with(
sockfd: BorrowedFd<'_>,
- flags: AcceptFlags,
+ flags: SocketFlags,
) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> {
unsafe {
let mut storage = MaybeUninit::<c::sockaddr_storage>::uninit();
@@ -314,18 +311,18 @@ pub(crate) fn acceptfrom_with(
}
/// Darwin lacks `accept4`, but does have `accept`. We define
-/// `AcceptFlags` to have no flags, so we can discard it here.
+/// `SocketFlags` to have no flags, so we can discard it here.
#[cfg(any(apple, windows, target_os = "haiku"))]
-pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: AcceptFlags) -> io::Result<OwnedFd> {
+pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: SocketFlags) -> io::Result<OwnedFd> {
accept(sockfd)
}
/// Darwin lacks `accept4`, but does have `accept`. We define
-/// `AcceptFlags` to have no flags, so we can discard it here.
+/// `SocketFlags` to have no flags, so we can discard it here.
#[cfg(any(apple, windows, target_os = "haiku"))]
pub(crate) fn acceptfrom_with(
sockfd: BorrowedFd<'_>,
- _flags: AcceptFlags,
+ _flags: SocketFlags,
) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> {
acceptfrom(sockfd)
}
@@ -555,7 +552,7 @@ pub(crate) mod sockopt {
// Rust's musl libc bindings deprecated `time_t` while they
// transition to 64-bit `time_t`. What we want here is just
- // "whatever type `timeval`'s `tv_sec` is", so we're ok using
+ // “whatever type `timeval`'s `tv_sec` is”, so we're ok using
// the deprecated type.
#[allow(deprecated)]
let tv_sec = timeout.as_secs().try_into().unwrap_or(c::time_t::MAX);
@@ -647,16 +644,53 @@ pub(crate) mod sockopt {
}
#[inline]
- pub(crate) fn get_socket_error(fd: BorrowedFd<'_>) -> io::Result<Result<(), crate::io::Errno>> {
+ pub(crate) fn get_socket_error(fd: BorrowedFd<'_>) -> io::Result<Result<(), io::Errno>> {
let err: c::c_int = getsockopt(fd, c::SOL_SOCKET as _, c::SO_ERROR)?;
Ok(if err == 0 {
Ok(())
} else {
- Err(crate::io::Errno::from_raw_os_error(err))
+ Err(io::Errno::from_raw_os_error(err))
})
}
#[inline]
+ pub(crate) fn set_socket_keepalive(fd: BorrowedFd<'_>, keepalive: bool) -> io::Result<()> {
+ setsockopt(
+ fd,
+ c::SOL_SOCKET as _,
+ c::SO_KEEPALIVE,
+ from_bool(keepalive),
+ )
+ }
+
+ #[inline]
+ pub(crate) fn get_socket_keepalive(fd: BorrowedFd<'_>) -> io::Result<bool> {
+ getsockopt(fd, c::SOL_SOCKET as _, c::SO_KEEPALIVE).map(to_bool)
+ }
+
+ #[inline]
+ pub(crate) fn set_socket_recv_buffer_size(fd: BorrowedFd<'_>, size: usize) -> io::Result<()> {
+ let size: c::c_int = size.try_into().map_err(|_| io::Errno::INVAL)?;
+ setsockopt(fd, c::SOL_SOCKET as _, c::SO_RCVBUF, size)
+ }
+
+ #[inline]
+ pub(crate) fn get_socket_recv_buffer_size(fd: BorrowedFd<'_>) -> io::Result<usize> {
+ getsockopt(fd, c::SOL_SOCKET as _, c::SO_RCVBUF).map(|size: u32| size as usize)
+ }
+
+ #[inline]
+ pub(crate) fn set_socket_send_buffer_size(fd: BorrowedFd<'_>, size: usize) -> io::Result<()> {
+ let size: c::c_int = size.try_into().map_err(|_| io::Errno::INVAL)?;
+ setsockopt(fd, c::SOL_SOCKET as _, c::SO_SNDBUF, size)
+ }
+
+ #[inline]
+ pub(crate) fn get_socket_send_buffer_size(fd: BorrowedFd<'_>) -> io::Result<usize> {
+ getsockopt(fd, c::SOL_SOCKET as _, c::SO_SNDBUF).map(|size: u32| size as usize)
+ }
+
+ #[inline]
pub(crate) fn set_ip_ttl(fd: BorrowedFd<'_>, ttl: u32) -> io::Result<()> {
setsockopt(fd, c::IPPROTO_IP as _, c::IP_TTL, ttl)
}
@@ -791,6 +825,20 @@ pub(crate) mod sockopt {
}
#[inline]
+ pub(crate) fn get_ipv6_unicast_hops(fd: BorrowedFd<'_>) -> io::Result<u8> {
+ getsockopt(fd, c::IPPROTO_IPV6 as _, c::IPV6_UNICAST_HOPS).map(|hops: c::c_int| hops as u8)
+ }
+
+ #[inline]
+ pub(crate) fn set_ipv6_unicast_hops(fd: BorrowedFd<'_>, hops: Option<u8>) -> io::Result<()> {
+ let hops = match hops {
+ Some(hops) => hops as c::c_int,
+ None => -1,
+ };
+ setsockopt(fd, c::IPPROTO_IPV6 as _, c::IPV6_UNICAST_HOPS, hops)
+ }
+
+ #[inline]
pub(crate) fn set_tcp_nodelay(fd: BorrowedFd<'_>, nodelay: bool) -> io::Result<()> {
setsockopt(fd, c::IPPROTO_TCP as _, c::TCP_NODELAY, from_bool(nodelay))
}
diff --git a/vendor/rustix/src/backend/libc/net/types.rs b/vendor/rustix/src/backend/libc/net/types.rs
index 54f60ca50..d1d769cb4 100644
--- a/vendor/rustix/src/backend/libc/net/types.rs
+++ b/vendor/rustix/src/backend/libc/net/types.rs
@@ -53,6 +53,7 @@ pub type RawAddressFamily = c::sa_family_t;
pub struct AddressFamily(pub(crate) RawAddressFamily);
#[rustfmt::skip]
+#[allow(non_upper_case_globals)]
impl AddressFamily {
/// `AF_UNSPEC`
pub const UNSPEC: Self = Self(c::AF_UNSPEC as _);
@@ -123,7 +124,6 @@ impl AddressFamily {
)))]
pub const ROSE: Self = Self(c::AF_ROSE as _);
/// `AF_DECnet`
- #[allow(non_upper_case_globals)]
#[cfg(not(target_os = "haiku"))]
pub const DECnet: Self = Self(c::AF_DECnet as _);
/// `AF_NETBEUI`
@@ -294,7 +294,10 @@ impl AddressFamily {
#[doc(hidden)]
pub type RawProtocol = i32;
-/// `IPPROTO_*`
+/// `IPPROTO_*` constants for use with [`socket`] and [`socket_with`].
+///
+/// [`socket`]: crate::net::socket
+/// [`socket_with`]: crate::net::socket_with
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[repr(transparent)]
pub struct Protocol(pub(crate) RawProtocol);
@@ -464,25 +467,12 @@ pub enum Shutdown {
}
bitflags! {
- /// `SOCK_*` constants for use with [`accept_with`] and [`acceptfrom_with`].
+ /// `SOCK_*` constants for use with [`socket_with`], [`accept_with`] and
+ /// [`acceptfrom_with`].
///
+ /// [`socket_with`]: crate::net::socket_with
/// [`accept_with`]: crate::net::accept_with
/// [`acceptfrom_with`]: crate::net::acceptfrom_with
- pub struct AcceptFlags: c::c_int {
- /// `SOCK_NONBLOCK`
- #[cfg(not(any(apple, windows, target_os = "haiku")))]
- const NONBLOCK = c::SOCK_NONBLOCK;
-
- /// `SOCK_CLOEXEC`
- #[cfg(not(any(apple, windows, target_os = "haiku")))]
- const CLOEXEC = c::SOCK_CLOEXEC;
- }
-}
-
-bitflags! {
- /// `SOCK_*` constants for use with [`socket`].
- ///
- /// [`socket`]: crate::net::socket
pub struct SocketFlags: c::c_int {
/// `SOCK_NONBLOCK`
#[cfg(not(any(apple, windows, target_os = "haiku")))]
diff --git a/vendor/rustix/src/backend/libc/offset.rs b/vendor/rustix/src/backend/libc/offset.rs
index 9747eb954..d7a803415 100644
--- a/vendor/rustix/src/backend/libc/offset.rs
+++ b/vendor/rustix/src/backend/libc/offset.rs
@@ -6,15 +6,15 @@ use super::c;
#[cfg(not(any(linux_like, windows)))]
#[cfg(feature = "fs")]
pub(super) use c::{
- fstat as libc_fstat, fstatat as libc_fstatat, ftruncate as libc_ftruncate, lseek as libc_lseek,
- off_t as libc_off_t,
+ fstat as libc_fstat, fstatat as libc_fstatat, ftruncate as libc_ftruncate, ino_t as libc_ino_t,
+ lseek as libc_lseek, off_t as libc_off_t,
};
#[cfg(linux_like)]
#[cfg(feature = "fs")]
pub(super) use c::{
fstat64 as libc_fstat, fstatat64 as libc_fstatat, ftruncate64 as libc_ftruncate,
- lseek64 as libc_lseek, off64_t as libc_off_t,
+ ino64_t as libc_ino_t, lseek64 as libc_lseek, off64_t as libc_off_t,
};
#[cfg(linux_like)]
@@ -36,12 +36,11 @@ pub(super) use c::{rlimit as libc_rlimit, RLIM_INFINITY as LIBC_RLIM_INFINITY};
#[cfg(not(any(linux_like, windows, target_os = "fuchsia", target_os = "wasi")))]
pub(super) use c::{getrlimit as libc_getrlimit, setrlimit as libc_setrlimit};
-// TODO: Add `RLIM64_INFINITY` to upstream libc.
#[cfg(linux_like)]
-pub(super) const LIBC_RLIM_INFINITY: u64 = !0_u64;
-
-#[cfg(linux_like)]
-pub(super) use c::{getrlimit64 as libc_getrlimit, setrlimit64 as libc_setrlimit};
+pub(super) use c::{
+ getrlimit64 as libc_getrlimit, setrlimit64 as libc_setrlimit,
+ RLIM64_INFINITY as LIBC_RLIM_INFINITY,
+};
#[cfg(linux_like)]
#[cfg(feature = "mm")]
@@ -269,7 +268,7 @@ mod readwrite_pv {
#[cfg(apple)]
pub(super) use readwrite_pv::{preadv as libc_preadv, pwritev as libc_pwritev};
-// GLIBC added `preadv64v2` and `pwritev64v2` in version 2.26.
+// glibc added `preadv64v2` and `pwritev64v2` in version 2.26.
#[cfg(all(target_os = "linux", target_env = "gnu"))]
mod readwrite_pv64v2 {
use super::c;
@@ -300,7 +299,7 @@ mod readwrite_pv64v2 {
offset: c::off64_t,
flags: c::c_int,
) -> c::ssize_t {
- // Older GLIBC lacks `preadv64v2`, so use the `weak!` mechanism to
+ // Older glibc lacks `preadv64v2`, so use the `weak!` mechanism to
// test for it, and call back to `c::syscall`. We don't use
// `weak_or_syscall` here because we need to pass the 64-bit offset
// specially.
@@ -395,7 +394,6 @@ pub(super) use c::posix_fallocate64 as libc_posix_fallocate;
pub(super) use {c::fstatfs as libc_fstatfs, c::statfs as libc_statfs};
#[cfg(not(any(
linux_like,
- solarish,
windows,
target_os = "haiku",
target_os = "redox",
diff --git a/vendor/rustix/src/backend/libc/process/syscalls.rs b/vendor/rustix/src/backend/libc/process/syscalls.rs
index d208bda7a..d8f4fe3a4 100644
--- a/vendor/rustix/src/backend/libc/process/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/process/syscalls.rs
@@ -5,7 +5,7 @@ use super::super::c;
use super::super::conv::borrowed_fd;
use super::super::conv::{c_str, ret, ret_c_int, ret_discarded_char_ptr};
#[cfg(not(target_os = "wasi"))]
-use super::super::conv::{ret_infallible, ret_pid_t};
+use super::super::conv::{ret_infallible, ret_pid_t, ret_usize};
#[cfg(any(target_os = "android", target_os = "linux"))]
use super::super::conv::{syscall_ret, syscall_ret_u32};
#[cfg(any(
@@ -23,6 +23,8 @@ use crate::ffi::CStr;
#[cfg(feature = "fs")]
use crate::fs::Mode;
use crate::io;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+use crate::process::Sysinfo;
#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
use crate::process::{WaitId, WaitidOptions, WaitidStatus};
use core::mem::MaybeUninit;
@@ -37,12 +39,12 @@ use {
use {
super::super::offset::{libc_getrlimit, libc_rlimit, libc_setrlimit, LIBC_RLIM_INFINITY},
crate::process::{Resource, Rlimit},
- core::convert::TryInto,
};
#[cfg(not(target_os = "wasi"))]
use {
super::types::RawUname,
crate::process::{Gid, Pid, RawNonZeroPid, RawPid, Signal, Uid, WaitOptions, WaitStatus},
+ core::convert::TryInto,
};
#[cfg(not(target_os = "wasi"))]
@@ -55,6 +57,11 @@ pub(crate) fn fchdir(dirfd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::fchdir(borrowed_fd(dirfd))) }
}
+#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
+pub(crate) fn chroot(path: &CStr) -> io::Result<()> {
+ unsafe { ret(c::chroot(c_str(path))) }
+}
+
#[cfg(not(target_os = "wasi"))]
pub(crate) fn getcwd(buf: &mut [u8]) -> io::Result<()> {
unsafe { ret_discarded_char_ptr(c::getcwd(buf.as_mut_ptr().cast(), buf.len())) }
@@ -62,7 +69,7 @@ pub(crate) fn getcwd(buf: &mut [u8]) -> io::Result<()> {
#[cfg(any(target_os = "android", target_os = "linux"))]
pub(crate) fn membarrier_query() -> MembarrierQuery {
- // GLIBC does not have a wrapper for `membarrier`; [the documentation]
+ // glibc does not have a wrapper for `membarrier`; [the documentation]
// says to use `syscall`.
//
// [the documentation]: https://man7.org/linux/man-pages/man2/membarrier.2.html#NOTES
@@ -166,6 +173,12 @@ pub(crate) fn getpgid(pid: Option<Pid>) -> io::Result<Pid> {
#[cfg(not(target_os = "wasi"))]
#[inline]
+pub(crate) fn setpgid(pid: Option<Pid>, pgid: Option<Pid>) -> io::Result<()> {
+ unsafe { ret(c::setpgid(Pid::as_raw(pid) as _, Pid::as_raw(pgid) as _)) }
+}
+
+#[cfg(not(target_os = "wasi"))]
+#[inline]
#[must_use]
pub(crate) fn getpgrp() -> Pid {
unsafe {
@@ -426,7 +439,9 @@ pub(crate) fn waitid(id: WaitId<'_>, options: WaitidOptions) -> io::Result<Optio
#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
#[inline]
fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
- let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ // `waitid` can return successfully without initializing the struct (no
+ // children found when using `WNOHANG`)
+ let mut status = MaybeUninit::<c::siginfo_t>::zeroed();
unsafe {
ret(c::waitid(
c::P_ALL,
@@ -442,7 +457,9 @@ fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
#[inline]
fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
- let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ // `waitid` can return successfully without initializing the struct (no
+ // children found when using `WNOHANG`)
+ let mut status = MaybeUninit::<c::siginfo_t>::zeroed();
unsafe {
ret(c::waitid(
c::P_PID,
@@ -458,7 +475,9 @@ fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result<Option<WaitidStat
#[cfg(target_os = "linux")]
#[inline]
fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
- let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ // `waitid` can return successfully without initializing the struct (no
+ // children found when using `WNOHANG`)
+ let mut status = MaybeUninit::<c::siginfo_t>::zeroed();
unsafe {
ret(c::waitid(
c::P_PIDFD,
@@ -481,6 +500,13 @@ fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Optio
#[inline]
unsafe fn cvt_waitid_status(status: MaybeUninit<c::siginfo_t>) -> Option<WaitidStatus> {
let status = status.assume_init();
+ // `si_pid` is supposedly the better way to check that the struct has been
+ // filled, e.g. the Linux manpage says about the `WNOHANG` case “zero out
+ // the si_pid field before the call and check for a nonzero value”.
+ // But e.g. NetBSD/OpenBSD don't have it exposed in the libc crate for now, and
+ // some platforms don't have it at all. For simplicity, always check
+ // `si_signo`. We have zero-initialized the whole struct, and all kernels
+ // should set `SIGCHLD` here.
if status.si_signo == 0 {
None
} else {
@@ -502,6 +528,16 @@ pub(crate) fn exit_group(code: c::c_int) -> ! {
}
}
+#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
+#[inline]
+pub(crate) fn getsid(pid: Option<Pid>) -> io::Result<Pid> {
+ unsafe {
+ let pid = ret_pid_t(c::getsid(Pid::as_raw(pid) as _))?;
+ debug_assert_ne!(pid, 0);
+ Ok(Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(pid)))
+ }
+}
+
#[cfg(not(target_os = "wasi"))]
#[inline]
pub(crate) fn setsid() -> io::Result<Pid> {
@@ -535,6 +571,24 @@ pub(crate) fn kill_current_process_group(sig: Signal) -> io::Result<()> {
unsafe { ret(c::kill(0, sig as i32)) }
}
+#[cfg(not(target_os = "wasi"))]
+#[inline]
+pub(crate) fn test_kill_process(pid: Pid) -> io::Result<()> {
+ unsafe { ret(c::kill(pid.as_raw_nonzero().get(), 0)) }
+}
+
+#[cfg(not(target_os = "wasi"))]
+#[inline]
+pub(crate) fn test_kill_process_group(pid: Pid) -> io::Result<()> {
+ unsafe { ret(c::kill(pid.as_raw_nonzero().get().wrapping_neg(), 0)) }
+}
+
+#[cfg(not(target_os = "wasi"))]
+#[inline]
+pub(crate) fn test_kill_current_process_group() -> io::Result<()> {
+ unsafe { ret(c::kill(0, 0)) }
+}
+
#[cfg(any(target_os = "android", target_os = "linux"))]
#[inline]
pub(crate) unsafe fn prctl(
@@ -561,10 +615,36 @@ pub(crate) unsafe fn procctl(
#[cfg(target_os = "linux")]
pub(crate) fn pidfd_open(pid: Pid, flags: PidfdFlags) -> io::Result<OwnedFd> {
unsafe {
- syscall_ret_owned_fd(libc::syscall(
+ syscall_ret_owned_fd(c::syscall(
c::SYS_pidfd_open,
pid.as_raw_nonzero().get(),
flags.bits(),
))
}
}
+
+#[cfg(not(target_os = "wasi"))]
+pub(crate) fn getgroups(buf: &mut [Gid]) -> io::Result<usize> {
+ let len = buf.len().try_into().map_err(|_| io::Errno::NOMEM)?;
+
+ unsafe { ret_usize(c::getgroups(len, buf.as_mut_ptr().cast()) as isize) }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub(crate) fn sysinfo() -> Sysinfo {
+ let mut info = MaybeUninit::<Sysinfo>::uninit();
+ unsafe {
+ ret_infallible(c::sysinfo(info.as_mut_ptr()));
+ info.assume_init()
+ }
+}
+
+#[cfg(not(any(target_os = "emscripten", target_os = "redox", target_os = "wasi")))]
+pub(crate) fn sethostname(name: &[u8]) -> io::Result<()> {
+ unsafe {
+ ret(c::sethostname(
+ name.as_ptr().cast(),
+ name.len().try_into().map_err(|_| io::Errno::INVAL)?,
+ ))
+ }
+}
diff --git a/vendor/rustix/src/backend/libc/process/types.rs b/vendor/rustix/src/backend/libc/process/types.rs
index 203186b20..e7f10dbff 100644
--- a/vendor/rustix/src/backend/libc/process/types.rs
+++ b/vendor/rustix/src/backend/libc/process/types.rs
@@ -1,5 +1,9 @@
use super::super::c;
+/// `sysinfo`
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub type Sysinfo = c::sysinfo;
+
/// A command for use with [`membarrier`] and [`membarrier_cpu`].
///
/// For `MEMBARRIER_CMD_QUERY`, see [`membarrier_query`].
@@ -7,8 +11,6 @@ use super::super::c;
/// [`membarrier`]: crate::process::membarrier
/// [`membarrier_cpu`]: crate::process::membarrier_cpu
/// [`membarrier_query`]: crate::process::membarrier_query
-// TODO: These are not yet exposed through libc, so we define the
-// constants ourselves.
#[cfg(any(target_os = "android", target_os = "linux"))]
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
#[repr(u32)]
@@ -16,23 +18,24 @@ pub enum MembarrierCommand {
/// `MEMBARRIER_CMD_GLOBAL`
#[doc(alias = "Shared")]
#[doc(alias = "MEMBARRIER_CMD_SHARED")]
- Global = 1,
+ Global = c::MEMBARRIER_CMD_GLOBAL as u32,
/// `MEMBARRIER_CMD_GLOBAL_EXPEDITED`
- GlobalExpedited = 2,
+ GlobalExpedited = c::MEMBARRIER_CMD_GLOBAL_EXPEDITED as u32,
/// `MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED`
- RegisterGlobalExpedited = 4,
+ RegisterGlobalExpedited = c::MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED as u32,
/// `MEMBARRIER_CMD_PRIVATE_EXPEDITED`
- PrivateExpedited = 8,
+ PrivateExpedited = c::MEMBARRIER_CMD_PRIVATE_EXPEDITED as u32,
/// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED`
- RegisterPrivateExpedited = 16,
+ RegisterPrivateExpedited = c::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED as u32,
/// `MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE`
- PrivateExpeditedSyncCore = 32,
+ PrivateExpeditedSyncCore = c::MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE as u32,
/// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE`
- RegisterPrivateExpeditedSyncCore = 64,
+ RegisterPrivateExpeditedSyncCore =
+ c::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE as u32,
/// `MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ` (since Linux 5.10)
- PrivateExpeditedRseq = 128,
+ PrivateExpeditedRseq = c::MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ as u32,
/// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ` (since Linux 5.10)
- RegisterPrivateExpeditedRseq = 256,
+ RegisterPrivateExpeditedRseq = c::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ as u32,
}
/// A resource value for use with [`getrlimit`], [`setrlimit`], and
@@ -98,9 +101,9 @@ pub enum Resource {
}
#[cfg(apple)]
+#[allow(non_upper_case_globals)]
impl Resource {
/// `RLIMIT_RSS`
- #[allow(non_upper_case_globals)]
pub const Rss: Self = Self::As;
}
diff --git a/vendor/rustix/src/backend/libc/rand/syscalls.rs b/vendor/rustix/src/backend/libc/rand/syscalls.rs
index ce1746055..2dcff139e 100644
--- a/vendor/rustix/src/backend/libc/rand/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/rand/syscalls.rs
@@ -1,7 +1,7 @@
//! libc syscalls supporting `rustix::rand`.
#[cfg(any(target_os = "android", target_os = "linux"))]
-use {super::super::c, super::super::conv::ret_ssize_t, crate::io, crate::rand::GetRandomFlags};
+use {super::super::c, super::super::conv::ret_usize, crate::io, crate::rand::GetRandomFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub(crate) fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usize> {
@@ -10,7 +10,5 @@ pub(crate) fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usi
fn getrandom(buf: *mut c::c_void, buflen: c::size_t, flags: c::c_uint) via SYS_getrandom -> c::ssize_t
}
- let nread =
- unsafe { ret_ssize_t(getrandom(buf.as_mut_ptr().cast(), buf.len(), flags.bits()))? };
- Ok(nread as usize)
+ unsafe { ret_usize(getrandom(buf.as_mut_ptr().cast(), buf.len(), flags.bits())) }
}
diff --git a/vendor/rustix/src/backend/libc/termios/syscalls.rs b/vendor/rustix/src/backend/libc/termios/syscalls.rs
index 097d368ed..dba73c960 100644
--- a/vendor/rustix/src/backend/libc/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/termios/syscalls.rs
@@ -193,8 +193,8 @@ pub(crate) fn isatty(fd: BorrowedFd<'_>) -> bool {
// Use the return value of `isatty` alone. We don't check `errno` because
// we return `bool` rather than `io::Result<bool>`, because we assume
// `BorrrowedFd` protects us from `EBADF`, and any other reasonably
- // anticipated errno value would end up interpreted as "assume it's not a
- // terminal" anyway.
+ // anticipated `errno` value would end up interpreted as “assume it's not a
+ // terminal” anyway.
unsafe { c::isatty(borrowed_fd(fd)) != 0 }
}
diff --git a/vendor/rustix/src/backend/libc/termios/types.rs b/vendor/rustix/src/backend/libc/termios/types.rs
index bbacdbea0..fdb7fc644 100644
--- a/vendor/rustix/src/backend/libc/termios/types.rs
+++ b/vendor/rustix/src/backend/libc/termios/types.rs
@@ -171,64 +171,52 @@ pub const VLNEXT: usize = c::VLNEXT as usize;
pub const VEOL2: usize = c::VEOL2 as usize;
/// `IGNBRK`
-#[cfg(not(apple))]
-pub const IGNBRK: c::c_uint = c::IGNBRK;
+pub const IGNBRK: Tcflag = c::IGNBRK;
/// `BRKINT`
-#[cfg(not(apple))]
-pub const BRKINT: c::c_uint = c::BRKINT;
+pub const BRKINT: Tcflag = c::BRKINT;
/// `IGNPAR`
-#[cfg(not(apple))]
-pub const IGNPAR: c::c_uint = c::IGNPAR;
+pub const IGNPAR: Tcflag = c::IGNPAR;
/// `PARMRK`
-#[cfg(not(apple))]
-pub const PARMRK: c::c_uint = c::PARMRK;
+pub const PARMRK: Tcflag = c::PARMRK;
/// `INPCK`
-#[cfg(not(apple))]
-pub const INPCK: c::c_uint = c::INPCK;
+pub const INPCK: Tcflag = c::INPCK;
/// `ISTRIP`
-#[cfg(not(apple))]
-pub const ISTRIP: c::c_uint = c::ISTRIP;
+pub const ISTRIP: Tcflag = c::ISTRIP;
/// `INLCR`
-#[cfg(not(apple))]
-pub const INLCR: c::c_uint = c::INLCR;
+pub const INLCR: Tcflag = c::INLCR;
/// `IGNCR`
-#[cfg(not(apple))]
-pub const IGNCR: c::c_uint = c::IGNCR;
+pub const IGNCR: Tcflag = c::IGNCR;
/// `ICRNL`
-#[cfg(not(apple))]
-pub const ICRNL: c::c_uint = c::ICRNL;
+pub const ICRNL: Tcflag = c::ICRNL;
/// `IUCLC`
#[cfg(any(solarish, target_os = "haiku"))]
-pub const IUCLC: c::c_uint = c::IUCLC;
+pub const IUCLC: Tcflag = c::IUCLC;
/// `IXON`
-#[cfg(not(apple))]
-pub const IXON: c::c_uint = c::IXON;
+pub const IXON: Tcflag = c::IXON;
/// `IXANY`
-#[cfg(not(any(apple, target_os = "redox")))]
-pub const IXANY: c::c_uint = c::IXANY;
+#[cfg(not(target_os = "redox"))]
+pub const IXANY: Tcflag = c::IXANY;
/// `IXOFF`
-#[cfg(not(apple))]
-pub const IXOFF: c::c_uint = c::IXOFF;
+pub const IXOFF: Tcflag = c::IXOFF;
/// `IMAXBEL`
-#[cfg(not(any(apple, target_os = "haiku", target_os = "redox")))]
-pub const IMAXBEL: c::c_uint = c::IMAXBEL;
+#[cfg(not(any(target_os = "haiku", target_os = "redox")))]
+pub const IMAXBEL: Tcflag = c::IMAXBEL;
/// `IUTF8`
#[cfg(not(any(
- apple,
solarish,
target_os = "aix",
target_os = "dragonfly",
@@ -239,11 +227,10 @@ pub const IMAXBEL: c::c_uint = c::IMAXBEL;
target_os = "openbsd",
target_os = "redox",
)))]
-pub const IUTF8: c::c_uint = c::IUTF8;
+pub const IUTF8: Tcflag = c::IUTF8;
/// `OPOST`
-#[cfg(not(apple))]
-pub const OPOST: c::c_uint = c::OPOST;
+pub const OPOST: Tcflag = c::OPOST;
/// `OLCUC`
#[cfg(not(any(
@@ -254,51 +241,47 @@ pub const OPOST: c::c_uint = c::OPOST;
target_os = "netbsd",
target_os = "redox",
)))]
-pub const OLCUC: c::c_uint = c::OLCUC;
+pub const OLCUC: Tcflag = c::OLCUC;
/// `ONLCR`
-#[cfg(not(apple))]
-pub const ONLCR: c::c_uint = c::ONLCR;
+pub const ONLCR: Tcflag = c::ONLCR;
/// `OCRNL`
-#[cfg(not(apple))]
-pub const OCRNL: c::c_uint = c::OCRNL;
+pub const OCRNL: Tcflag = c::OCRNL;
/// `ONOCR`
-#[cfg(not(apple))]
-pub const ONOCR: c::c_uint = c::ONOCR;
+pub const ONOCR: Tcflag = c::ONOCR;
/// `ONLRET`
-#[cfg(not(apple))]
-pub const ONLRET: c::c_uint = c::ONLRET;
+pub const ONLRET: Tcflag = c::ONLRET;
/// `OFILL`
#[cfg(not(bsd))]
-pub const OFILL: c::c_uint = c::OFILL;
+pub const OFILL: Tcflag = c::OFILL;
/// `OFDEL`
#[cfg(not(bsd))]
-pub const OFDEL: c::c_uint = c::OFDEL;
+pub const OFDEL: Tcflag = c::OFDEL;
/// `NLDLY`
#[cfg(not(any(bsd, solarish, target_os = "redox")))]
-pub const NLDLY: c::c_uint = c::NLDLY;
+pub const NLDLY: Tcflag = c::NLDLY;
/// `NL0`
#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
-pub const NL0: c::c_uint = c::NL0;
+pub const NL0: Tcflag = c::NL0;
/// `NL1`
#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
-pub const NL1: c::c_uint = c::NL1;
+pub const NL1: Tcflag = c::NL1;
/// `CRDLY`
#[cfg(not(any(bsd, solarish, target_os = "redox")))]
-pub const CRDLY: c::c_uint = c::CRDLY;
+pub const CRDLY: Tcflag = c::CRDLY;
/// `CR0`
#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
-pub const CR0: c::c_uint = c::CR0;
+pub const CR0: Tcflag = c::CR0;
/// `CR1`
#[cfg(not(any(
@@ -309,7 +292,7 @@ pub const CR0: c::c_uint = c::CR0;
target_os = "fuchsia",
target_os = "redox",
)))]
-pub const CR1: c::c_uint = c::CR1;
+pub const CR1: Tcflag = c::CR1;
/// `CR2`
#[cfg(not(any(
@@ -320,7 +303,7 @@ pub const CR1: c::c_uint = c::CR1;
target_os = "fuchsia",
target_os = "redox",
)))]
-pub const CR2: c::c_uint = c::CR2;
+pub const CR2: Tcflag = c::CR2;
/// `CR3`
#[cfg(not(any(
@@ -331,28 +314,21 @@ pub const CR2: c::c_uint = c::CR2;
target_os = "fuchsia",
target_os = "redox",
)))]
-pub const CR3: c::c_uint = c::CR3;
+pub const CR3: Tcflag = c::CR3;
/// `TABDLY`
-#[cfg(not(any(
- apple,
- netbsdlike,
- solarish,
- target_os = "dragonfly",
- target_os = "redox",
-)))]
-pub const TABDLY: c::c_uint = c::TABDLY;
+#[cfg(not(any(netbsdlike, solarish, target_os = "dragonfly", target_os = "redox",)))]
+pub const TABDLY: Tcflag = c::TABDLY;
/// `TAB0`
#[cfg(not(any(
- apple,
netbsdlike,
solarish,
target_os = "dragonfly",
target_os = "fuchsia",
target_os = "redox",
)))]
-pub const TAB0: c::c_uint = c::TAB0;
+pub const TAB0: Tcflag = c::TAB0;
/// `TAB1`
#[cfg(not(any(
@@ -363,7 +339,7 @@ pub const TAB0: c::c_uint = c::TAB0;
target_os = "fuchsia",
target_os = "redox",
)))]
-pub const TAB1: c::c_uint = c::TAB1;
+pub const TAB1: Tcflag = c::TAB1;
/// `TAB2`
#[cfg(not(any(
@@ -374,7 +350,7 @@ pub const TAB1: c::c_uint = c::TAB1;
target_os = "fuchsia",
target_os = "redox",
)))]
-pub const TAB2: c::c_uint = c::TAB2;
+pub const TAB2: Tcflag = c::TAB2;
/// `TAB3`
#[cfg(not(any(
@@ -385,15 +361,15 @@ pub const TAB2: c::c_uint = c::TAB2;
target_os = "fuchsia",
target_os = "redox",
)))]
-pub const TAB3: c::c_uint = c::TAB3;
+pub const TAB3: Tcflag = c::TAB3;
/// `BSDLY`
#[cfg(not(any(bsd, solarish, target_os = "redox")))]
-pub const BSDLY: c::c_uint = c::BSDLY;
+pub const BSDLY: Tcflag = c::BSDLY;
/// `BS0`
#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
-pub const BS0: c::c_uint = c::BS0;
+pub const BS0: Tcflag = c::BS0;
/// `BS1`
#[cfg(not(any(
@@ -404,15 +380,15 @@ pub const BS0: c::c_uint = c::BS0;
target_os = "fuchsia",
target_os = "redox",
)))]
-pub const BS1: c::c_uint = c::BS1;
+pub const BS1: Tcflag = c::BS1;
/// `FFDLY`
#[cfg(not(any(target_env = "musl", bsd, solarish, target_os = "redox")))]
-pub const FFDLY: c::c_uint = c::FFDLY;
+pub const FFDLY: Tcflag = c::FFDLY;
/// `FF0`
#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
-pub const FF0: c::c_uint = c::FF0;
+pub const FF0: Tcflag = c::FF0;
/// `FF1`
#[cfg(not(any(
@@ -423,15 +399,15 @@ pub const FF0: c::c_uint = c::FF0;
target_os = "fuchsia",
target_os = "redox",
)))]
-pub const FF1: c::c_uint = c::FF1;
+pub const FF1: Tcflag = c::FF1;
/// `VTDLY`
#[cfg(not(any(target_env = "musl", bsd, solarish, target_os = "redox")))]
-pub const VTDLY: c::c_uint = c::VTDLY;
+pub const VTDLY: Tcflag = c::VTDLY;
/// `VT0`
#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
-pub const VT0: c::c_uint = c::VT0;
+pub const VT0: Tcflag = c::VT0;
/// `VT1`
#[cfg(not(any(
@@ -442,7 +418,7 @@ pub const VT0: c::c_uint = c::VT0;
target_os = "fuchsia",
target_os = "redox",
)))]
-pub const VT1: c::c_uint = c::VT1;
+pub const VT1: Tcflag = c::VT1;
/// `B0`
pub const B0: Speed = c::B0;
@@ -594,111 +570,90 @@ pub const B4000000: Speed = c::B4000000;
/// `BOTHER`
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub const BOTHER: c::c_uint = c::BOTHER;
+pub const BOTHER: Speed = c::BOTHER;
/// `CSIZE`
-#[cfg(not(apple))]
-pub const CSIZE: c::c_uint = c::CSIZE;
+pub const CSIZE: Tcflag = c::CSIZE;
/// `CS5`
-#[cfg(not(apple))]
-pub const CS5: c::c_uint = c::CS5;
+pub const CS5: Tcflag = c::CS5;
/// `CS6`
-#[cfg(not(apple))]
-pub const CS6: c::c_uint = c::CS6;
+pub const CS6: Tcflag = c::CS6;
/// `CS7`
-#[cfg(not(apple))]
-pub const CS7: c::c_uint = c::CS7;
+pub const CS7: Tcflag = c::CS7;
/// `CS8`
-#[cfg(not(apple))]
-pub const CS8: c::c_uint = c::CS8;
+pub const CS8: Tcflag = c::CS8;
/// `CSTOPB`
-#[cfg(not(apple))]
-pub const CSTOPB: c::c_uint = c::CSTOPB;
+pub const CSTOPB: Tcflag = c::CSTOPB;
/// `CREAD`
-#[cfg(not(apple))]
-pub const CREAD: c::c_uint = c::CREAD;
+pub const CREAD: Tcflag = c::CREAD;
/// `PARENB`
-#[cfg(not(apple))]
-pub const PARENB: c::c_uint = c::PARENB;
+pub const PARENB: Tcflag = c::PARENB;
/// `PARODD`
-#[cfg(not(apple))]
-pub const PARODD: c::c_uint = c::PARODD;
+pub const PARODD: Tcflag = c::PARODD;
/// `HUPCL`
-#[cfg(not(apple))]
-pub const HUPCL: c::c_uint = c::HUPCL;
+pub const HUPCL: Tcflag = c::HUPCL;
/// `CLOCAL`
-#[cfg(not(apple))]
-pub const CLOCAL: c::c_uint = c::CLOCAL;
+pub const CLOCAL: Tcflag = c::CLOCAL;
/// `ISIG`
-#[cfg(not(apple))]
-pub const ISIG: c::c_uint = c::ISIG;
+pub const ISIG: Tcflag = c::ISIG;
/// `ICANON`—A flag for the `c_lflag` field of [`Termios`] indicating
/// canonical mode.
pub const ICANON: Tcflag = c::ICANON;
/// `ECHO`
-#[cfg(not(apple))]
-pub const ECHO: c::c_uint = c::ECHO;
+pub const ECHO: Tcflag = c::ECHO;
/// `ECHOE`
-#[cfg(not(apple))]
-pub const ECHOE: c::c_uint = c::ECHOE;
+pub const ECHOE: Tcflag = c::ECHOE;
/// `ECHOK`
-#[cfg(not(apple))]
-pub const ECHOK: c::c_uint = c::ECHOK;
+pub const ECHOK: Tcflag = c::ECHOK;
/// `ECHONL`
-#[cfg(not(apple))]
-pub const ECHONL: c::c_uint = c::ECHONL;
+pub const ECHONL: Tcflag = c::ECHONL;
/// `NOFLSH`
-#[cfg(not(apple))]
-pub const NOFLSH: c::c_uint = c::NOFLSH;
+pub const NOFLSH: Tcflag = c::NOFLSH;
/// `TOSTOP`
-#[cfg(not(apple))]
-pub const TOSTOP: c::c_uint = c::TOSTOP;
+pub const TOSTOP: Tcflag = c::TOSTOP;
/// `IEXTEN`
-#[cfg(not(apple))]
-pub const IEXTEN: c::c_uint = c::IEXTEN;
+pub const IEXTEN: Tcflag = c::IEXTEN;
/// `EXTA`
#[cfg(not(any(
- apple,
solarish,
target_os = "emscripten",
target_os = "haiku",
target_os = "redox",
)))]
-pub const EXTA: c::c_uint = c::EXTA;
+pub const EXTA: Speed = c::EXTA;
/// `EXTB`
#[cfg(not(any(
- apple,
solarish,
target_os = "emscripten",
target_os = "haiku",
target_os = "redox",
)))]
-pub const EXTB: c::c_uint = c::EXTB;
+pub const EXTB: Speed = c::EXTB;
/// `CBAUD`
#[cfg(not(any(bsd, target_os = "haiku", target_os = "redox")))]
-pub const CBAUD: c::c_uint = c::CBAUD;
+pub const CBAUD: Tcflag = c::CBAUD;
/// `CBAUDEX`
#[cfg(not(any(
@@ -708,7 +663,7 @@ pub const CBAUD: c::c_uint = c::CBAUD;
target_os = "haiku",
target_os = "redox",
)))]
-pub const CBAUDEX: c::c_uint = c::CBAUDEX;
+pub const CBAUDEX: Tcflag = c::CBAUDEX;
/// `CIBAUD`
#[cfg(not(any(
@@ -719,12 +674,13 @@ pub const CBAUDEX: c::c_uint = c::CBAUDEX;
target_os = "haiku",
target_os = "redox",
)))]
-pub const CIBAUD: c::tcflag_t = c::CIBAUD;
+pub const CIBAUD: Tcflag = c::CIBAUD;
/// `CIBAUD`
-// TODO: Upstream this.
+// glibc on powerpc lacks a definition for `CIBAUD`, even though the Linux
+// headers and Musl on powerpc both have one. So define it manually.
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
-pub const CIBAUD: c::tcflag_t = 0o77600000;
+pub const CIBAUD: Tcflag = 0o77600000;
/// `CMSPAR`
#[cfg(not(any(
@@ -735,39 +691,39 @@ pub const CIBAUD: c::tcflag_t = 0o77600000;
target_os = "haiku",
target_os = "redox",
)))]
-pub const CMSPAR: c::c_uint = c::CMSPAR;
+pub const CMSPAR: Tcflag = c::CMSPAR;
/// `CRTSCTS`
-#[cfg(not(any(apple, target_os = "aix", target_os = "redox")))]
-pub const CRTSCTS: c::c_uint = c::CRTSCTS;
+#[cfg(not(any(target_os = "aix", target_os = "redox")))]
+pub const CRTSCTS: Tcflag = c::CRTSCTS;
/// `XCASE`
#[cfg(any(target_arch = "s390x", target_os = "haiku"))]
-pub const XCASE: c::c_uint = c::XCASE;
+pub const XCASE: Tcflag = c::XCASE;
/// `ECHOCTL`
-#[cfg(not(any(apple, target_os = "redox")))]
-pub const ECHOCTL: c::c_uint = c::ECHOCTL;
+#[cfg(not(any(target_os = "redox")))]
+pub const ECHOCTL: Tcflag = c::ECHOCTL;
/// `ECHOPRT`
-#[cfg(not(any(apple, target_os = "redox")))]
-pub const ECHOPRT: c::c_uint = c::ECHOPRT;
+#[cfg(not(any(target_os = "redox")))]
+pub const ECHOPRT: Tcflag = c::ECHOPRT;
/// `ECHOKE`
-#[cfg(not(any(apple, target_os = "redox")))]
-pub const ECHOKE: c::c_uint = c::ECHOKE;
+#[cfg(not(any(target_os = "redox")))]
+pub const ECHOKE: Tcflag = c::ECHOKE;
/// `FLUSHO`
-#[cfg(not(any(apple, target_os = "redox")))]
-pub const FLUSHO: c::c_uint = c::FLUSHO;
+#[cfg(not(any(target_os = "redox")))]
+pub const FLUSHO: Tcflag = c::FLUSHO;
/// `PENDIN`
-#[cfg(not(any(apple, target_os = "redox")))]
-pub const PENDIN: c::c_uint = c::PENDIN;
+#[cfg(not(any(target_os = "redox")))]
+pub const PENDIN: Tcflag = c::PENDIN;
/// `EXTPROC`
-#[cfg(not(any(apple, target_os = "aix", target_os = "haiku", target_os = "redox")))]
-pub const EXTPROC: c::c_uint = c::EXTPROC;
+#[cfg(not(any(target_os = "aix", target_os = "haiku", target_os = "redox")))]
+pub const EXTPROC: Tcflag = c::EXTPROC;
/// `XTABS`
#[cfg(not(any(
@@ -777,4 +733,4 @@ pub const EXTPROC: c::c_uint = c::EXTPROC;
target_os = "haiku",
target_os = "redox",
)))]
-pub const XTABS: c::c_uint = c::XTABS;
+pub const XTABS: Tcflag = c::XTABS;
diff --git a/vendor/rustix/src/backend/libc/time/types.rs b/vendor/rustix/src/backend/libc/time/types.rs
index 47cd85701..c78aeb21a 100644
--- a/vendor/rustix/src/backend/libc/time/types.rs
+++ b/vendor/rustix/src/backend/libc/time/types.rs
@@ -108,7 +108,7 @@ impl From<Timespec> for LibcTimespec {
/// `CLOCK_*` constants for use with [`clock_gettime`].
///
-/// These constants are always supported at runtime so `clock_gettime` never
+/// These constants are always supported at runtime, so `clock_gettime` never
/// has to fail with `INVAL` due to an unsupported clock. See
/// [`DynamicClockId`] for a greater set of clocks, with the caveat that not
/// all of them are always supported.
@@ -153,7 +153,7 @@ pub enum ClockId {
/// `CLOCK_*` constants for use with [`clock_gettime`].
///
-/// These constants are always supported at runtime so `clock_gettime` never
+/// These constants are always supported at runtime, so `clock_gettime` never
/// has to fail with `INVAL` due to an unsupported clock. See
/// [`DynamicClockId`] for a greater set of clocks, with the caveat that not
/// all of them are always supported.
@@ -209,7 +209,11 @@ pub enum DynamicClockId<'a> {
BoottimeAlarm,
}
-/// `struct itimerspec`
+/// `struct itimerspec` for use with [`timerfd_gettime`] and
+/// [`timerfd_settime`].
+///
+/// [`timerfd_gettime`]: crate::time::timerfd_gettime
+/// [`timerfd_settime`]: crate::time::timerfd_settime
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
#[cfg(not(all(
any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
@@ -217,7 +221,11 @@ pub enum DynamicClockId<'a> {
)))]
pub type Itimerspec = c::itimerspec;
-/// `struct itimerspec`
+/// `struct itimerspec` for use with [`timerfd_gettime`] and
+/// [`timerfd_settime`].
+///
+/// [`timerfd_gettime`]: crate::time::timerfd_gettime
+/// [`timerfd_settime`]: crate::time::timerfd_settime
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
#[cfg(all(
any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
@@ -286,6 +294,8 @@ impl From<Itimerspec> for LibcItimerspec {
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
bitflags! {
/// `TFD_*` flags for use with [`timerfd_create`].
+ ///
+ /// [`timerfd_create`]: crate::time::timerfd_create
pub struct TimerfdFlags: c::c_int {
/// `TFD_NONBLOCK`
const NONBLOCK = c::TFD_NONBLOCK;
@@ -298,6 +308,8 @@ bitflags! {
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
bitflags! {
/// `TFD_TIMER_*` flags for use with [`timerfd_settime`].
+ ///
+ /// [`timerfd_settime`]: crate::time::timerfd_settime
pub struct TimerfdTimerFlags: c::c_int {
/// `TFD_TIMER_ABSTIME`
const ABSTIME = c::TFD_TIMER_ABSTIME;
@@ -316,7 +328,7 @@ bitflags! {
#[repr(i32)]
#[non_exhaustive]
pub enum TimerfdClockId {
- /// `CLOCK_REALTIME`—A clock that tells the "real" time.
+ /// `CLOCK_REALTIME`—A clock that tells the “real” time.
///
/// This is a clock that tells the amount of time elapsed since the
/// Unix epoch, 1970-01-01T00:00:00Z. The clock is externally settable, so
diff --git a/vendor/rustix/src/backend/libc/weak.rs b/vendor/rustix/src/backend/libc/weak.rs
deleted file mode 100644
index b7f185da3..000000000
--- a/vendor/rustix/src/backend/libc/weak.rs
+++ /dev/null
@@ -1,226 +0,0 @@
-// Implementation derived from `weak` in Rust's
-// library/std/src/sys/unix/weak.rs at revision
-// fd0cb0cdc21dd9c06025277d772108f8d42cb25f.
-
-//! Support for "weak linkage" to symbols on Unix
-//!
-//! Some I/O operations we do in libstd require newer versions of OSes but we
-//! need to maintain binary compatibility with older releases for now. In order
-//! to use the new functionality when available we use this module for
-//! detection.
-//!
-//! One option to use here is weak linkage, but that is unfortunately only
-//! really workable on Linux. Hence, use dlsym to get the symbol value at
-//! runtime. This is also done for compatibility with older versions of glibc,
-//! and to avoid creating dependencies on `GLIBC_PRIVATE` symbols. It assumes
-//! that we've been dynamically linked to the library the symbol comes from,
-//! but that is currently always the case for things like libpthread/libc.
-//!
-//! A long time ago this used weak linkage for the `__pthread_get_minstack`
-//! symbol, but that caused Debian to detect an unnecessarily strict versioned
-//! dependency on libc6 (#23628).
-
-// There are a variety of `#[cfg]`s controlling which targets are involved in
-// each instance of `weak!` and `syscall!`. Rather than trying to unify all of
-// that, we'll just allow that some unix targets don't use this module at all.
-#![allow(dead_code, unused_macros)]
-#![allow(clippy::doc_markdown)]
-
-use crate::ffi::CStr;
-use core::ffi::c_void;
-use core::ptr::null_mut;
-use core::sync::atomic::{self, AtomicPtr, Ordering};
-use core::{marker, mem};
-
-const NULL: *mut c_void = null_mut();
-const INVALID: *mut c_void = 1 as *mut c_void;
-
-macro_rules! weak {
- ($vis:vis fn $name:ident($($t:ty),*) -> $ret:ty) => (
- #[allow(non_upper_case_globals)]
- $vis static $name: $crate::backend::weak::Weak<unsafe extern fn($($t),*) -> $ret> =
- $crate::backend::weak::Weak::new(concat!(stringify!($name), '\0'));
- )
-}
-
-pub(crate) struct Weak<F> {
- name: &'static str,
- addr: AtomicPtr<c_void>,
- _marker: marker::PhantomData<F>,
-}
-
-impl<F> Weak<F> {
- pub(crate) const fn new(name: &'static str) -> Self {
- Self {
- name,
- addr: AtomicPtr::new(INVALID),
- _marker: marker::PhantomData,
- }
- }
-
- pub(crate) fn get(&self) -> Option<F> {
- assert_eq!(mem::size_of::<F>(), mem::size_of::<usize>());
- unsafe {
- // Relaxed is fine here because we fence before reading through the
- // pointer (see the comment below).
- match self.addr.load(Ordering::Relaxed) {
- INVALID => self.initialize(),
- NULL => None,
- addr => {
- let func = mem::transmute_copy::<*mut c_void, F>(&addr);
- // The caller is presumably going to read through this value
- // (by calling the function we've dlsymed). This means we'd
- // need to have loaded it with at least C11's consume
- // ordering in order to be guaranteed that the data we read
- // from the pointer isn't from before the pointer was
- // stored. Rust has no equivalent to memory_order_consume,
- // so we use an acquire fence (sorry, ARM).
- //
- // Now, in practice this likely isn't needed even on CPUs
- // where relaxed and consume mean different things. The
- // symbols we're loading are probably present (or not) at
- // init, and even if they aren't the runtime dynamic loader
- // is extremely likely have sufficient barriers internally
- // (possibly implicitly, for example the ones provided by
- // invoking `mprotect`).
- //
- // That said, none of that's *guaranteed*, and so we fence.
- atomic::fence(Ordering::Acquire);
- Some(func)
- }
- }
- }
- }
-
- // Cold because it should only happen during first-time initialization.
- #[cold]
- unsafe fn initialize(&self) -> Option<F> {
- let val = fetch(self.name);
- // This synchronizes with the acquire fence in `get`.
- self.addr.store(val, Ordering::Release);
-
- match val {
- NULL => None,
- addr => Some(mem::transmute_copy::<*mut c_void, F>(&addr)),
- }
- }
-}
-
-unsafe fn fetch(name: &str) -> *mut c_void {
- let name = match CStr::from_bytes_with_nul(name.as_bytes()) {
- Ok(c_str) => c_str,
- Err(..) => return null_mut(),
- };
- libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr())
-}
-
-#[cfg(not(any(target_os = "android", target_os = "linux")))]
-macro_rules! syscall {
- (fn $name:ident($($arg_name:ident: $t:ty),*) via $_sys_name:ident -> $ret:ty) => (
- unsafe fn $name($($arg_name: $t),*) -> $ret {
- weak! { fn $name($($t),*) -> $ret }
-
- if let Some(fun) = $name.get() {
- fun($($arg_name),*)
- } else {
- libc_errno::set_errno(libc_errno::Errno(libc::ENOSYS));
- -1
- }
- }
- )
-}
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-macro_rules! syscall {
- (fn $name:ident($($arg_name:ident: $t:ty),*) via $sys_name:ident -> $ret:ty) => (
- unsafe fn $name($($arg_name:$t),*) -> $ret {
- // This looks like a hack, but concat_idents only accepts idents
- // (not paths).
- use libc::*;
-
- trait AsSyscallArg {
- type SyscallArgType;
- fn into_syscall_arg(self) -> Self::SyscallArgType;
- }
-
- // Pass pointer types as pointers, to preserve provenance.
- impl<T> AsSyscallArg for *mut T {
- type SyscallArgType = *mut T;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self }
- }
- impl<T> AsSyscallArg for *const T {
- type SyscallArgType = *const T;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self }
- }
-
- // Pass `BorrowedFd` values as the integer value.
- impl AsSyscallArg for $crate::fd::BorrowedFd<'_> {
- type SyscallArgType = c::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType {
- $crate::fd::AsRawFd::as_raw_fd(&self) as _
- }
- }
-
- // Coerce integer values into `c_long`.
- impl AsSyscallArg for i32 {
- type SyscallArgType = c::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
- }
- impl AsSyscallArg for u32 {
- type SyscallArgType = c::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
- }
- impl AsSyscallArg for usize {
- type SyscallArgType = c::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
- }
-
- // `concat_idents is unstable, so we take an extra `sys_name`
- // parameter and have our users do the concat for us for now.
- /*
- syscall(
- concat_idents!(SYS_, $name),
- $($arg_name.into_syscall_arg()),*
- ) as $ret
- */
-
- syscall($sys_name, $($arg_name.into_syscall_arg()),*) as $ret
- }
- )
-}
-
-macro_rules! weakcall {
- ($vis:vis fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => (
- $vis unsafe fn $name($($arg_name: $t),*) -> $ret {
- weak! { fn $name($($t),*) -> $ret }
-
- // Use a weak symbol from libc when possible, allowing `LD_PRELOAD`
- // interposition, but if it's not found just fail.
- if let Some(fun) = $name.get() {
- fun($($arg_name),*)
- } else {
- libc_errno::set_errno(libc_errno::Errno(libc::ENOSYS));
- -1
- }
- }
- )
-}
-
-/// A combination of `weakcall` and `syscall`. Use the libc function if it's
-/// available, and fall back to `libc::syscall` otherwise.
-macro_rules! weak_or_syscall {
- ($vis:vis fn $name:ident($($arg_name:ident: $t:ty),*) via $sys_name:ident -> $ret:ty) => (
- $vis unsafe fn $name($($arg_name: $t),*) -> $ret {
- weak! { fn $name($($t),*) -> $ret }
-
- // Use a weak symbol from libc when possible, allowing `LD_PRELOAD`
- // interposition, but if it's not found just fail.
- if let Some(fun) = $name.get() {
- fun($($arg_name),*)
- } else {
- syscall! { fn $name($($arg_name: $t),*) via $sys_name -> $ret }
- $name($($arg_name),*)
- }
- }
- )
-}
diff --git a/vendor/rustix/src/backend/libc/winsock_c.rs b/vendor/rustix/src/backend/libc/winsock_c.rs
index 521a7bbb1..a30f2c86f 100644
--- a/vendor/rustix/src/backend/libc/winsock_c.rs
+++ b/vendor/rustix/src/backend/libc/winsock_c.rs
@@ -5,52 +5,26 @@
use windows_sys::Win32::Networking::WinSock;
-pub(crate) use libc::{
- c_char, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint, c_ulong, c_ulonglong,
- c_ushort, c_void, ssize_t,
-};
-pub(crate) type socklen_t = i32;
+// Define the basic C types. With Rust 1.64, we can use these from `core::ffi`.
+pub(crate) type c_schar = i8;
+pub(crate) type c_uchar = u8;
+pub(crate) type c_short = i16;
+pub(crate) type c_ushort = u16;
+pub(crate) type c_int = i32;
+pub(crate) type c_uint = u32;
+pub(crate) type c_longlong = i64;
+pub(crate) type c_ulonglong = u64;
+pub(crate) type ssize_t = isize;
+pub(crate) type c_char = i8;
+pub(crate) type c_long = i32;
+pub(crate) type c_ulong = u32;
+pub(crate) use core::ffi::c_void;
-// windows-sys declares these constants as unsigned. For better compatibility
-// with Unix-family APIs, redeclare them as signed. Filed upstream:
-// <https://github.com/microsoft/windows-rs/issues/1718>
+// windows-sys declares these constants as u16. For better compatibility
+// with Unix-family APIs, redeclare them as u32.
pub(crate) const AF_INET: i32 = WinSock::AF_INET as _;
pub(crate) const AF_INET6: i32 = WinSock::AF_INET6 as _;
pub(crate) const AF_UNSPEC: i32 = WinSock::AF_UNSPEC as _;
-pub(crate) const SO_TYPE: i32 = WinSock::SO_TYPE as _;
-pub(crate) const SO_REUSEADDR: i32 = WinSock::SO_REUSEADDR as _;
-pub(crate) const SO_BROADCAST: i32 = WinSock::SO_BROADCAST as _;
-pub(crate) const SO_LINGER: i32 = WinSock::SO_LINGER as _;
-pub(crate) const SOL_SOCKET: i32 = WinSock::SOL_SOCKET as _;
-pub(crate) const SO_RCVTIMEO: i32 = WinSock::SO_RCVTIMEO as _;
-pub(crate) const SO_SNDTIMEO: i32 = WinSock::SO_SNDTIMEO as _;
-pub(crate) const SO_ERROR: i32 = WinSock::SO_ERROR as _;
-pub(crate) const IP_TTL: i32 = WinSock::IP_TTL as _;
-pub(crate) const TCP_NODELAY: i32 = WinSock::TCP_NODELAY as _;
-pub(crate) const IP_ADD_MEMBERSHIP: i32 = WinSock::IP_ADD_MEMBERSHIP as _;
-pub(crate) const IP_DROP_MEMBERSHIP: i32 = WinSock::IP_DROP_MEMBERSHIP as _;
-pub(crate) const IP_MULTICAST_TTL: i32 = WinSock::IP_MULTICAST_TTL as _;
-pub(crate) const IP_MULTICAST_LOOP: i32 = WinSock::IP_MULTICAST_LOOP as _;
-pub(crate) const IPV6_ADD_MEMBERSHIP: i32 = WinSock::IPV6_ADD_MEMBERSHIP as _;
-pub(crate) const IPV6_DROP_MEMBERSHIP: i32 = WinSock::IPV6_DROP_MEMBERSHIP as _;
-pub(crate) const IPV6_MULTICAST_LOOP: i32 = WinSock::IPV6_MULTICAST_LOOP as _;
-pub(crate) const IPV6_V6ONLY: i32 = WinSock::IPV6_V6ONLY as _;
-pub(crate) const POLLERR: i16 = WinSock::POLLERR as _;
-pub(crate) const POLLIN: i16 = WinSock::POLLIN as _;
-pub(crate) const POLLNVAL: i16 = WinSock::POLLNVAL as _;
-pub(crate) const POLLHUP: i16 = WinSock::POLLHUP as _;
-pub(crate) const POLLPRI: i16 = WinSock::POLLPRI as _;
-pub(crate) const POLLOUT: i16 = WinSock::POLLOUT as _;
-pub(crate) const POLLRDNORM: i16 = WinSock::POLLRDNORM as _;
-pub(crate) const POLLWRNORM: i16 = WinSock::POLLWRNORM as _;
-pub(crate) const POLLRDBAND: i16 = WinSock::POLLRDBAND as _;
-pub(crate) const POLLWRBAND: i16 = WinSock::POLLWRBAND as _;
-
-// As above, cast the types for better compatibility, and also rename these to
-// their Unix names.
-pub(crate) const SHUT_RDWR: i32 = WinSock::SD_BOTH as _;
-pub(crate) const SHUT_RD: i32 = WinSock::SD_RECEIVE as _;
-pub(crate) const SHUT_WR: i32 = WinSock::SD_SEND as _;
// Include the contents of `WinSock`, renaming as needed to match POSIX.
//
@@ -58,11 +32,16 @@ pub(crate) const SHUT_WR: i32 = WinSock::SD_SEND as _;
// `WSAECANCELLED` will be removed in the future.
// <https://docs.microsoft.com/en-us/windows/win32/api/ws2spi/nc-ws2spi-lpnsplookupserviceend#remarks>
pub(crate) use WinSock::{
- closesocket as close, ioctlsocket as ioctl, WSAPoll as poll, ADDRESS_FAMILY as sa_family_t,
- ADDRINFOA as addrinfo, IN6_ADDR as in6_addr, IN_ADDR as in_addr, IPV6_MREQ as ipv6_mreq,
- IP_MREQ as ip_mreq, LINGER as linger, SOCKADDR as sockaddr, SOCKADDR_IN as sockaddr_in,
- SOCKADDR_IN6 as sockaddr_in6, SOCKADDR_STORAGE as sockaddr_storage, WSAEACCES as EACCES,
- WSAEADDRINUSE as EADDRINUSE, WSAEADDRNOTAVAIL as EADDRNOTAVAIL,
+ closesocket as close, ioctlsocket as ioctl, socklen_t, WSAPoll as poll,
+ ADDRESS_FAMILY as sa_family_t, ADDRINFOA as addrinfo, IN6_ADDR as in6_addr, IN_ADDR as in_addr,
+ IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_MREQ as ipv6_mreq, IPV6_MULTICAST_LOOP,
+ IPV6_V6ONLY, IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_MREQ as ip_mreq, IP_MULTICAST_LOOP,
+ IP_MULTICAST_TTL, IP_TTL, LINGER as linger, POLLERR, POLLHUP, POLLIN, POLLNVAL, POLLOUT,
+ POLLPRI, POLLRDBAND, POLLRDNORM, POLLWRBAND, POLLWRNORM, SD_BOTH as SHUT_RDWR,
+ SD_RECEIVE as SHUT_RD, SD_SEND as SHUT_WR, SOCKADDR as sockaddr, SOCKADDR_IN as sockaddr_in,
+ SOCKADDR_IN6 as sockaddr_in6, SOCKADDR_STORAGE as sockaddr_storage, SOL_SOCKET, SO_BROADCAST,
+ SO_ERROR, SO_LINGER, SO_RCVTIMEO, SO_REUSEADDR, SO_SNDTIMEO, SO_TYPE, TCP_NODELAY,
+ WSAEACCES as EACCES, WSAEADDRINUSE as EADDRINUSE, WSAEADDRNOTAVAIL as EADDRNOTAVAIL,
WSAEAFNOSUPPORT as EAFNOSUPPORT, WSAEALREADY as EALREADY, WSAEBADF as EBADF,
WSAECONNABORTED as ECONNABORTED, WSAECONNREFUSED as ECONNREFUSED, WSAECONNRESET as ECONNRESET,
WSAEDESTADDRREQ as EDESTADDRREQ, WSAEDISCON as EDISCON, WSAEDQUOT as EDQUOT,
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs
index 524c449d9..4783747ac 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs
@@ -3,6 +3,10 @@
//! Compilers should really have intrinsics for making system calls. They're
//! much like regular calls, with custom calling conventions, and calling
//! conventions are otherwise the compiler's job. But for now, use inline asm.
+//!
+//! The calling conventions for Linux syscalls are [documented here].
+//!
+//! [documented here]: https://man7.org/linux/man-pages/man2/syscall.2.html
#[cfg_attr(target_arch = "aarch64", path = "aarch64.rs")]
#[cfg_attr(all(target_arch = "arm", not(thumb_mode)), path = "arm.rs")]
diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs
index a6a5f270d..5e6f5e1f5 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs
@@ -1,9 +1,13 @@
//! Declare functions defined in out-of-line ("outline") asm files.
//!
-//! Kernel calling conventions differ from userspace calling conventions,
-//! so we also define inline function wrappers which reorder the arguments
-//! so that they match with the kernel convention as closely as possible,
-//! to minimize the amount of out-of-line code we need.
+//! Kernel calling conventions differ from userspace calling conventions, so we
+//! also define inline function wrappers which reorder the arguments so that
+//! they match with the kernel convention as closely as possible, to minimize
+//! the amount of out-of-line code we need.
+//!
+//! This is needed in order to support our MSRV of 1.48, which doesn't support
+//! inline asm. When using newer Rust versions, inline asm code is used instead
+//! and these outline libraries are unused.
#[cfg(target_arch = "x86")]
mod x86;
diff --git a/vendor/rustix/src/backend/linux_raw/c.rs b/vendor/rustix/src/backend/linux_raw/c.rs
index e7263305a..89fee82f9 100644
--- a/vendor/rustix/src/backend/linux_raw/c.rs
+++ b/vendor/rustix/src/backend/linux_raw/c.rs
@@ -14,18 +14,20 @@ pub(crate) use linux_raw_sys::general::{
AF_BLUETOOTH, AF_BRIDGE, AF_CAN, AF_ECONET, AF_IEEE802154, AF_INET, AF_INET6, AF_IPX, AF_IRDA,
AF_ISDN, AF_IUCV, AF_KEY, AF_LLC, AF_NETBEUI, AF_NETLINK, AF_NETROM, AF_PACKET, AF_PHONET,
AF_PPPOX, AF_RDS, AF_ROSE, AF_RXRPC, AF_SECURITY, AF_SNA, AF_TIPC, AF_UNIX, AF_UNSPEC,
- AF_WANPIPE, AF_X25, IPPROTO_AH, IPPROTO_BEETPH, IPPROTO_COMP, IPPROTO_DCCP, IPPROTO_EGP,
+ AF_WANPIPE, AF_X25, CLD_CONTINUED, CLD_DUMPED, CLD_EXITED, CLD_KILLED, CLD_STOPPED,
+ CLD_TRAPPED, IPPROTO_AH, IPPROTO_BEETPH, IPPROTO_COMP, IPPROTO_DCCP, IPPROTO_EGP,
IPPROTO_ENCAP, IPPROTO_ESP, IPPROTO_ETHERNET, IPPROTO_FRAGMENT, IPPROTO_GRE, IPPROTO_ICMP,
IPPROTO_ICMPV6, IPPROTO_IDP, IPPROTO_IGMP, IPPROTO_IP, IPPROTO_IPIP, IPPROTO_IPV6, IPPROTO_MH,
IPPROTO_MPLS, IPPROTO_MPTCP, IPPROTO_MTP, IPPROTO_PIM, IPPROTO_PUP, IPPROTO_RAW,
IPPROTO_ROUTING, IPPROTO_RSVP, IPPROTO_SCTP, IPPROTO_TCP, IPPROTO_TP, IPPROTO_UDP,
- IPPROTO_UDPLITE, IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_MULTICAST_LOOP, IPV6_V6ONLY,
- IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_MULTICAST_LOOP, IP_MULTICAST_TTL, IP_TTL,
- MSG_CMSG_CLOEXEC, MSG_CONFIRM, MSG_DONTROUTE, MSG_DONTWAIT, MSG_EOR, MSG_ERRQUEUE, MSG_MORE,
- MSG_NOSIGNAL, MSG_OOB, MSG_PEEK, MSG_TRUNC, MSG_WAITALL, O_CLOEXEC, O_NONBLOCK,
- O_NONBLOCK as PIDFD_NONBLOCK, P_ALL, P_PID, P_PIDFD, SHUT_RD, SHUT_RDWR, SHUT_WR, SOCK_DGRAM,
- SOCK_RAW, SOCK_RDM, SOCK_SEQPACKET, SOCK_STREAM, SOL_SOCKET, SO_BROADCAST, SO_ERROR, SO_LINGER,
- SO_PASSCRED, SO_RCVTIMEO_NEW, SO_RCVTIMEO_OLD, SO_REUSEADDR, SO_SNDTIMEO_NEW, SO_SNDTIMEO_OLD,
- SO_TYPE, TCP_NODELAY,
+ IPPROTO_UDPLITE, IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_MULTICAST_LOOP,
+ IPV6_UNICAST_HOPS, IPV6_V6ONLY, IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_MULTICAST_LOOP,
+ IP_MULTICAST_TTL, IP_TTL, MSG_CMSG_CLOEXEC, MSG_CONFIRM, MSG_DONTROUTE, MSG_DONTWAIT, MSG_EOR,
+ MSG_ERRQUEUE, MSG_MORE, MSG_NOSIGNAL, MSG_OOB, MSG_PEEK, MSG_TRUNC, MSG_WAITALL, O_CLOEXEC,
+ O_NONBLOCK, O_NONBLOCK as PIDFD_NONBLOCK, P_ALL, P_PID, P_PIDFD, SHUT_RD, SHUT_RDWR, SHUT_WR,
+ SOCK_DGRAM, SOCK_RAW, SOCK_RDM, SOCK_SEQPACKET, SOCK_STREAM, SOL_SOCKET, SO_BROADCAST,
+ SO_ERROR, SO_KEEPALIVE, SO_LINGER, SO_PASSCRED, SO_RCVBUF, SO_RCVTIMEO_NEW, SO_RCVTIMEO_OLD,
+ SO_REUSEADDR, SO_SNDBUF, SO_SNDTIMEO_NEW, SO_SNDTIMEO_OLD, SO_TYPE, TCP_NODELAY,
};
pub(crate) use linux_raw_sys::general::{NFS_SUPER_MAGIC, PROC_SUPER_MAGIC, UTIME_NOW, UTIME_OMIT};
+pub(crate) use linux_raw_sys::general::{XATTR_CREATE, XATTR_REPLACE};
diff --git a/vendor/rustix/src/backend/linux_raw/conv.rs b/vendor/rustix/src/backend/linux_raw/conv.rs
index b9fe725bb..f02b5c046 100644
--- a/vendor/rustix/src/backend/linux_raw/conv.rs
+++ b/vendor/rustix/src/backend/linux_raw/conv.rs
@@ -190,6 +190,11 @@ pub(super) fn slice_just_addr<T: Sized, Num: ArgNumber>(v: &[T]) -> ArgReg<Num>
}
#[inline]
+pub(super) fn slice_just_addr_mut<T: Sized, Num: ArgNumber>(v: &mut [T]) -> ArgReg<Num> {
+ raw_arg(v.as_mut_ptr().cast())
+}
+
+#[inline]
pub(super) fn slice<T: Sized, Num0: ArgNumber, Num1: ArgNumber>(
v: &[T],
) -> (ArgReg<Num0>, ArgReg<Num1>) {
@@ -314,6 +319,14 @@ impl<'a, Num: ArgNumber> From<crate::fs::AtFlags> for ArgReg<'a, Num> {
}
#[cfg(feature = "fs")]
+impl<'a, Num: ArgNumber> From<crate::fs::XattrFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::fs::XattrFlags) -> Self {
+ c_uint(flags.bits())
+ }
+}
+
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<crate::fs::inotify::CreateFlags> for ArgReg<'a, Num> {
#[inline]
fn from(flags: crate::fs::inotify::CreateFlags) -> Self {
@@ -615,9 +628,9 @@ impl<'a, Num: ArgNumber> From<crate::net::SendFlags> for ArgReg<'a, Num> {
}
#[cfg(feature = "net")]
-impl<'a, Num: ArgNumber> From<crate::net::AcceptFlags> for ArgReg<'a, Num> {
+impl<'a, Num: ArgNumber> From<crate::net::SocketFlags> for ArgReg<'a, Num> {
#[inline]
- fn from(flags: crate::net::AcceptFlags) -> Self {
+ fn from(flags: crate::net::SocketFlags) -> Self {
c_uint(flags.bits())
}
}
@@ -681,6 +694,13 @@ impl<'a, Num: ArgNumber, T> From<&'a mut MaybeUninit<T>> for ArgReg<'a, Num> {
}
}
+impl<'a, Num: ArgNumber, T> From<&'a mut [MaybeUninit<T>]> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(t: &'a mut [MaybeUninit<T>]) -> Self {
+ raw_arg(t.as_mut_ptr().cast())
+ }
+}
+
#[cfg(feature = "fs")]
#[cfg(any(target_os = "android", target_os = "linux"))]
impl<'a, Num: ArgNumber> From<crate::backend::fs::types::MountFlagsArg> for ArgReg<'a, Num> {
@@ -713,6 +733,14 @@ impl<'a, Num: ArgNumber> From<crate::process::Gid> for ArgReg<'a, Num> {
}
}
+#[cfg(feature = "runtime")]
+impl<'a, Num: ArgNumber> From<crate::runtime::How> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::runtime::How) -> Self {
+ c_uint(flags as u32)
+ }
+}
+
/// Convert a `usize` returned from a syscall that effectively returns `()` on
/// success.
///
diff --git a/vendor/rustix/src/backend/linux_raw/fs/inotify.rs b/vendor/rustix/src/backend/linux_raw/fs/inotify.rs
index 4221565a6..a3c274741 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/inotify.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/inotify.rs
@@ -80,7 +80,7 @@ pub fn inotify_init(flags: CreateFlags) -> io::Result<OwnedFd> {
syscalls::inotify_init1(flags)
}
-/// `inotify_add_watch(self, path, flags)`—Adds a watch to inotify
+/// `inotify_add_watch(self, path, flags)`—Adds a watch to inotify.
///
/// This registers or updates a watch for the filesystem path `path`
/// and returns a watch descriptor corresponding to this watch.
diff --git a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
index 8bd9ccc27..d0d855cc1 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
@@ -10,7 +10,7 @@
use super::super::c;
use super::super::conv::{
by_ref, c_int, c_uint, dev_t, oflags_for_open_how, opt_mut, pass_usize, raw_fd, ret, ret_c_int,
- ret_c_uint, ret_infallible, ret_owned_fd, ret_usize, size_of, slice_mut, zero,
+ ret_c_uint, ret_infallible, ret_owned_fd, ret_usize, size_of, slice, slice_mut, zero,
};
#[cfg(target_pointer_width = "64")]
use super::super::conv::{loff_t, loff_t_from_u64, ret_u64};
@@ -26,7 +26,7 @@ use crate::ffi::CStr;
use crate::fs::{
inotify, Access, Advice, AtFlags, FallocateFlags, FileType, FlockOperation, MemfdFlags, Mode,
OFlags, RenameFlags, ResolveFlags, SealFlags, Stat, StatFs, StatVfs, StatVfsMountFlags,
- StatxFlags, Timestamps,
+ StatxFlags, Timestamps, XattrFlags,
};
use crate::io::{self, SeekFrom};
use crate::process::{Gid, Uid};
@@ -1392,6 +1392,30 @@ pub(crate) fn accessat(
access: Access,
flags: AtFlags,
) -> io::Result<()> {
+ if !flags
+ .difference(AtFlags::EACCESS | AtFlags::SYMLINK_NOFOLLOW)
+ .is_empty()
+ {
+ return Err(io::Errno::INVAL);
+ }
+
+ // Linux's `faccessat` syscall doesn't have a flags argument, so if we have
+ // any flags, use the newer `faccessat2` which does. Unless we're on
+ // Android where using newer system calls can cause seccomp to abort the
+ // process.
+ #[cfg(not(target_os = "android"))]
+ if !flags.is_empty() {
+ return unsafe {
+ ret(syscall_readonly!(
+ __NR_faccessat2,
+ dirfd,
+ path,
+ access,
+ flags
+ ))
+ };
+ }
+
// Linux's `faccessat` doesn't have a flags parameter. If we have
// `AT_EACCESS` and we're not setuid or setgid, we can emulate it.
if flags.is_empty()
@@ -1402,11 +1426,6 @@ pub(crate) fn accessat(
return unsafe { ret(syscall_readonly!(__NR_faccessat, dirfd, path, access)) };
}
- if flags.bits() != AT_EACCESS {
- return Err(io::Errno::INVAL);
- }
-
- // TODO: Use faccessat2 in newer Linux versions.
Err(io::Errno::NOSYS)
}
@@ -1510,3 +1529,138 @@ pub(crate) fn inotify_add_watch(
pub(crate) fn inotify_rm_watch(infd: BorrowedFd<'_>, wfd: i32) -> io::Result<()> {
unsafe { ret(syscall_readonly!(__NR_inotify_rm_watch, infd, c_int(wfd))) }
}
+
+#[inline]
+pub(crate) fn getxattr(path: &CStr, name: &CStr, value: &mut [u8]) -> io::Result<usize> {
+ let (value_addr_mut, value_len) = slice_mut(value);
+ unsafe {
+ ret_usize(syscall!(
+ __NR_getxattr,
+ path,
+ name,
+ value_addr_mut,
+ value_len
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn lgetxattr(path: &CStr, name: &CStr, value: &mut [u8]) -> io::Result<usize> {
+ let (value_addr_mut, value_len) = slice_mut(value);
+ unsafe {
+ ret_usize(syscall!(
+ __NR_lgetxattr,
+ path,
+ name,
+ value_addr_mut,
+ value_len
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn fgetxattr(fd: BorrowedFd<'_>, name: &CStr, value: &mut [u8]) -> io::Result<usize> {
+ let (value_addr_mut, value_len) = slice_mut(value);
+ unsafe {
+ ret_usize(syscall!(
+ __NR_fgetxattr,
+ fd,
+ name,
+ value_addr_mut,
+ value_len
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn setxattr(
+ path: &CStr,
+ name: &CStr,
+ value: &[u8],
+ flags: XattrFlags,
+) -> io::Result<()> {
+ let (value_addr, value_len) = slice(value);
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_setxattr,
+ path,
+ name,
+ value_addr,
+ value_len,
+ flags
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn lsetxattr(
+ path: &CStr,
+ name: &CStr,
+ value: &[u8],
+ flags: XattrFlags,
+) -> io::Result<()> {
+ let (value_addr, value_len) = slice(value);
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_lsetxattr,
+ path,
+ name,
+ value_addr,
+ value_len,
+ flags
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn fsetxattr(
+ fd: BorrowedFd<'_>,
+ name: &CStr,
+ value: &[u8],
+ flags: XattrFlags,
+) -> io::Result<()> {
+ let (value_addr, value_len) = slice(value);
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fsetxattr,
+ fd,
+ name,
+ value_addr,
+ value_len,
+ flags
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn listxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usize> {
+ let (list_addr_mut, list_len) = slice_mut(list);
+ unsafe { ret_usize(syscall!(__NR_listxattr, path, list_addr_mut, list_len)) }
+}
+
+#[inline]
+pub(crate) fn llistxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usize> {
+ let (list_addr_mut, list_len) = slice_mut(list);
+ unsafe { ret_usize(syscall!(__NR_llistxattr, path, list_addr_mut, list_len)) }
+}
+
+#[inline]
+pub(crate) fn flistxattr(fd: BorrowedFd<'_>, list: &mut [c::c_char]) -> io::Result<usize> {
+ let (list_addr_mut, list_len) = slice_mut(list);
+ unsafe { ret_usize(syscall!(__NR_flistxattr, fd, list_addr_mut, list_len)) }
+}
+
+#[inline]
+pub(crate) fn removexattr(path: &CStr, name: &CStr) -> io::Result<()> {
+ unsafe { ret(syscall!(__NR_removexattr, path, name)) }
+}
+
+#[inline]
+pub(crate) fn lremovexattr(path: &CStr, name: &CStr) -> io::Result<()> {
+ unsafe { ret(syscall!(__NR_lremovexattr, path, name)) }
+}
+
+#[inline]
+pub(crate) fn fremovexattr(fd: BorrowedFd<'_>, name: &CStr) -> io::Result<()> {
+ unsafe { ret(syscall!(__NR_fremovexattr, fd, name)) }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/fs/types.rs b/vendor/rustix/src/backend/linux_raw/fs/types.rs
index 9bafb8ac0..68bb9ed46 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/types.rs
@@ -288,6 +288,7 @@ pub enum FileType {
Symlink = linux_raw_sys::general::S_IFLNK as isize,
/// `S_IFIFO`
+ #[doc(alias = "IFO")]
Fifo = linux_raw_sys::general::S_IFIFO as isize,
/// `S_IFSOCK`
@@ -335,7 +336,7 @@ impl FileType {
}
}
- /// Construct a `FileType` from the `d_type` field of a `dirent`.
+ /// Construct a `FileType` from the `d_type` field of a `c::dirent`.
#[inline]
pub(crate) const fn from_dirent_d_type(d_type: u8) -> Self {
match d_type as u32 {
@@ -645,7 +646,7 @@ pub type StatxTimestamp = linux_raw_sys::general::statx_timestamp;
)))]
pub type RawMode = linux_raw_sys::general::__kernel_mode_t;
-/// `mode_t
+/// `mode_t`
#[cfg(any(
target_arch = "x86",
target_arch = "sparc",
diff --git a/vendor/rustix/src/backend/linux_raw/io/errno.rs b/vendor/rustix/src/backend/linux_raw/io/errno.rs
index b01910138..9db14d06e 100644
--- a/vendor/rustix/src/backend/linux_raw/io/errno.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/errno.rs
@@ -60,7 +60,7 @@ impl Errno {
Self::from_errno(raw as u32)
}
- /// Convert from a C errno value (which is positive) to an `Errno`.
+ /// Convert from a C `errno` value (which is positive) to an `Errno`.
const fn from_errno(raw: u32) -> Self {
// We store error values in negated form, so that we don't have to negate
// them after every syscall.
diff --git a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
index 3acf9ffdb..c76fb0635 100644
--- a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
@@ -36,7 +36,7 @@ use linux_raw_sys::ioctl::{BLKPBSZGET, BLKSSZGET, FICLONE, FIONBIO, FIONREAD, TI
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
use {
super::super::conv::{opt_ref, size_of},
- linux_raw_sys::general::{__kernel_timespec, sigset_t},
+ linux_raw_sys::general::{__kernel_timespec, kernel_sigset_t},
};
#[inline]
@@ -555,7 +555,7 @@ pub(crate) fn poll(fds: &mut [PollFd<'_>], timeout: c::c_int) -> io::Result<usiz
fds_len,
opt_ref(timeout.as_ref()),
zero(),
- size_of::<sigset_t, _>()
+ size_of::<kernel_sigset_t, _>()
))
}
#[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))]
diff --git a/vendor/rustix/src/backend/linux_raw/mm/types.rs b/vendor/rustix/src/backend/linux_raw/mm/types.rs
index a58dd76be..a34c41f4f 100644
--- a/vendor/rustix/src/backend/linux_raw/mm/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/mm/types.rs
@@ -197,12 +197,12 @@ pub enum Advice {
LinuxPopulateWrite = linux_raw_sys::general::MADV_POPULATE_WRITE,
}
+#[allow(non_upper_case_globals)]
impl Advice {
/// `POSIX_MADV_DONTNEED`
///
/// On Linux, this is mapped to `POSIX_MADV_NORMAL` because
/// Linux's `MADV_DONTNEED` differs from `POSIX_MADV_DONTNEED`. See
/// `LinuxDontNeed` for the Linux behavior.
- #[allow(non_upper_case_globals)]
pub const DontNeed: Self = Self::Normal;
}
diff --git a/vendor/rustix/src/backend/linux_raw/mod.rs b/vendor/rustix/src/backend/linux_raw/mod.rs
index 1b91fc3ab..e7e073e32 100644
--- a/vendor/rustix/src/backend/linux_raw/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/mod.rs
@@ -14,11 +14,6 @@
//! such as which pointers are array slices, out parameters, or in-out
//! parameters, which integers are owned or borrowed file descriptors, etc.
-// Weak symbols used by the use-libc-auxv feature for glibc 2.15 support.
-#[cfg(feature = "use-libc-auxv")]
-#[macro_use]
-mod weak;
-
#[macro_use]
mod arch;
mod conv;
diff --git a/vendor/rustix/src/backend/linux_raw/net/send_recv.rs b/vendor/rustix/src/backend/linux_raw/net/send_recv.rs
index 888e81e2b..fb82eaef3 100644
--- a/vendor/rustix/src/backend/linux_raw/net/send_recv.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/send_recv.rs
@@ -2,7 +2,10 @@ use super::super::c;
use bitflags::bitflags;
bitflags! {
- /// `MSG_*`
+ /// `MSG_* flags for use with [`send`], [`send_to`], and related functions.
+ ///
+ /// [`send`]: crate::net::send
+ /// [`sendto`]: crate::net::sendto
pub struct SendFlags: u32 {
/// `MSG_CONFIRM`
const CONFIRM = c::MSG_CONFIRM;
@@ -22,7 +25,10 @@ bitflags! {
}
bitflags! {
- /// `MSG_*`
+ /// `MSG_* flags for use with [`recv`], [`recvfrom`], and related functions.
+ ///
+ /// [`recv`]: crate::net::recv
+ /// [`recvfrom`]: crate::net::recvfrom
pub struct RecvFlags: u32 {
/// `MSG_CMSG_CLOEXEC`
const CMSG_CLOEXEC = c::MSG_CMSG_CLOEXEC;
diff --git a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
index 6093cd3a5..7fe9f0ef4 100644
--- a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
@@ -13,7 +13,7 @@ use super::super::conv::{
};
use super::read_sockaddr::{initialize_family_to_unspec, maybe_read_sockaddr_os, read_sockaddr_os};
use super::send_recv::{RecvFlags, SendFlags};
-use super::types::{AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType};
+use super::types::{AddressFamily, Protocol, Shutdown, SocketFlags, SocketType};
use super::write_sockaddr::{encode_sockaddr_v4, encode_sockaddr_v6};
use crate::fd::{BorrowedFd, OwnedFd};
use crate::io;
@@ -143,7 +143,7 @@ pub(crate) fn accept(fd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
}
#[inline]
-pub(crate) fn accept_with(fd: BorrowedFd<'_>, flags: AcceptFlags) -> io::Result<OwnedFd> {
+pub(crate) fn accept_with(fd: BorrowedFd<'_>, flags: SocketFlags) -> io::Result<OwnedFd> {
#[cfg(not(target_arch = "x86"))]
unsafe {
let fd = ret_owned_fd(syscall_readonly!(__NR_accept4, fd, zero(), zero(), flags))?;
@@ -200,7 +200,7 @@ pub(crate) fn acceptfrom(fd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option<Sock
#[inline]
pub(crate) fn acceptfrom_with(
fd: BorrowedFd<'_>,
- flags: AcceptFlags,
+ flags: SocketFlags,
) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> {
#[cfg(not(target_arch = "x86"))]
unsafe {
@@ -1066,16 +1066,53 @@ pub(crate) mod sockopt {
}
#[inline]
- pub(crate) fn get_socket_error(fd: BorrowedFd<'_>) -> io::Result<Result<(), crate::io::Errno>> {
+ pub(crate) fn get_socket_error(fd: BorrowedFd<'_>) -> io::Result<Result<(), io::Errno>> {
let err: c::c_int = getsockopt(fd, c::SOL_SOCKET as _, c::SO_ERROR)?;
Ok(if err == 0 {
Ok(())
} else {
- Err(crate::io::Errno::from_raw_os_error(err))
+ Err(io::Errno::from_raw_os_error(err))
})
}
#[inline]
+ pub(crate) fn set_socket_keepalive(fd: BorrowedFd<'_>, keepalive: bool) -> io::Result<()> {
+ setsockopt(
+ fd,
+ c::SOL_SOCKET as _,
+ c::SO_KEEPALIVE,
+ from_bool(keepalive),
+ )
+ }
+
+ #[inline]
+ pub(crate) fn get_socket_keepalive(fd: BorrowedFd<'_>) -> io::Result<bool> {
+ getsockopt(fd, c::SOL_SOCKET as _, c::SO_KEEPALIVE).map(to_bool)
+ }
+
+ #[inline]
+ pub(crate) fn set_socket_recv_buffer_size(fd: BorrowedFd<'_>, size: usize) -> io::Result<()> {
+ let size: c::c_int = size.try_into().map_err(|_| io::Errno::OVERFLOW)?;
+ setsockopt(fd, c::SOL_SOCKET as _, c::SO_RCVBUF, size)
+ }
+
+ #[inline]
+ pub(crate) fn get_socket_recv_buffer_size(fd: BorrowedFd<'_>) -> io::Result<usize> {
+ getsockopt(fd, c::SOL_SOCKET as _, c::SO_RCVBUF).map(|size: u32| size as usize)
+ }
+
+ #[inline]
+ pub(crate) fn set_socket_send_buffer_size(fd: BorrowedFd<'_>, size: usize) -> io::Result<()> {
+ let size: c::c_int = size.try_into().map_err(|_| io::Errno::OVERFLOW)?;
+ setsockopt(fd, c::SOL_SOCKET as _, c::SO_SNDBUF, size)
+ }
+
+ #[inline]
+ pub(crate) fn get_socket_send_buffer_size(fd: BorrowedFd<'_>) -> io::Result<usize> {
+ getsockopt(fd, c::SOL_SOCKET as _, c::SO_SNDBUF).map(|size: u32| size as usize)
+ }
+
+ #[inline]
pub(crate) fn set_ip_ttl(fd: BorrowedFd<'_>, ttl: u32) -> io::Result<()> {
setsockopt(fd, c::IPPROTO_IP as _, c::IP_TTL, ttl)
}
@@ -1200,6 +1237,20 @@ pub(crate) mod sockopt {
}
#[inline]
+ pub(crate) fn get_ipv6_unicast_hops(fd: BorrowedFd<'_>) -> io::Result<u8> {
+ getsockopt(fd, c::IPPROTO_IPV6 as _, c::IPV6_UNICAST_HOPS).map(|hops: c::c_int| hops as u8)
+ }
+
+ #[inline]
+ pub(crate) fn set_ipv6_unicast_hops(fd: BorrowedFd<'_>, hops: Option<u8>) -> io::Result<()> {
+ let hops = match hops {
+ Some(hops) => hops as c::c_int,
+ None => -1,
+ };
+ setsockopt(fd, c::IPPROTO_IPV6 as _, c::IPV6_UNICAST_HOPS, hops)
+ }
+
+ #[inline]
pub(crate) fn set_tcp_nodelay(fd: BorrowedFd<'_>, nodelay: bool) -> io::Result<()> {
setsockopt(fd, c::IPPROTO_TCP as _, c::TCP_NODELAY, from_bool(nodelay))
}
diff --git a/vendor/rustix/src/backend/linux_raw/net/types.rs b/vendor/rustix/src/backend/linux_raw/net/types.rs
index b8f786b3f..3f0b571a5 100644
--- a/vendor/rustix/src/backend/linux_raw/net/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/types.rs
@@ -52,6 +52,7 @@ pub type RawAddressFamily = c::sa_family_t;
pub struct AddressFamily(pub(crate) RawAddressFamily);
#[rustfmt::skip]
+#[allow(non_upper_case_globals)]
impl AddressFamily {
/// `AF_UNSPEC`
pub const UNSPEC: Self = Self(c::AF_UNSPEC as _);
@@ -81,7 +82,6 @@ impl AddressFamily {
/// `AF_ROSE`
pub const ROSE: Self = Self(c::AF_ROSE as _);
/// `AF_DECnet`
- #[allow(non_upper_case_globals)]
pub const DECnet: Self = Self(c::AF_DECnet as _);
/// `AF_NETBEUI`
pub const NETBEUI: Self = Self(c::AF_NETBEUI as _);
@@ -143,7 +143,10 @@ impl AddressFamily {
#[doc(hidden)]
pub type RawProtocol = u32;
-/// `IPPROTO_*`
+/// `IPPROTO_*` constants for use with [`socket`] and [`socket_with`].
+///
+/// [`socket`]: crate::net::socket
+/// [`socket_with`]: crate::net::socket_with
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[repr(transparent)]
pub struct Protocol(pub(crate) RawProtocol);
@@ -232,7 +235,7 @@ impl Protocol {
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[repr(u32)]
pub enum Shutdown {
- /// `SHUT_WR`—Disable further read operations.
+ /// `SHUT_RD`—Disable further read operations.
Read = c::SHUT_RD,
/// `SHUT_WR`—Disable further write operations.
Write = c::SHUT_WR,
@@ -241,22 +244,12 @@ pub enum Shutdown {
}
bitflags! {
- /// `SOCK_*` constants for use with [`accept_with`] and [`acceptfrom_with`].
+ /// `SOCK_*` constants for use with [`socket_with`], [`accept_with`] and
+ /// [`acceptfrom_with`].
///
+ /// [`socket_with`]: crate::net::socket_with
/// [`accept_with`]: crate::net::accept_with
/// [`acceptfrom_with`]: crate::net::acceptfrom_with
- pub struct AcceptFlags: c::c_uint {
- /// `SOCK_NONBLOCK`
- const NONBLOCK = c::O_NONBLOCK;
- /// `SOCK_CLOEXEC`
- const CLOEXEC = c::O_CLOEXEC;
- }
-}
-
-bitflags! {
- /// `SOCK_*` constants for use with [`socket`].
- ///
- /// [`socket`]: crate::net::socket
pub struct SocketFlags: c::c_uint {
/// `SOCK_NONBLOCK`
const NONBLOCK = c::O_NONBLOCK;
diff --git a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
index f86f8e5b9..0eb6489e7 100644
--- a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
@@ -9,7 +9,8 @@
use super::super::c;
use super::super::conv::{
by_mut, by_ref, c_int, c_uint, negative_pid, pass_usize, ret, ret_c_int, ret_c_uint,
- ret_infallible, ret_usize, ret_usize_infallible, size_of, slice_just_addr, slice_mut, zero,
+ ret_infallible, ret_usize, ret_usize_infallible, size_of, slice, slice_just_addr,
+ slice_just_addr_mut, slice_mut, zero,
};
use super::types::{RawCpuSet, RawUname};
use crate::backend::conv::ret_owned_fd;
@@ -18,7 +19,8 @@ use crate::ffi::CStr;
use crate::io;
use crate::process::{
Cpuid, Gid, MembarrierCommand, MembarrierQuery, Pid, PidfdFlags, RawNonZeroPid, RawPid,
- Resource, Rlimit, Signal, Uid, WaitId, WaitOptions, WaitStatus, WaitidOptions, WaitidStatus,
+ Resource, Rlimit, Signal, Sysinfo, Uid, WaitId, WaitOptions, WaitStatus, WaitidOptions,
+ WaitidStatus,
};
use core::convert::TryInto;
use core::mem::MaybeUninit;
@@ -43,6 +45,11 @@ pub(crate) fn fchdir(fd: BorrowedFd<'_>) -> io::Result<()> {
}
#[inline]
+pub(crate) fn chroot(filename: &CStr) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_chroot, filename)) }
+}
+
+#[inline]
pub(crate) fn getcwd(buf: &mut [u8]) -> io::Result<usize> {
let (buf_addr_mut, buf_len) = slice_mut(buf);
unsafe { ret_usize(syscall!(__NR_getcwd, buf_addr_mut, buf_len)) }
@@ -116,6 +123,17 @@ pub(crate) fn getpgid(pid: Option<Pid>) -> io::Result<Pid> {
}
#[inline]
+pub(crate) fn setpgid(pid: Option<Pid>, pgid: Option<Pid>) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_setpgid,
+ c_uint(Pid::as_raw(pid)),
+ c_uint(Pid::as_raw(pgid))
+ ))
+ }
+}
+
+#[inline]
pub(crate) fn getpgrp() -> Pid {
// Use the `getpgrp` syscall if available.
#[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))]
@@ -541,7 +559,9 @@ pub(crate) fn waitid(id: WaitId<'_>, options: WaitidOptions) -> io::Result<Optio
#[inline]
fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
- let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ // `waitid` can return successfully without initializing the struct (no
+ // children found when using `WNOHANG`)
+ let mut status = MaybeUninit::<c::siginfo_t>::zeroed();
unsafe {
ret(syscall!(
__NR_waitid,
@@ -558,7 +578,9 @@ fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
#[inline]
fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
- let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ // `waitid` can return successfully without initializing the struct (no
+ // children found when using `WNOHANG`)
+ let mut status = MaybeUninit::<c::siginfo_t>::zeroed();
unsafe {
ret(syscall!(
__NR_waitid,
@@ -575,7 +597,9 @@ fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result<Option<WaitidStat
#[inline]
fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
- let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ // `waitid` can return successfully without initializing the struct (no
+ // children found when using `WNOHANG`)
+ let mut status = MaybeUninit::<c::siginfo_t>::zeroed();
unsafe {
ret(syscall!(
__NR_waitid,
@@ -597,9 +621,10 @@ fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Optio
/// The caller must ensure that `status` is initialized and that `waitid`
/// returned successfully.
#[inline]
+#[rustfmt::skip]
unsafe fn cvt_waitid_status(status: MaybeUninit<c::siginfo_t>) -> Option<WaitidStatus> {
let status = status.assume_init();
- if status.__bindgen_anon_1.__bindgen_anon_1.si_signo == 0 {
+ if status.__bindgen_anon_1.__bindgen_anon_1._sifields._sigchld._pid == 0 {
None
} else {
Some(WaitidStatus(status))
@@ -613,6 +638,17 @@ pub(crate) fn exit_group(code: c::c_int) -> ! {
}
#[inline]
+pub(crate) fn getsid(pid: Option<Pid>) -> io::Result<Pid> {
+ unsafe {
+ let pid = ret_usize(syscall_readonly!(__NR_getsid, c_uint(Pid::as_raw(pid))))?;
+ debug_assert!(pid > 0);
+ Ok(Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(
+ pid as u32,
+ )))
+ }
+}
+
+#[inline]
pub(crate) fn setsid() -> io::Result<Pid> {
unsafe {
let pid = ret_usize(syscall_readonly!(__NR_setsid))?;
@@ -639,6 +675,27 @@ pub(crate) fn kill_current_process_group(sig: Signal) -> io::Result<()> {
}
#[inline]
+pub(crate) fn test_kill_process(pid: Pid) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_kill, pid, pass_usize(0))) }
+}
+
+#[inline]
+pub(crate) fn test_kill_process_group(pid: Pid) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_kill,
+ negative_pid(pid),
+ pass_usize(0)
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn test_kill_current_process_group() -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_kill, pass_usize(0), pass_usize(0))) }
+}
+
+#[inline]
pub(crate) unsafe fn prctl(
option: c::c_int,
arg2: *mut c::c_void,
@@ -659,3 +716,31 @@ pub(crate) fn pidfd_open(pid: Pid, flags: PidfdFlags) -> io::Result<OwnedFd> {
))
}
}
+
+#[inline]
+pub(crate) fn getgroups(buf: &mut [Gid]) -> io::Result<usize> {
+ let len = buf.len().try_into().map_err(|_| io::Errno::NOMEM)?;
+
+ unsafe {
+ ret_usize(syscall!(
+ __NR_getgroups,
+ c_int(len),
+ slice_just_addr_mut(buf)
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn sysinfo() -> Sysinfo {
+ let mut info = MaybeUninit::<Sysinfo>::uninit();
+ unsafe {
+ ret_infallible(syscall!(__NR_sysinfo, &mut info));
+ info.assume_init()
+ }
+}
+
+#[inline]
+pub(crate) fn sethostname(name: &[u8]) -> io::Result<()> {
+ let (ptr, len) = slice(name);
+ unsafe { ret(syscall_readonly!(__NR_sethostname, ptr, len)) }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/process/types.rs b/vendor/rustix/src/backend/linux_raw/process/types.rs
index 53e2c7db1..efdaddbae 100644
--- a/vendor/rustix/src/backend/linux_raw/process/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/types.rs
@@ -1,6 +1,9 @@
use super::super::c;
use linux_raw_sys::general::membarrier_cmd;
+/// `sysinfo`
+pub type Sysinfo = linux_raw_sys::general::sysinfo;
+
/// A command for use with [`membarrier`] and [`membarrier_cpu`].
///
/// For `MEMBARRIER_CMD_QUERY`, see [`membarrier_query`].
@@ -78,10 +81,12 @@ pub enum Resource {
Rttime = linux_raw_sys::general::RLIMIT_RTTIME,
}
-/// A signal number for use with [`kill_process`] and [`kill_process_group`].
+/// A signal number for use with [`kill_process`], [`kill_process_group`],
+/// and [`kill_current_process_group`].
///
/// [`kill_process`]: crate::process::kill_process
/// [`kill_process_group`]: crate::process::kill_process_group
+/// [`kill_current_process_group`]: crate::process::kill_current_process_group
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(u32)]
pub enum Signal {
@@ -206,7 +211,7 @@ impl Signal {
pub const EXIT_SUCCESS: c::c_int = 0;
/// `EXIT_FAILURE`
pub const EXIT_FAILURE: c::c_int = 1;
-/// The status value of a child terminated with `SIGABRT`.
+/// The status value of a child terminated with a [`Signal::Abort`] signal.
pub const EXIT_SIGNALED_SIGABRT: c::c_int = 128 + linux_raw_sys::general::SIGABRT as i32;
/// A process identifier as a raw integer.
diff --git a/vendor/rustix/src/backend/linux_raw/process/wait.rs b/vendor/rustix/src/backend/linux_raw/process/wait.rs
index edc564a9f..9af7f2b5e 100644
--- a/vendor/rustix/src/backend/linux_raw/process/wait.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/wait.rs
@@ -1,8 +1,9 @@
// The functions replacing the C macros use the same names as in libc.
-#![allow(non_snake_case)]
+#![allow(non_snake_case, unsafe_code)]
+use linux_raw_sys::ctypes::c_int;
pub(crate) use linux_raw_sys::general::{
- WCONTINUED, WEXITED, WNOHANG, WNOWAIT, WSTOPPED, WUNTRACED,
+ siginfo_t, WCONTINUED, WEXITED, WNOHANG, WNOWAIT, WSTOPPED, WUNTRACED,
};
#[inline]
@@ -39,3 +40,29 @@ pub(crate) fn WIFEXITED(status: u32) -> bool {
pub(crate) fn WEXITSTATUS(status: u32) -> u32 {
(status >> 8) & 0xff
}
+
+pub(crate) trait SiginfoExt {
+ fn si_code(&self) -> c_int;
+ unsafe fn si_status(&self) -> c_int;
+}
+
+impl SiginfoExt for siginfo_t {
+ #[inline]
+ fn si_code(&self) -> c_int {
+ // SAFETY: This is technically a union access, but it's only a union
+ // with padding.
+ unsafe { self.__bindgen_anon_1.__bindgen_anon_1.si_code }
+ }
+
+ /// Return the exit status or signal number recorded in a `siginfo_t`.
+ ///
+ /// # Safety
+ ///
+ /// `si_signo` must equal `SIGCHLD` (as it is guaranteed to do after a
+ /// `waitid` call).
+ #[inline]
+ #[rustfmt::skip]
+ unsafe fn si_status(&self) -> c_int {
+ self.__bindgen_anon_1.__bindgen_anon_1._sifields._sigchld._status
+ }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
index a331786f9..74363fc32 100644
--- a/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
@@ -9,15 +9,25 @@
use super::super::c;
#[cfg(target_arch = "x86")]
use super::super::conv::by_mut;
-use super::super::conv::{c_int, c_uint, ret, ret_c_uint, ret_error, ret_usize_infallible, zero};
+use super::super::conv::{
+ by_ref, c_int, c_uint, ret, ret_c_int, ret_c_uint, ret_error, ret_usize_infallible, size_of,
+ zero,
+};
#[cfg(feature = "fs")]
use crate::fd::BorrowedFd;
use crate::ffi::CStr;
#[cfg(feature = "fs")]
use crate::fs::AtFlags;
use crate::io;
-use crate::process::{Pid, RawNonZeroPid};
-use linux_raw_sys::general::{__kernel_pid_t, PR_SET_NAME, SIGCHLD};
+use crate::process::{Pid, RawNonZeroPid, Signal};
+use crate::runtime::{How, Sigaction, Siginfo, Sigset, Stack, Timespec};
+use crate::utils::optional_as_ptr;
+#[cfg(target_pointer_width = "32")]
+use core::convert::TryInto;
+use core::mem::MaybeUninit;
+#[cfg(target_pointer_width = "32")]
+use linux_raw_sys::general::__kernel_old_timespec;
+use linux_raw_sys::general::{__kernel_pid_t, kernel_sigset_t, PR_SET_NAME, SIGCHLD};
#[cfg(target_arch = "x86_64")]
use {super::super::conv::ret_infallible, linux_raw_sys::general::ARCH_SET_FS};
@@ -105,3 +115,135 @@ pub(crate) mod tls {
unsafe { syscall_noreturn!(__NR_exit, c_int(code)) }
}
}
+
+#[inline]
+pub(crate) unsafe fn sigaction(signal: Signal, new: Option<Sigaction>) -> io::Result<Sigaction> {
+ let mut old = MaybeUninit::<Sigaction>::uninit();
+ let new = optional_as_ptr(new.as_ref());
+ ret(syscall!(
+ __NR_rt_sigaction,
+ signal,
+ new,
+ &mut old,
+ size_of::<kernel_sigset_t, _>()
+ ))?;
+ Ok(old.assume_init())
+}
+
+#[inline]
+pub(crate) unsafe fn sigaltstack(new: Option<Stack>) -> io::Result<Stack> {
+ let mut old = MaybeUninit::<Stack>::uninit();
+ let new = optional_as_ptr(new.as_ref());
+ ret(syscall!(__NR_sigaltstack, new, &mut old))?;
+ Ok(old.assume_init())
+}
+
+#[inline]
+pub(crate) unsafe fn tkill(tid: Pid, sig: Signal) -> io::Result<()> {
+ ret(syscall_readonly!(__NR_tkill, tid, sig))
+}
+
+#[inline]
+pub(crate) unsafe fn sigprocmask(how: How, set: &Sigset) -> io::Result<Sigset> {
+ let mut old = MaybeUninit::<Sigset>::uninit();
+ ret(syscall!(
+ __NR_rt_sigprocmask,
+ how,
+ by_ref(set),
+ &mut old,
+ size_of::<kernel_sigset_t, _>()
+ ))?;
+ Ok(old.assume_init())
+}
+
+#[inline]
+pub(crate) fn sigwait(set: &Sigset) -> io::Result<Signal> {
+ unsafe {
+ match Signal::from_raw(ret_c_int(syscall_readonly!(
+ __NR_rt_sigtimedwait,
+ by_ref(set),
+ zero(),
+ zero(),
+ size_of::<kernel_sigset_t, _>()
+ ))?) {
+ Some(signum) => Ok(signum),
+ None => Err(io::Errno::NOTSUP),
+ }
+ }
+}
+
+#[inline]
+pub(crate) fn sigwaitinfo(set: &Sigset) -> io::Result<Siginfo> {
+ let mut info = MaybeUninit::<Siginfo>::uninit();
+ unsafe {
+ let _signum = ret_c_int(syscall!(
+ __NR_rt_sigtimedwait,
+ by_ref(set),
+ &mut info,
+ zero(),
+ size_of::<kernel_sigset_t, _>()
+ ))?;
+ Ok(info.assume_init())
+ }
+}
+
+#[inline]
+pub(crate) fn sigtimedwait(set: &Sigset, timeout: Option<Timespec>) -> io::Result<Siginfo> {
+ let mut info = MaybeUninit::<Siginfo>::uninit();
+ let timeout_ptr = optional_as_ptr(timeout.as_ref());
+
+ #[cfg(target_pointer_width = "32")]
+ unsafe {
+ match ret_c_int(syscall!(
+ __NR_rt_sigtimedwait_time64,
+ by_ref(set),
+ &mut info,
+ timeout_ptr,
+ size_of::<kernel_sigset_t, _>()
+ )) {
+ Ok(_signum) => (),
+ Err(io::Errno::NOSYS) => sigtimedwait_old(set, timeout, &mut info)?,
+ Err(err) => return Err(err),
+ }
+ Ok(info.assume_init())
+ }
+
+ #[cfg(target_pointer_width = "64")]
+ unsafe {
+ let _signum = ret_c_int(syscall!(
+ __NR_rt_sigtimedwait,
+ by_ref(set),
+ &mut info,
+ timeout_ptr,
+ size_of::<kernel_sigset_t, _>()
+ ))?;
+ Ok(info.assume_init())
+ }
+}
+
+#[cfg(target_pointer_width = "32")]
+unsafe fn sigtimedwait_old(
+ set: &Sigset,
+ timeout: Option<Timespec>,
+ info: &mut MaybeUninit<Siginfo>,
+) -> io::Result<()> {
+ let old_timeout = match timeout {
+ Some(timeout) => Some(__kernel_old_timespec {
+ tv_sec: timeout.tv_sec.try_into().map_err(|_| io::Errno::OVERFLOW)?,
+ tv_nsec: timeout.tv_nsec as _,
+ }),
+ None => None,
+ };
+
+ let old_timeout_ptr = optional_as_ptr(old_timeout.as_ref());
+
+ let _signum = ret_c_int(syscall!(
+ __NR_rt_sigtimedwait,
+ by_ref(set),
+ info,
+ old_timeout_ptr,
+ size_of::<kernel_sigset_t, _>()
+ ))?;
+
+ Ok(())
+}
diff --git a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
index f5643f3c3..3c8cbb0c9 100644
--- a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
@@ -207,9 +207,9 @@ pub(crate) fn cfgetispeed(termios: &Termios) -> u32 {
#[inline]
pub(crate) fn cfmakeraw(termios: &mut Termios) {
- // From the Linux [`cfmakeraw` man page]:
+ // From the Linux [`cfmakeraw` manual page]:
//
- // [`cfmakeraw` man page]: https://man7.org/linux/man-pages/man3/cfmakeraw.3.html
+ // [`cfmakeraw` manual page]: https://man7.org/linux/man-pages/man3/cfmakeraw.3.html
termios.c_iflag &= !(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
termios.c_oflag &= !OPOST;
termios.c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
@@ -269,7 +269,7 @@ pub(crate) fn ttyname(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> {
// Quick check: if `fd` isn't a character device, it's not a tty.
if FileType::from_raw_mode(fd_stat.st_mode) != FileType::CharacterDevice {
- return Err(crate::io::Errno::NOTTY);
+ return Err(io::Errno::NOTTY);
}
// Check that `fd` is really a tty.
@@ -295,7 +295,7 @@ pub(crate) fn ttyname(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> {
let path_stat = super::super::fs::syscalls::stat(path)?;
if path_stat.st_dev != fd_stat.st_dev || path_stat.st_ino != fd_stat.st_ino {
- return Err(crate::io::Errno::NODEV);
+ return Err(io::Errno::NODEV);
}
Ok(r)
diff --git a/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
index af2c9ee8a..1895c8c6d 100644
--- a/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
@@ -302,7 +302,7 @@ pub(crate) fn capget(
data: &mut [MaybeUninit<linux_raw_sys::general::__user_cap_data_struct>],
) -> io::Result<()> {
let header: *mut _ = header;
- unsafe { ret(syscall!(__NR_capget, header, data.as_mut_ptr())) }
+ unsafe { ret(syscall!(__NR_capget, header, data)) }
}
#[cfg(any(target_os = "android", target_os = "linux"))]
diff --git a/vendor/rustix/src/backend/linux_raw/time/types.rs b/vendor/rustix/src/backend/linux_raw/time/types.rs
index 5a0fcc6f5..fcdd7f6d6 100644
--- a/vendor/rustix/src/backend/linux_raw/time/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/time/types.rs
@@ -114,7 +114,7 @@ bitflags! {
#[repr(u32)]
#[non_exhaustive]
pub enum TimerfdClockId {
- /// `CLOCK_REALTIME`—A clock that tells the "real" time.
+ /// `CLOCK_REALTIME`—A clock that tells the “real” time.
///
/// This is a clock that tells the amount of time elapsed since the
/// Unix epoch, 1970-01-01T00:00:00Z. The clock is externally settable, so
diff --git a/vendor/rustix/src/backend/linux_raw/vdso.rs b/vendor/rustix/src/backend/linux_raw/vdso.rs
index 480378b50..606aee7d1 100644
--- a/vendor/rustix/src/backend/linux_raw/vdso.rs
+++ b/vendor/rustix/src/backend/linux_raw/vdso.rs
@@ -117,7 +117,7 @@ fn init_from_sysinfo_ehdr() -> Option<Vdso> {
.as_ptr();
num_dyn = phdr.p_memsz / size_of::<Elf_Dyn>();
} else if phdr.p_type == PT_INTERP || phdr.p_type == PT_GNU_RELRO {
- // Don't trust any ELF image that has an "interpreter" or that uses
+ // Don't trust any ELF image that has an “interpreter” or that uses
// RELRO, which is likely to be a user ELF image rather and not the
// kernel vDSO.
return None;
diff --git a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
index 5b2e084ea..97d5862a0 100644
--- a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
+++ b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
@@ -293,7 +293,7 @@ unsafe fn _rustix_clock_gettime_via_syscall(
ret(syscall!(__NR_clock_gettime, c_int(clockid), res))
}
-/// A symbol pointing to an `int 0x80` instruction. This "function" is only
+/// A symbol pointing to an `int 0x80` instruction. This “function” is only
/// called from assembly, and only with the x86 syscall calling convention,
/// so its signature here is not its true signature.
#[cfg(all(asm, target_arch = "x86"))]
diff --git a/vendor/rustix/src/fs/abs.rs b/vendor/rustix/src/fs/abs.rs
index cffcf709b..314895006 100644
--- a/vendor/rustix/src/fs/abs.rs
+++ b/vendor/rustix/src/fs/abs.rs
@@ -8,7 +8,7 @@
target_os = "wasi",
)))]
use crate::fs::StatFs;
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
use {
crate::fs::StatVfs,
crate::{backend, io, path},
@@ -48,7 +48,7 @@ pub fn statfs<P: path::Arg>(path: P) -> io::Result<StatFs> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/statvfs.html
/// [Linux]: https://man7.org/linux/man-pages/man2/statvfs.2.html
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
pub fn statvfs<P: path::Arg>(path: P) -> io::Result<StatVfs> {
path.into_with_c_str(backend::fs::syscalls::statvfs)
diff --git a/vendor/rustix/src/fs/at.rs b/vendor/rustix/src/fs/at.rs
index 42bc5f807..2314cf763 100644
--- a/vendor/rustix/src/fs/at.rs
+++ b/vendor/rustix/src/fs/at.rs
@@ -7,15 +7,13 @@
use crate::fd::OwnedFd;
use crate::ffi::{CStr, CString};
-#[cfg(not(solarish))]
-use crate::fs::Access;
#[cfg(apple)]
use crate::fs::CloneFlags;
#[cfg(not(any(apple, target_os = "wasi")))]
use crate::fs::FileType;
#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::fs::RenameFlags;
-use crate::fs::{AtFlags, Mode, OFlags, Stat, Timestamps};
+use crate::fs::{Access, AtFlags, Mode, OFlags, Stat, Timestamps};
use crate::path::SMALL_PATH_BUFFER_SIZE;
#[cfg(not(target_os = "wasi"))]
use crate::process::{Gid, Uid};
@@ -271,7 +269,6 @@ pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io:
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/faccessat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/faccessat.2.html
-#[cfg(not(solarish))]
#[inline]
#[doc(alias = "faccessat")]
pub fn accessat<P: path::Arg, Fd: AsFd>(
diff --git a/vendor/rustix/src/fs/constants.rs b/vendor/rustix/src/fs/constants.rs
index c8e261e66..3ccc383bb 100644
--- a/vendor/rustix/src/fs/constants.rs
+++ b/vendor/rustix/src/fs/constants.rs
@@ -3,7 +3,7 @@
use crate::backend;
pub use crate::io::FdFlags;
-pub use backend::fs::types::{Access, Mode, OFlags};
+pub use backend::fs::types::{Access, Dev, Mode, OFlags};
#[cfg(not(target_os = "redox"))]
pub use backend::fs::types::AtFlags;
@@ -14,7 +14,4 @@ pub use backend::fs::types::{CloneFlags, CopyfileFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use backend::fs::types::*;
-#[cfg(not(target_os = "redox"))]
-pub use backend::fs::types::Dev;
-
pub use backend::time::types::{Nsecs, Secs, Timespec};
diff --git a/vendor/rustix/src/fs/fd.rs b/vendor/rustix/src/fs/fd.rs
index 6ce8410b2..81e56d909 100644
--- a/vendor/rustix/src/fs/fd.rs
+++ b/vendor/rustix/src/fs/fd.rs
@@ -31,7 +31,7 @@ pub use backend::fs::types::Stat;
)))]
pub use backend::fs::types::StatFs;
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
pub use backend::fs::types::{StatVfs, StatVfsMountFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -55,17 +55,17 @@ pub struct Timestamps {
/// The filesystem magic number for procfs.
///
-/// See [the `fstatfs` man page] for more information.
+/// See [the `fstatfs` manual page] for more information.
///
-/// [the `fstatfs` man page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION
+/// [the `fstatfs` manual page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION
#[cfg(any(target_os = "android", target_os = "linux"))]
pub const PROC_SUPER_MAGIC: FsWord = backend::c::PROC_SUPER_MAGIC as FsWord;
/// The filesystem magic number for NFS.
///
-/// See [the `fstatfs` man page] for more information.
+/// See [the `fstatfs` manual page] for more information.
///
-/// [the `fstatfs` man page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION
+/// [the `fstatfs` manual page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION
#[cfg(any(target_os = "android", target_os = "linux"))]
pub const NFS_SUPER_MAGIC: FsWord = backend::c::NFS_SUPER_MAGIC as FsWord;
@@ -185,7 +185,7 @@ pub fn fstatfs<Fd: AsFd>(fd: Fd) -> io::Result<StatFs> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatvfs.html
/// [Linux]: https://man7.org/linux/man-pages/man2/fstatvfs.2.html
-#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
pub fn fstatvfs<Fd: AsFd>(fd: Fd) -> io::Result<StatVfs> {
backend::fs::syscalls::fstatvfs(fd.as_fd())
diff --git a/vendor/rustix/src/fs/memfd_create.rs b/vendor/rustix/src/fs/memfd_create.rs
index dad964777..bbcbab258 100644
--- a/vendor/rustix/src/fs/memfd_create.rs
+++ b/vendor/rustix/src/fs/memfd_create.rs
@@ -7,8 +7,12 @@ pub use backend::fs::types::MemfdFlags;
///
/// # References
/// - [Linux]
+/// - [glibc]
+/// - [FreeBSD]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/memfd_create.2.html
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-memfd_005fcreate
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?memfd_create
#[inline]
pub fn memfd_create<P: path::Arg>(path: P, flags: MemfdFlags) -> io::Result<OwnedFd> {
path.into_with_c_str(|path| backend::fs::syscalls::memfd_create(path, flags))
diff --git a/vendor/rustix/src/fs/mod.rs b/vendor/rustix/src/fs/mod.rs
index 9588cebe0..e28ddab6f 100644
--- a/vendor/rustix/src/fs/mod.rs
+++ b/vendor/rustix/src/fs/mod.rs
@@ -42,9 +42,10 @@ mod raw_dir;
mod sendfile;
#[cfg(any(target_os = "android", target_os = "linux"))]
mod statx;
-// TODO: Enable `sync` for solarish when upstream is updated.
-#[cfg(not(any(solarish, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
mod sync;
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+mod xattr;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use crate::backend::fs::inotify;
@@ -90,13 +91,15 @@ pub use raw_dir::{RawDir, RawDirEntry};
pub use sendfile::sendfile;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use statx::{statx, Statx, StatxFlags, StatxTimestamp};
-#[cfg(not(any(solarish, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
pub use sync::sync;
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
+pub use xattr::*;
/// Re-export types common to POSIX-ish platforms.
#[cfg(feature = "std")]
#[cfg(unix)]
pub use std::os::unix::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};
#[cfg(feature = "std")]
-#[cfg(target_os = "wasi")]
+#[cfg(all(wasi_ext, target_os = "wasi"))]
pub use std::os::wasi::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};
diff --git a/vendor/rustix/src/fs/raw_dir.rs b/vendor/rustix/src/fs/raw_dir.rs
index 780ff0e89..bad0bf97b 100644
--- a/vendor/rustix/src/fs/raw_dir.rs
+++ b/vendor/rustix/src/fs/raw_dir.rs
@@ -209,7 +209,7 @@ impl<'buf, Fd: AsFd> RawDir<'buf, Fd> {
file_type: dirent.d_type,
inode_number: dirent.d_ino.into(),
next_entry_cookie: dirent.d_off.into(),
- // SAFETY: the kernel guarantees a NUL terminated string.
+ // SAFETY: The kernel guarantees a NUL-terminated string.
file_name: unsafe { CStr::from_ptr(dirent.d_name.as_ptr().cast()) },
}))
}
diff --git a/vendor/rustix/src/fs/statx.rs b/vendor/rustix/src/fs/statx.rs
index 716c66212..121f9270a 100644
--- a/vendor/rustix/src/fs/statx.rs
+++ b/vendor/rustix/src/fs/statx.rs
@@ -15,7 +15,7 @@ use compat::statx as _statx;
///
/// This function returns [`io::Errno::NOSYS`] if `statx` is not available on
/// the platform, such as Linux before 4.11. This also includes older Docker
-/// versions where the actual syscall fails with different error codes; Rustix
+/// versions where the actual syscall fails with different error codes; rustix
/// handles this and translates them into `NOSYS`.
///
/// # References
diff --git a/vendor/rustix/src/fs/xattr.rs b/vendor/rustix/src/fs/xattr.rs
new file mode 100644
index 000000000..e50841b49
--- /dev/null
+++ b/vendor/rustix/src/fs/xattr.rs
@@ -0,0 +1,197 @@
+use crate::{backend, io, path};
+use backend::c;
+use backend::fd::AsFd;
+use bitflags::bitflags;
+
+bitflags! {
+ /// `XATTR_*` constants for use with [`setxattr`], and other `*setxattr`
+ /// functions.
+ pub struct XattrFlags: c::c_uint {
+ /// `XATTR_CREATE`
+ const CREATE = c::XATTR_CREATE as c::c_uint;
+
+ /// `XATTR_REPLACE`
+ const REPLACE = c::XATTR_REPLACE as c::c_uint;
+ }
+}
+
+/// `getxattr(path, name, value.as_ptr(), value.len())`—Get extended
+/// filesystem attributes.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/getxattr.2.html
+#[inline]
+pub fn getxattr<P: path::Arg, Name: path::Arg>(
+ path: P,
+ name: Name,
+ value: &mut [u8],
+) -> io::Result<usize> {
+ path.into_with_c_str(|path| {
+ name.into_with_c_str(|name| backend::fs::syscalls::getxattr(path, name, value))
+ })
+}
+
+/// `lgetxattr(path, name, value.as_ptr(), value.len())`—Get extended
+/// filesystem attributes, without following symlinks in the last path
+/// component.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/lgetxattr.2.html
+#[inline]
+pub fn lgetxattr<P: path::Arg, Name: path::Arg>(
+ path: P,
+ name: Name,
+ value: &mut [u8],
+) -> io::Result<usize> {
+ path.into_with_c_str(|path| {
+ name.into_with_c_str(|name| backend::fs::syscalls::lgetxattr(path, name, value))
+ })
+}
+
+/// `fgetxattr(fd, name, value.as_ptr(), value.len())`—Get extended
+/// filesystem attributes on an open file descriptor.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/fgetxattr.2.html
+#[inline]
+pub fn fgetxattr<Fd: AsFd, Name: path::Arg>(
+ fd: Fd,
+ name: Name,
+ value: &mut [u8],
+) -> io::Result<usize> {
+ name.into_with_c_str(|name| backend::fs::syscalls::fgetxattr(fd.as_fd(), name, value))
+}
+
+/// `setxattr(path, name, value.as_ptr(), value.len(), flags)`—Set extended
+/// filesystem attributes.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/setxattr.2.html
+#[inline]
+pub fn setxattr<P: path::Arg, Name: path::Arg>(
+ path: P,
+ name: Name,
+ value: &[u8],
+ flags: XattrFlags,
+) -> io::Result<()> {
+ path.into_with_c_str(|path| {
+ name.into_with_c_str(|name| backend::fs::syscalls::setxattr(path, name, value, flags))
+ })
+}
+
+/// `setxattr(path, name, value.as_ptr(), value.len(), flags)`—Set extended
+/// filesystem attributes, without following symlinks in the last path
+/// component.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/lsetxattr.2.html
+#[inline]
+pub fn lsetxattr<P: path::Arg, Name: path::Arg>(
+ path: P,
+ name: Name,
+ value: &[u8],
+ flags: XattrFlags,
+) -> io::Result<()> {
+ path.into_with_c_str(|path| {
+ name.into_with_c_str(|name| backend::fs::syscalls::lsetxattr(path, name, value, flags))
+ })
+}
+
+/// `fsetxattr(fd, name, value.as_ptr(), value.len(), flags)`—Set extended
+/// filesystem attributes on an open file descriptor.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/fsetxattr.2.html
+#[inline]
+pub fn fsetxattr<Fd: AsFd, Name: path::Arg>(
+ fd: Fd,
+ name: Name,
+ value: &[u8],
+ flags: XattrFlags,
+) -> io::Result<()> {
+ name.into_with_c_str(|name| backend::fs::syscalls::fsetxattr(fd.as_fd(), name, value, flags))
+}
+
+/// `listxattr(path, list.as_ptr(), list.len())`—List extended filesystem
+/// attributes.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/listxattr.2.html
+#[inline]
+pub fn listxattr<P: path::Arg>(path: P, list: &mut [c::c_char]) -> io::Result<usize> {
+ path.into_with_c_str(|path| backend::fs::syscalls::listxattr(path, list))
+}
+
+/// `llistxattr(path, list.as_ptr(), list.len())`—List extended filesystem
+/// attributes, without following symlinks in the last path component.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/llistxattr.2.html
+#[inline]
+pub fn llistxattr<P: path::Arg>(path: P, list: &mut [c::c_char]) -> io::Result<usize> {
+ path.into_with_c_str(|path| backend::fs::syscalls::llistxattr(path, list))
+}
+
+/// `flistxattr(fd, list.as_ptr(), list.len())`—List extended filesystem
+/// attributes on an open file descriptor.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/flistxattr.2.html
+#[inline]
+pub fn flistxattr<Fd: AsFd>(fd: Fd, list: &mut [c::c_char]) -> io::Result<usize> {
+ backend::fs::syscalls::flistxattr(fd.as_fd(), list)
+}
+
+/// `removexattr(path, name)`—Remove an extended filesystem attribute.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/removexattr.2.html
+pub fn removexattr<P: path::Arg, Name: path::Arg>(path: P, name: Name) -> io::Result<()> {
+ path.into_with_c_str(|path| {
+ name.into_with_c_str(|name| backend::fs::syscalls::removexattr(path, name))
+ })
+}
+
+/// `lremovexattr(path, name)`—Remove an extended filesystem attribute,
+/// without following symlinks in the last path component.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/lremovexattr.2.html
+pub fn lremovexattr<P: path::Arg, Name: path::Arg>(path: P, name: Name) -> io::Result<()> {
+ path.into_with_c_str(|path| {
+ name.into_with_c_str(|name| backend::fs::syscalls::lremovexattr(path, name))
+ })
+}
+
+/// `fremovexattr(fd, name)`—Remove an extended filesystem attribute on an
+/// open file descriptor.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/fremovexattr.2.html
+pub fn fremovexattr<Fd: AsFd, Name: path::Arg>(fd: Fd, name: Name) -> io::Result<()> {
+ name.into_with_c_str(|name| backend::fs::syscalls::fremovexattr(fd.as_fd(), name))
+}
diff --git a/vendor/rustix/src/io/close.rs b/vendor/rustix/src/io/close.rs
index b286d2368..aad2c20a3 100644
--- a/vendor/rustix/src/io/close.rs
+++ b/vendor/rustix/src/io/close.rs
@@ -21,15 +21,29 @@ use backend::fd::RawFd;
/// [responsibility]: https://lwn.net/Articles/576518/
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#close-and-shutdownget-outta-my-face
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
/// [Linux]: https://man7.org/linux/man-pages/man2/close.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/close.2.html#//apple_ref/doc/man/2/close
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-closesocket
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=close&sektion=2
+/// [NetBSD]: https://man.netbsd.org/close.2
+/// [OpenBSD]: https://man.openbsd.org/close.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=close&section=2
+/// [illumos]: https://illumos.org/man/2/close
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Opening-and-Closing-Files.html#index-close
///
/// # Safety
///
diff --git a/vendor/rustix/src/io/dup.rs b/vendor/rustix/src/io/dup.rs
index 97a11f35c..0ac99f3f3 100644
--- a/vendor/rustix/src/io/dup.rs
+++ b/vendor/rustix/src/io/dup.rs
@@ -21,12 +21,24 @@ pub use backend::io::types::DupFlags;
/// - [POSIX]
/// - [Linux]
/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [file description]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_258
/// [`fcntl_dupfd_cloexec`]: crate::io::fcntl_dupfd_cloexec
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html
/// [Linux]: https://man7.org/linux/man-pages/man2/dup.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/dup.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=dup&sektion=2
+/// [NetBSD]: https://man.netbsd.org/dup.2
+/// [OpenBSD]: https://man.openbsd.org/dup.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=dup&section=2
+/// [illumos]: https://illumos.org/man/2/dup
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Duplicating-Descriptors.html
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn dup<Fd: AsFd>(fd: Fd) -> io::Result<OwnedFd> {
@@ -51,12 +63,24 @@ pub fn dup<Fd: AsFd>(fd: Fd) -> io::Result<OwnedFd> {
/// - [POSIX]
/// - [Linux]
/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [file description]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_258
/// [`fcntl_dupfd_cloexec`]: crate::io::fcntl_dupfd_cloexec
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html
/// [Linux]: https://man7.org/linux/man-pages/man2/dup2.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/dup2.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=dup2&sektion=2
+/// [NetBSD]: https://man.netbsd.org/dup2.2
+/// [OpenBSD]: https://man.openbsd.org/dup2.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=dup2&section=2
+/// [illumos]: https://illumos.org/man/2/dup
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Duplicating-Descriptors.html
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn dup2<Fd: AsFd>(fd: Fd, new: &mut OwnedFd) -> io::Result<()> {
@@ -73,9 +97,17 @@ pub fn dup2<Fd: AsFd>(fd: Fd, new: &mut OwnedFd) -> io::Result<()> {
///
/// # References
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
///
/// [file description]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_258
/// [Linux]: https://man7.org/linux/man-pages/man2/dup3.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=dup3&sektion=3
+/// [NetBSD]: https://man.netbsd.org/dup3.2
+/// [OpenBSD]: https://man.openbsd.org/dup3.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=dup3&section=3
#[cfg(not(any(target_os = "aix", target_os = "wasi")))]
#[inline]
pub fn dup3<Fd: AsFd>(fd: Fd, new: &mut OwnedFd, flags: DupFlags) -> io::Result<()> {
diff --git a/vendor/rustix/src/io/errno.rs b/vendor/rustix/src/io/errno.rs
index f39573797..7cb50f229 100644
--- a/vendor/rustix/src/io/errno.rs
+++ b/vendor/rustix/src/io/errno.rs
@@ -10,8 +10,6 @@ use core::{fmt, result};
use std::error;
/// A specialized [`Result`] type for `rustix` APIs.
-///
-/// [`Result`]: core::result::Result
pub type Result<T> = result::Result<T, Errno>;
/// `errno`—An error code.
@@ -22,9 +20,23 @@ pub type Result<T> = result::Result<T, Errno>;
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html
/// [Linux]: https://man7.org/linux/man-pages/man3/errno.3.html
+/// [Winsock2]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?errno
+/// [NetBSD]: https://man.netbsd.org/errno.2
+/// [OpenBSD]: https://man.openbsd.org/errno.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=errno&section=2
+/// [illumos]: https://illumos.org/man/3C/errno
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html
pub use backend::io::errno::Errno;
impl Errno {
diff --git a/vendor/rustix/src/io/eventfd.rs b/vendor/rustix/src/io/eventfd.rs
index 22ffc627c..1f71c96b1 100644
--- a/vendor/rustix/src/io/eventfd.rs
+++ b/vendor/rustix/src/io/eventfd.rs
@@ -8,8 +8,12 @@ pub use backend::io::types::EventfdFlags;
///
/// # References
/// - [Linux]
+/// - [FreeBSD]
+/// - [illumos]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/eventfd.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?eventfd
+/// [illumos]: https://illumos.org/man/3C/eventfd
#[inline]
pub fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd> {
backend::io::syscalls::eventfd(initval, flags)
diff --git a/vendor/rustix/src/io/fcntl.rs b/vendor/rustix/src/io/fcntl.rs
index ba79149ff..0454821ff 100644
--- a/vendor/rustix/src/io/fcntl.rs
+++ b/vendor/rustix/src/io/fcntl.rs
@@ -18,9 +18,23 @@ pub use backend::io::types::FdFlags;
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=fcntl&sektion=2
+/// [NetBSD]: https://man.netbsd.org/fcntl.2
+/// [OpenBSD]: https://man.openbsd.org/fcntl.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=fcntl&section=2
+/// [illumos]: https://illumos.org/man/2/fcntl
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Control-Operations.html#index-fcntl-function
#[inline]
#[doc(alias = "F_GETFD")]
pub fn fcntl_getfd<Fd: AsFd>(fd: Fd) -> io::Result<FdFlags> {
@@ -32,9 +46,23 @@ pub fn fcntl_getfd<Fd: AsFd>(fd: Fd) -> io::Result<FdFlags> {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=fcntl&sektion=2
+/// [NetBSD]: https://man.netbsd.org/fcntl.2
+/// [OpenBSD]: https://man.openbsd.org/fcntl.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=fcntl&section=2
+/// [illumos]: https://illumos.org/man/2/fcntl
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Control-Operations.html#index-fcntl-function
#[inline]
#[doc(alias = "F_SETFD")]
pub fn fcntl_setfd<Fd: AsFd>(fd: Fd, flags: FdFlags) -> io::Result<()> {
@@ -53,9 +81,23 @@ pub fn fcntl_setfd<Fd: AsFd>(fd: Fd, flags: FdFlags) -> io::Result<()> {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=fcntl&sektion=2
+/// [NetBSD]: https://man.netbsd.org/fcntl.2
+/// [OpenBSD]: https://man.openbsd.org/fcntl.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=fcntl&section=2
+/// [illumos]: https://illumos.org/man/2/fcntl
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Control-Operations.html#index-fcntl-function
#[cfg(not(any(target_os = "wasi", target_os = "espidf")))]
#[inline]
#[doc(alias = "F_DUPFD_CLOEXEC")]
@@ -74,9 +116,23 @@ pub fn fcntl_dupfd_cloexec<Fd: AsFd>(fd: Fd, min: RawFd) -> io::Result<OwnedFd>
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=fcntl&sektion=2
+/// [NetBSD]: https://man.netbsd.org/fcntl.2
+/// [OpenBSD]: https://man.openbsd.org/fcntl.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=fcntl&section=2
+/// [illumos]: https://illumos.org/man/2/fcntl
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Control-Operations.html#index-fcntl-function
#[cfg(target_os = "espidf")]
#[inline]
#[doc(alias = "F_DUPFD")]
diff --git a/vendor/rustix/src/io/ioctl.rs b/vendor/rustix/src/io/ioctl.rs
index 429b4f8db..fde652e19 100644
--- a/vendor/rustix/src/io/ioctl.rs
+++ b/vendor/rustix/src/io/ioctl.rs
@@ -10,8 +10,14 @@ use backend::fd::AsFd;
///
/// # References
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
///
/// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=tty&sektion=4
+/// [NetBSD]: https://man.netbsd.org/tty.4
+/// [OpenBSD]: https://man.openbsd.org/tty.4
#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
#[doc(alias = "TIOCEXCL")]
@@ -23,8 +29,14 @@ pub fn ioctl_tiocexcl<Fd: AsFd>(fd: Fd) -> io::Result<()> {
///
/// # References
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
///
/// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=tty&sektion=4
+/// [NetBSD]: https://man.netbsd.org/tty.4
+/// [OpenBSD]: https://man.openbsd.org/tty.4
#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
#[doc(alias = "TIOCNXCL")]
@@ -32,16 +44,18 @@ pub fn ioctl_tiocnxcl<Fd: AsFd>(fd: Fd) -> io::Result<()> {
backend::io::syscalls::ioctl_tiocnxcl(fd.as_fd())
}
-/// `ioctl(fd, FIOCLEX)`—Set the close-on-exec flag.
+/// `ioctl(fd, FIOCLEX, NULL)`—Set the close-on-exec flag.
///
/// Also known as `fcntl(fd, F_SETFD, FD_CLOEXEC)`.
///
/// # References
-/// - [Linux]
/// - [Winsock2]
+/// - [NetBSD]
+/// - [OpenBSD]
///
-/// [Linux]: https://man7.org/linux/man-pages/man2/ioctl.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-ioctlsocket
+/// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS
+/// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS
#[cfg(apple)]
#[inline]
#[doc(alias = "FIOCLEX")]
@@ -53,11 +67,13 @@ pub fn ioctl_fioclex<Fd: AsFd>(fd: Fd) -> io::Result<()> {
/// `ioctl(fd, FIONBIO, &value)`—Enables or disables non-blocking mode.
///
/// # References
-/// - [Linux]
/// - [Winsock2]
+/// - [NetBSD]
+/// - [OpenBSD]
///
-/// [Linux]: https://man7.org/linux/man-pages/man2/ioctl.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls#unix-ioctl-codes
+/// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS
+/// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS
#[inline]
#[doc(alias = "FIONBIO")]
pub fn ioctl_fionbio<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> {
@@ -72,9 +88,15 @@ pub fn ioctl_fionbio<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> {
/// # References
/// - [Linux]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/ioctl_tty.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls#unix-ioctl-codes
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=ioctl&sektion=2#GENERIC%09IOCTLS
+/// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS
+/// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS
#[cfg(not(target_os = "redox"))]
#[inline]
#[doc(alias = "FIONREAD")]
@@ -83,6 +105,10 @@ pub fn ioctl_fionread<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
}
/// `ioctl(fd, BLKSSZGET)`—Returns the logical block size of a block device.
+///
+/// This is mentioned in the [Linux `openat` manual page].
+///
+/// [Linux `openat` manual page]: https://man7.org/linux/man-pages/man2/openat.2.html
#[cfg(any(target_os = "android", target_os = "linux"))]
#[inline]
#[doc(alias = "BLKSSZGET")]
diff --git a/vendor/rustix/src/io/is_read_write.rs b/vendor/rustix/src/io/is_read_write.rs
index 74007e7f9..39a2a03d4 100644
--- a/vendor/rustix/src/io/is_read_write.rs
+++ b/vendor/rustix/src/io/is_read_write.rs
@@ -1,4 +1,6 @@
//! The [`is_read_write`] function.
+//!
+//! [`is_read_write`]: https://docs.rs/rustix/*/rustix/io/fn.is_read_write.html
#[cfg(all(feature = "fs", feature = "net"))]
use crate::{backend, io};
diff --git a/vendor/rustix/src/io/kqueue.rs b/vendor/rustix/src/io/kqueue.rs
index 09fa0a4e2..55d2acabf 100644
--- a/vendor/rustix/src/io/kqueue.rs
+++ b/vendor/rustix/src/io/kqueue.rs
@@ -3,12 +3,9 @@
use crate::fd::{AsFd, AsRawFd, OwnedFd, RawFd};
use crate::{backend, io};
-use backend::c::{self, kevent as kevent_t, uintptr_t};
+use backend::c::{self, intptr_t, kevent as kevent_t, uintptr_t};
use backend::io::syscalls;
-#[cfg(any(apple, freebsdlike))]
-use backend::c::intptr_t;
-
use alloc::vec::Vec;
use core::ptr::slice_from_raw_parts_mut;
use core::time::Duration;
@@ -25,23 +22,24 @@ impl Event {
/// Create a new `Event`.
#[allow(clippy::needless_update)]
pub fn new(filter: EventFilter, flags: EventFlags, udata: isize) -> Event {
- let (ident, filter, fflags) = match filter {
- EventFilter::Read(fd) => (fd.as_raw_fd() as uintptr_t, c::EVFILT_READ, 0),
- EventFilter::Write(fd) => (fd.as_raw_fd() as _, c::EVFILT_WRITE, 0),
+ let (ident, data, filter, fflags) = match filter {
+ EventFilter::Read(fd) => (fd.as_raw_fd() as uintptr_t, 0, c::EVFILT_READ, 0),
+ EventFilter::Write(fd) => (fd.as_raw_fd() as _, 0, c::EVFILT_WRITE, 0),
#[cfg(target_os = "freebsd")]
- EventFilter::Empty(fd) => (fd.as_raw_fd() as _, c::EVFILT_EMPTY, 0),
+ EventFilter::Empty(fd) => (fd.as_raw_fd() as _, 0, c::EVFILT_EMPTY, 0),
EventFilter::Vnode { vnode, flags } => {
- (vnode.as_raw_fd() as _, c::EVFILT_VNODE, flags.bits())
+ (vnode.as_raw_fd() as _, 0, c::EVFILT_VNODE, flags.bits())
}
#[cfg(feature = "process")]
EventFilter::Proc { pid, flags } => (
crate::process::Pid::as_raw(Some(pid)) as _,
+ 0,
c::EVFILT_PROC,
flags.bits(),
),
#[cfg(feature = "process")]
- EventFilter::Signal { signal, times: _ } => (signal as _, c::EVFILT_SIGNAL, 0),
- EventFilter::Timer(timer) => {
+ EventFilter::Signal { signal, times: _ } => (signal as _, 0, c::EVFILT_SIGNAL, 0),
+ EventFilter::Timer { ident, timer } => {
#[cfg(any(apple, target_os = "freebsd", target_os = "netbsd"))]
let (data, fflags) = match timer {
Some(timer) => {
@@ -53,22 +51,22 @@ impl Event {
(timer.as_nanos() as _, c::NOTE_NSECONDS)
}
}
- None => (uintptr_t::MAX, c::NOTE_SECONDS),
+ None => (intptr_t::MAX, c::NOTE_SECONDS),
};
#[cfg(any(target_os = "dragonfly", target_os = "openbsd"))]
let (data, fflags) = match timer {
Some(timer) => (timer.as_millis() as _, 0),
- None => (uintptr_t::MAX, 0),
+ None => (intptr_t::MAX, 0),
};
- (data, c::EVFILT_TIMER, fflags)
+ (ident as _, data, c::EVFILT_TIMER, fflags)
}
#[cfg(any(apple, freebsdlike))]
EventFilter::User {
ident,
flags,
user_flags,
- } => (ident as _, c::EVFILT_USER, flags.bits() | user_flags.0),
+ } => (ident as _, 0, c::EVFILT_USER, flags.bits() | user_flags.0),
EventFilter::Unknown => panic!("unknown filter"),
};
@@ -78,7 +76,10 @@ impl Event {
filter: filter as _,
flags: flags.bits() as _,
fflags,
- data: 0,
+ data: {
+ // On openbsd, data is an i64 and not an isize
+ data as _
+ },
udata: {
// On netbsd, udata is an isize and not a pointer.
// TODO: Strict provenance, prevent int-to-ptr cast.
@@ -123,21 +124,24 @@ impl Event {
signal: crate::process::Signal::from_raw(self.inner.ident as _).unwrap(),
times: self.inner.data as _,
},
- c::EVFILT_TIMER => EventFilter::Timer({
- let (data, fflags) = (self.inner.data, self.inner.fflags);
- #[cfg(any(apple, target_os = "freebsd", target_os = "netbsd"))]
- match fflags as _ {
- c::NOTE_SECONDS => Some(Duration::from_secs(data as _)),
- c::NOTE_USECONDS => Some(Duration::from_micros(data as _)),
- c::NOTE_NSECONDS => Some(Duration::from_nanos(data as _)),
- _ => {
- // Unknown timer flags.
- None
+ c::EVFILT_TIMER => EventFilter::Timer {
+ ident: self.inner.ident as _,
+ timer: {
+ let (data, fflags) = (self.inner.data, self.inner.fflags);
+ #[cfg(any(apple, target_os = "freebsd", target_os = "netbsd"))]
+ match fflags as _ {
+ c::NOTE_SECONDS => Some(Duration::from_secs(data as _)),
+ c::NOTE_USECONDS => Some(Duration::from_micros(data as _)),
+ c::NOTE_NSECONDS => Some(Duration::from_nanos(data as _)),
+ _ => {
+ // Unknown timer flags.
+ None
+ }
}
- }
- #[cfg(any(target_os = "dragonfly", target_os = "openbsd"))]
- Some(Duration::from_millis(data as _))
- }),
+ #[cfg(any(target_os = "dragonfly", target_os = "openbsd"))]
+ Some(Duration::from_millis(data as _))
+ },
+ },
#[cfg(any(apple, freebsdlike))]
c::EVFILT_USER => EventFilter::User {
ident: self.inner.ident as _,
@@ -198,7 +202,13 @@ pub enum EventFilter {
},
/// A timer filter.
- Timer(Option<Duration>),
+ Timer {
+ /// The identifier for this event.
+ ident: intptr_t,
+
+ /// The duration for this event.
+ timer: Option<Duration>,
+ },
/// A user filter.
#[cfg(any(apple, freebsdlike))]
@@ -292,7 +302,7 @@ bitflags::bitflags! {
/// The process executed a new process.
const EXEC = c::NOTE_EXEC;
- /// Follow the process through fork() calls (write only).
+ /// Follow the process through `fork()` calls (write only).
const TRACK = c::NOTE_TRACK;
/// An error has occurred with following the process.
@@ -307,13 +317,13 @@ bitflags::bitflags! {
/// Ignore the user input flags.
const NOINPUT = c::NOTE_FFNOP;
- /// Bitwise AND fflags.
+ /// Bitwise AND `fflags`.
const AND = c::NOTE_FFAND;
- /// Bitwise OR fflags.
+ /// Bitwise OR `fflags`.
const OR = c::NOTE_FFOR;
- /// Copy fflags.
+ /// Copy `fflags`.
const COPY = c::NOTE_FFCOPY;
/// Control mask for operations.
@@ -355,13 +365,13 @@ impl UserDefinedFlags {
/// - [FreeBSD]
/// - [OpenBSD]
/// - [NetBSD]
-/// - [DragonflyBSD]
+/// - [DragonFly BSD]
///
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/kqueue.2.html
-/// [FreeBSD]: https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2
/// [OpenBSD]: https://man.openbsd.org/kqueue.2
/// [NetBSD]: https://man.netbsd.org/kqueue.2
-/// [DragonflyBSD]: https://www.dragonflybsd.org/cgi/web-man/?command=kqueue
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=kqueue&section=2
pub fn kqueue() -> io::Result<OwnedFd> {
syscalls::kqueue()
}
@@ -382,13 +392,13 @@ pub fn kqueue() -> io::Result<OwnedFd> {
/// - [FreeBSD]
/// - [OpenBSD]
/// - [NetBSD]
-/// - [DragonflyBSD]
+/// - [DragonFly BSD]
///
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/kevent.2.html
-/// [FreeBSD]: https://www.freebsd.org/cgi/man.cgi?query=kevent&sektion=2
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=kevent&sektion=2
/// [OpenBSD]: https://man.openbsd.org/kevent.2
/// [NetBSD]: https://man.netbsd.org/kevent.2
-/// [DragonflyBSD]: https://www.dragonflybsd.org/cgi/web-man/?command=kevent
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=kevent&section=2
pub unsafe fn kevent(
kqueue: impl AsFd,
changelist: &[Event],
diff --git a/vendor/rustix/src/io/mod.rs b/vendor/rustix/src/io/mod.rs
index 4e9b3e23a..1fe302a6e 100644
--- a/vendor/rustix/src/io/mod.rs
+++ b/vendor/rustix/src/io/mod.rs
@@ -4,7 +4,12 @@ mod close;
#[cfg(not(windows))]
mod dup;
mod errno;
-#[cfg(any(target_os = "android", target_os = "linux"))]
+#[cfg(any(
+ target_os = "android",
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "linux"
+))]
mod eventfd;
#[cfg(not(windows))]
mod fcntl;
@@ -34,7 +39,12 @@ pub use close::close;
#[cfg(not(windows))]
pub use dup::*;
pub use errno::{retry_on_intr, Errno, Result};
-#[cfg(any(target_os = "android", target_os = "linux"))]
+#[cfg(any(
+ target_os = "android",
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "linux"
+))]
pub use eventfd::{eventfd, EventfdFlags};
#[cfg(not(windows))]
pub use fcntl::*;
diff --git a/vendor/rustix/src/io/pipe.rs b/vendor/rustix/src/io/pipe.rs
index 9d4b081c5..40acc814d 100644
--- a/vendor/rustix/src/io/pipe.rs
+++ b/vendor/rustix/src/io/pipe.rs
@@ -42,9 +42,23 @@ pub const PIPE_BUF: usize = backend::io::types::PIPE_BUF;
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pipe.html
/// [Linux]: https://man7.org/linux/man-pages/man2/pipe.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/pipe.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=pipe&sektion=2
+/// [NetBSD]: https://man.netbsd.org/pipe.2
+/// [OpenBSD]: https://man.openbsd.org/pipe.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pipe&section=2
+/// [illumos]: https://illumos.org/man/2/pipe
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Creating-a-Pipe.html
#[inline]
pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
backend::io::syscalls::pipe()
@@ -57,8 +71,18 @@ pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
///
/// # References
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/pipe2.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=pipe2&sektion=2
+/// [NetBSD]: https://man.netbsd.org/pipe2.2
+/// [OpenBSD]: https://man.openbsd.org/pipe2.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pipe2&section=2
+/// [illumos]: https://illumos.org/man/2/pipe2
#[cfg(not(any(apple, target_os = "aix", target_os = "haiku")))]
#[inline]
#[doc(alias = "pipe2")]
diff --git a/vendor/rustix/src/io/poll.rs b/vendor/rustix/src/io/poll.rs
index 01f625af2..3f25d5ec3 100644
--- a/vendor/rustix/src/io/poll.rs
+++ b/vendor/rustix/src/io/poll.rs
@@ -5,15 +5,27 @@ pub use backend::io::poll_fd::{PollFd, PollFlags};
/// `poll(self.fds, timeout)`
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/slightly-advanced-techniques.html#poll
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html
/// [Linux]: https://man7.org/linux/man-pages/man2/poll.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/poll.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=poll&sektion=2
+/// [NetBSD]: https://man.netbsd.org/poll.2
+/// [OpenBSD]: https://man.openbsd.org/poll.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=poll&section=2
+/// [illumos]: https://illumos.org/man/2/poll
#[inline]
pub fn poll(fds: &mut [PollFd<'_>], timeout: i32) -> io::Result<usize> {
backend::io::syscalls::poll(fds, timeout)
diff --git a/vendor/rustix/src/io/procfs.rs b/vendor/rustix/src/io/procfs.rs
index c6eeb08e0..605354759 100644
--- a/vendor/rustix/src/io/procfs.rs
+++ b/vendor/rustix/src/io/procfs.rs
@@ -181,10 +181,10 @@ fn check_procfs(file: BorrowedFd<'_>) -> io::Result<()> {
Ok(())
}
-/// Check whether the given directory handle is a mount point. We use a
-/// `renameat` call that would otherwise fail, but which fails with `EXDEV`
-/// first if it would cross a mount point.
+/// Check whether the given directory handle is a mount point.
fn is_mountpoint(file: BorrowedFd<'_>) -> bool {
+ // We use a `renameat` call that would otherwise fail, but which fails with
+ // `XDEV` first if it would cross a mount point.
let err = renameat(file, cstr!("../."), file, cstr!(".")).unwrap_err();
match err {
io::Errno::XDEV => true, // the rename failed due to crossing a mount point
diff --git a/vendor/rustix/src/io/read_write.rs b/vendor/rustix/src/io/read_write.rs
index d89ce7c7d..918bb9323 100644
--- a/vendor/rustix/src/io/read_write.rs
+++ b/vendor/rustix/src/io/read_write.rs
@@ -20,10 +20,22 @@ pub use backend::io::types::ReadWriteFlags;
/// - [POSIX]
/// - [Linux]
/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html
/// [Linux]: https://man7.org/linux/man-pages/man2/read.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/read.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=read&sektion=2
+/// [NetBSD]: https://man.netbsd.org/read.2
+/// [OpenBSD]: https://man.openbsd.org/read.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=read&section=2
+/// [illumos]: https://illumos.org/man/2/read
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/I_002fO-Primitives.html#index-reading-from-a-file-descriptor
#[inline]
pub fn read<Fd: AsFd>(fd: Fd, buf: &mut [u8]) -> io::Result<usize> {
backend::io::syscalls::read(fd.as_fd(), buf)
@@ -35,10 +47,22 @@ pub fn read<Fd: AsFd>(fd: Fd, buf: &mut [u8]) -> io::Result<usize> {
/// - [POSIX]
/// - [Linux]
/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html
/// [Linux]: https://man7.org/linux/man-pages/man2/write.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/write.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=write&sektion=2
+/// [NetBSD]: https://man.netbsd.org/write.2
+/// [OpenBSD]: https://man.openbsd.org/write.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=write&section=2
+/// [illumos]: https://illumos.org/man/2/write
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/I_002fO-Primitives.html#index-writing-to-a-file-descriptor
#[inline]
pub fn write<Fd: AsFd>(fd: Fd, buf: &[u8]) -> io::Result<usize> {
backend::io::syscalls::write(fd.as_fd(), buf)
@@ -50,10 +74,20 @@ pub fn write<Fd: AsFd>(fd: Fd, buf: &[u8]) -> io::Result<usize> {
/// - [POSIX]
/// - [Linux]
/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html
/// [Linux]: https://man7.org/linux/man-pages/man2/pread.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/pread.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=pread&sektion=2
+/// [NetBSD]: https://man.netbsd.org/pread.2
+/// [OpenBSD]: https://man.openbsd.org/pread.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pread&section=2
+/// [illumos]: https://illumos.org/man/2/pread
#[inline]
pub fn pread<Fd: AsFd>(fd: Fd, buf: &mut [u8], offset: u64) -> io::Result<usize> {
backend::io::syscalls::pread(fd.as_fd(), buf, offset)
@@ -69,10 +103,20 @@ pub fn pread<Fd: AsFd>(fd: Fd, buf: &mut [u8], offset: u64) -> io::Result<usize>
/// - [POSIX]
/// - [Linux]
/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html
/// [Linux]: https://man7.org/linux/man-pages/man2/pwrite.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/pwrite.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=pwrite&sektion=2
+/// [NetBSD]: https://man.netbsd.org/pwrite.2
+/// [OpenBSD]: https://man.openbsd.org/pwrite.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pwrite&section=2
+/// [illumos]: https://illumos.org/man/2/pwrite
#[inline]
pub fn pwrite<Fd: AsFd>(fd: Fd, buf: &[u8], offset: u64) -> io::Result<usize> {
backend::io::syscalls::pwrite(fd.as_fd(), buf, offset)
@@ -84,10 +128,20 @@ pub fn pwrite<Fd: AsFd>(fd: Fd, buf: &[u8], offset: u64) -> io::Result<usize> {
/// - [POSIX]
/// - [Linux]
/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html
/// [Linux]: https://man7.org/linux/man-pages/man2/readv.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/readv.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=readv&sektion=2
+/// [NetBSD]: https://man.netbsd.org/readv.2
+/// [OpenBSD]: https://man.openbsd.org/readv.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=readv&section=2
+/// [illumos]: https://illumos.org/man/2/readv
#[inline]
pub fn readv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
backend::io::syscalls::readv(fd.as_fd(), bufs)
@@ -99,10 +153,20 @@ pub fn readv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize>
/// - [POSIX]
/// - [Linux]
/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/writev.html
/// [Linux]: https://man7.org/linux/man-pages/man2/writev.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/writev.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=writev&sektion=2
+/// [NetBSD]: https://man.netbsd.org/writev.2
+/// [OpenBSD]: https://man.openbsd.org/writev.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=writev&section=2
+/// [illumos]: https://illumos.org/man/2/writev
#[inline]
pub fn writev<Fd: AsFd>(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
backend::io::syscalls::writev(fd.as_fd(), bufs)
@@ -113,8 +177,18 @@ pub fn writev<Fd: AsFd>(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
///
/// # References
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/preadv.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=preadv&sektion=2
+/// [NetBSD]: https://man.netbsd.org/preadv.2
+/// [OpenBSD]: https://man.openbsd.org/preadv.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=preadv&section=2
+/// [illumos]: https://illumos.org/man/2/preadv
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
#[inline]
pub fn preadv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize> {
@@ -130,8 +204,18 @@ pub fn preadv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io:
///
/// # References
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/pwritev.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=pwritev&sektion=2
+/// [NetBSD]: https://man.netbsd.org/pwritev.2
+/// [OpenBSD]: https://man.openbsd.org/pwritev.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pwritev&section=2
+/// [illumos]: https://illumos.org/man/2/pwritev
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
#[inline]
pub fn pwritev<Fd: AsFd>(fd: Fd, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize> {
diff --git a/vendor/rustix/src/io/stdio.rs b/vendor/rustix/src/io/stdio.rs
index 15af6b005..adfb776d5 100644
--- a/vendor/rustix/src/io/stdio.rs
+++ b/vendor/rustix/src/io/stdio.rs
@@ -32,9 +32,21 @@ use backend::fd::AsFd;
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdin&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stdin.4
+/// [OpenBSD]: https://man.openbsd.org/stdin.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdin&section=4
+/// [illumos]: https://illumos.org/man/4FS/stdin
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdin
#[cfg(feature = "std")]
#[doc(alias = "STDIN_FILENO")]
#[inline]
@@ -66,9 +78,21 @@ pub const fn stdin() -> BorrowedFd<'static> {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdin&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stdin.4
+/// [OpenBSD]: https://man.openbsd.org/stdin.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdin&section=4
+/// [illumos]: https://illumos.org/man/4FS/stdin
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdin
#[cfg(not(feature = "std"))]
#[doc(alias = "STDIN_FILENO")]
#[inline]
@@ -94,9 +118,21 @@ pub const unsafe fn stdin() -> BorrowedFd<'static> {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdin&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stdin.4
+/// [OpenBSD]: https://man.openbsd.org/stdin.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdin&section=4
+/// [illumos]: https://illumos.org/man/4FS/stdin
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdin
#[doc(alias = "STDIN_FILENO")]
#[inline]
pub unsafe fn take_stdin() -> OwnedFd {
@@ -118,9 +154,21 @@ pub unsafe fn take_stdin() -> OwnedFd {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdout&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stdout.4
+/// [OpenBSD]: https://man.openbsd.org/stdout.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdout&section=4
+/// [illumos]: https://illumos.org/man/4FS/stdout
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdout
#[cfg(feature = "std")]
#[doc(alias = "STDOUT_FILENO")]
#[inline]
@@ -133,7 +181,7 @@ pub const fn stdout() -> BorrowedFd<'static> {
/// `STDOUT_FILENO`—Standard output, borrowed.
///
/// In `std`-using configurations, this is a safe function, because the
-/// standard library already assumes that the stdin file descriptor is always
+/// standard library already assumes that the stdout file descriptor is always
/// valid. In `no_std` configurations, it is `unsafe`.
///
/// # Safety
@@ -152,9 +200,21 @@ pub const fn stdout() -> BorrowedFd<'static> {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdout&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stdout.4
+/// [OpenBSD]: https://man.openbsd.org/stdout.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdout&section=4
+/// [illumos]: https://illumos.org/man/4FS/stdout
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdout
#[cfg(not(feature = "std"))]
#[doc(alias = "STDOUT_FILENO")]
#[inline]
@@ -180,9 +240,21 @@ pub const unsafe fn stdout() -> BorrowedFd<'static> {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdout&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stdout.4
+/// [OpenBSD]: https://man.openbsd.org/stdout.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdout&section=4
+/// [illumos]: https://illumos.org/man/4FS/stdout
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdout
#[doc(alias = "STDOUT_FILENO")]
#[inline]
pub unsafe fn take_stdout() -> OwnedFd {
@@ -198,9 +270,21 @@ pub unsafe fn take_stdout() -> OwnedFd {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stderr&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stderr.4
+/// [OpenBSD]: https://man.openbsd.org/stderr.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stderr&section=4
+/// [illumos]: https://illumos.org/man/4FS/stderr
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stderr
#[cfg(feature = "std")]
#[doc(alias = "STDERR_FILENO")]
#[inline]
@@ -226,9 +310,21 @@ pub const fn stderr() -> BorrowedFd<'static> {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stderr&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stderr.4
+/// [OpenBSD]: https://man.openbsd.org/stderr.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stderr&section=4
+/// [illumos]: https://illumos.org/man/4FS/stderr
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stderr
#[cfg(not(feature = "std"))]
#[doc(alias = "STDERR_FILENO")]
#[inline]
@@ -238,7 +334,7 @@ pub const unsafe fn stderr() -> BorrowedFd<'static> {
/// `STDERR_FILENO`—Standard error, owned.
///
-/// This is similar to [`stdout`], however it returns an `OwnedFd` which closes
+/// This is similar to [`stderr`], however it returns an `OwnedFd` which closes
/// standard output when it is dropped.
///
/// # Safety
@@ -259,9 +355,21 @@ pub const unsafe fn stderr() -> BorrowedFd<'static> {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stderr&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stderr.4
+/// [OpenBSD]: https://man.openbsd.org/stderr.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stderr&section=4
+/// [illumos]: https://illumos.org/man/4FS/stderr
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stderr
#[doc(alias = "STDERR_FILENO")]
#[inline]
pub unsafe fn take_stderr() -> OwnedFd {
@@ -279,9 +387,21 @@ pub unsafe fn take_stderr() -> OwnedFd {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdin&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stdin.4
+/// [OpenBSD]: https://man.openbsd.org/stdin.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdin&section=4
+/// [illumos]: https://illumos.org/man/4FS/stdin
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdin
#[doc(alias = "STDIN_FILENO")]
#[inline]
pub const fn raw_stdin() -> RawFd {
@@ -299,9 +419,21 @@ pub const fn raw_stdin() -> RawFd {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdout&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stdout.4
+/// [OpenBSD]: https://man.openbsd.org/stdout.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdout&section=4
+/// [illumos]: https://illumos.org/man/4FS/stdout
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdout
#[doc(alias = "STDOUT_FILENO")]
#[inline]
pub const fn raw_stdout() -> RawFd {
@@ -319,9 +451,21 @@ pub const fn raw_stdout() -> RawFd {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stderr&sektion=4
+/// [NetBSD]: https://man.netbsd.org/stderr.4
+/// [OpenBSD]: https://man.openbsd.org/stderr.4
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stderr&section=4
+/// [illumos]: https://illumos.org/man/4FS/stderr
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stderr
#[doc(alias = "STDERR_FILENO")]
#[inline]
pub const fn raw_stderr() -> RawFd {
diff --git a/vendor/rustix/src/io_uring.rs b/vendor/rustix/src/io_uring.rs
index 0a7dc0872..b94b458f5 100644
--- a/vendor/rustix/src/io_uring.rs
+++ b/vendor/rustix/src/io_uring.rs
@@ -978,7 +978,7 @@ pub union op_flags_union {
#[doc(alias = "msg_flags")]
pub recv_flags: crate::net::RecvFlags,
pub timeout_flags: IoringTimeoutFlags,
- pub accept_flags: crate::net::AcceptFlags,
+ pub accept_flags: crate::net::SocketFlags,
pub cancel_flags: IoringAsyncCancelFlags,
pub open_flags: crate::fs::OFlags,
pub statx_flags: crate::fs::AtFlags,
diff --git a/vendor/rustix/src/lib.rs b/vendor/rustix/src/lib.rs
index 9e62b1594..f0e093585 100644
--- a/vendor/rustix/src/lib.rs
+++ b/vendor/rustix/src/lib.rs
@@ -97,7 +97,7 @@
#![cfg_attr(linux_raw, deny(unsafe_code))]
#![cfg_attr(rustc_attrs, feature(rustc_attrs))]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
-#![cfg_attr(all(target_os = "wasi", feature = "std"), feature(wasi_ext))]
+#![cfg_attr(all(wasi_ext, target_os = "wasi", feature = "std"), feature(wasi_ext))]
#![cfg_attr(
all(linux_raw, naked_functions, target_arch = "x86"),
feature(naked_functions)
@@ -122,6 +122,9 @@
#![allow(clippy::unnecessary_cast)]
// It is common in linux and libc APIs for types to vary between platforms.
#![allow(clippy::useless_conversion)]
+// Redox and WASI have enough differences that it isn't worth
+// precisely conditionallizing all the `use`s for them.
+#![cfg_attr(any(target_os = "redox", target_os = "wasi"), allow(unused_imports))]
#[cfg(not(feature = "rustc-dep-of-std"))]
extern crate alloc;
@@ -134,6 +137,18 @@ pub(crate) mod cstr;
pub(crate) mod const_assert;
pub(crate) mod utils;
+// linux_raw: Weak symbols are used by the use-libc-auxv feature for
+// glibc 2.15 support.
+//
+// libc: Weak symbols are used to call various functions available in some
+// versions of libc and not others.
+#[cfg(any(
+ all(linux_raw, feature = "use-libc-auxv"),
+ all(libc, not(any(windows, target_os = "wasi")))
+))]
+#[macro_use]
+mod weak;
+
// Pick the backend implementation to use.
#[cfg_attr(libc, path = "backend/libc/mod.rs")]
#[cfg_attr(linux_raw, path = "backend/linux_raw/mod.rs")]
diff --git a/vendor/rustix/src/mm/madvise.rs b/vendor/rustix/src/mm/madvise.rs
index cf13f951b..868a31a5e 100644
--- a/vendor/rustix/src/mm/madvise.rs
+++ b/vendor/rustix/src/mm/madvise.rs
@@ -24,10 +24,24 @@ pub use backend::mm::types::Advice;
/// - [POSIX]
/// - [Linux `madvise`]
/// - [Linux `posix_madvise`]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_madvise.html
/// [Linux `madvise`]: https://man7.org/linux/man-pages/man2/madvise.2.html
/// [Linux `posix_madvise`]: https://man7.org/linux/man-pages/man3/posix_madvise.3.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/madvise.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=madvise&sektion=2
+/// [NetBSD]: https://man.netbsd.org/madvise.2
+/// [OpenBSD]: https://man.openbsd.org/madvise.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=madvise&section=2
+/// [illumos]: https://illumos.org/man/3C/madvise
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-madvise
#[inline]
#[doc(alias = "posix_madvise")]
pub unsafe fn madvise(addr: *mut c_void, len: usize, advice: Advice) -> io::Result<()> {
diff --git a/vendor/rustix/src/mm/mmap.rs b/vendor/rustix/src/mm/mmap.rs
index 715c662ec..8d4b7e23b 100644
--- a/vendor/rustix/src/mm/mmap.rs
+++ b/vendor/rustix/src/mm/mmap.rs
@@ -29,9 +29,23 @@ pub use backend::mm::types::{MapFlags, MprotectFlags, ProtFlags};
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html
/// [Linux]: https://man7.org/linux/man-pages/man2/mmap.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/mmap.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=mmap&sektion=2
+/// [NetBSD]: https://man.netbsd.org/mmap.2
+/// [OpenBSD]: https://man.openbsd.org/mmap.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=mmap&section=2
+/// [illumos]: https://illumos.org/man/2/mmap
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-mmap
#[inline]
pub unsafe fn mmap<Fd: AsFd>(
ptr: *mut c_void,
@@ -56,9 +70,23 @@ pub unsafe fn mmap<Fd: AsFd>(
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html
/// [Linux]: https://man7.org/linux/man-pages/man2/mmap.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/mmap.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=mmap&sektion=2
+/// [NetBSD]: https://man.netbsd.org/mmap.2
+/// [OpenBSD]: https://man.openbsd.org/mmap.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=mmap&section=2
+/// [illumos]: https://illumos.org/man/2/mmap
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-mmap
#[inline]
#[doc(alias = "mmap")]
pub unsafe fn mmap_anonymous(
@@ -70,7 +98,7 @@ pub unsafe fn mmap_anonymous(
backend::mm::syscalls::mmap_anonymous(ptr, len, prot, flags)
}
-/// `munmap(ptr, len)`
+/// `munmap(ptr, len)`—Remove a memory mapping.
///
/// # Safety
///
@@ -79,9 +107,23 @@ pub unsafe fn mmap_anonymous(
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/munmap.html
/// [Linux]: https://man7.org/linux/man-pages/man2/munmap.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/munmap.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=munmap&sektion=2
+/// [NetBSD]: https://man.netbsd.org/munmap.2
+/// [OpenBSD]: https://man.openbsd.org/munmap.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=munmap&section=2
+/// [illumos]: https://illumos.org/man/2/munmap
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-munmap
#[inline]
pub unsafe fn munmap(ptr: *mut c_void, len: usize) -> io::Result<()> {
backend::mm::syscalls::munmap(ptr, len)
@@ -139,7 +181,8 @@ pub unsafe fn mremap_fixed(
backend::mm::syscalls::mremap_fixed(old_address, old_size, new_size, flags, new_address)
}
-/// `mprotect(ptr, len, flags)`
+/// `mprotect(ptr, len, flags)`—Change the protection flags of a region of
+/// memory.
///
/// # Safety
///
@@ -148,9 +191,21 @@ pub unsafe fn mremap_fixed(
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mprotect.html
/// [Linux]: https://man7.org/linux/man-pages/man2/mprotect.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/mprotect.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=mprotect&sektion=2
+/// [NetBSD]: https://man.netbsd.org/mprotect.2
+/// [OpenBSD]: https://man.openbsd.org/mprotect.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=mprotect&section=2
+/// [illumos]: https://illumos.org/man/2/mprotect
#[inline]
pub unsafe fn mprotect(ptr: *mut c_void, len: usize, flags: MprotectFlags) -> io::Result<()> {
backend::mm::syscalls::mprotect(ptr, len, flags)
@@ -172,16 +227,29 @@ pub unsafe fn mprotect(ptr: *mut c_void, len: usize, flags: MprotectFlags) -> io
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mlock.html
/// [Linux]: https://man7.org/linux/man-pages/man2/mlock.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/mlock.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=mlock&sektion=2
+/// [NetBSD]: https://man.netbsd.org/mlock.2
+/// [OpenBSD]: https://man.openbsd.org/mlock.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=mlock&section=2
+/// [illumos]: https://illumos.org/man/3C/mlock
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Page-Lock-Functions.html#index-mlock
#[inline]
pub unsafe fn mlock(ptr: *mut c_void, len: usize) -> io::Result<()> {
backend::mm::syscalls::mlock(ptr, len)
}
-/// `mlock2(ptr, len, flags)`—Lock memory into RAM, with
-/// flags.
+/// `mlock2(ptr, len, flags)`—Lock memory into RAM, with flags.
///
/// `mlock_with` is the same as [`mlock`] but adds an additional flags operand.
///
@@ -198,8 +266,10 @@ pub unsafe fn mlock(ptr: *mut c_void, len: usize) -> io::Result<()> {
///
/// # References
/// - [Linux]
+/// - [glibc]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/mlock2.2.html
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Page-Lock-Functions.html#index-mlock2
#[cfg(any(target_os = "android", target_os = "linux"))]
#[inline]
#[doc(alias = "mlock2")]
@@ -222,9 +292,23 @@ pub unsafe fn mlock_with(ptr: *mut c_void, len: usize, flags: MlockFlags) -> io:
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/munlock.html
/// [Linux]: https://man7.org/linux/man-pages/man2/munlock.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/munlock.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=munlock&sektion=2
+/// [NetBSD]: https://man.netbsd.org/munlock.2
+/// [OpenBSD]: https://man.openbsd.org/munlock.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=munlock&section=2
+/// [illumos]: https://illumos.org/man/3C/munlock
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Page-Lock-Functions.html#index-munlock
#[inline]
pub unsafe fn munlock(ptr: *mut c_void, len: usize) -> io::Result<()> {
backend::mm::syscalls::munlock(ptr, len)
diff --git a/vendor/rustix/src/mm/msync.rs b/vendor/rustix/src/mm/msync.rs
index 3ca418fc4..0306e36b9 100644
--- a/vendor/rustix/src/mm/msync.rs
+++ b/vendor/rustix/src/mm/msync.rs
@@ -22,10 +22,24 @@ pub use backend::mm::types::MsyncFlags;
///
/// # References
/// - [POSIX]
-/// - [Linux `msync`]
+/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/msync.html
-/// [Linux `msync`]: https://man7.org/linux/man-pages/man2/msync.2.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/msync.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/msync.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=msync&sektion=2
+/// [NetBSD]: https://man.netbsd.org/msync.2
+/// [OpenBSD]: https://man.openbsd.org/msync.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=msync&section=2
+/// [illumos]: https://illumos.org/man/3C/msync
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-msync
#[inline]
pub unsafe fn msync(addr: *mut c_void, len: usize, flags: MsyncFlags) -> io::Result<()> {
backend::mm::syscalls::msync(addr, len, flags)
diff --git a/vendor/rustix/src/net/send_recv.rs b/vendor/rustix/src/net/send_recv.rs
index 041077266..439711727 100644
--- a/vendor/rustix/src/net/send_recv.rs
+++ b/vendor/rustix/src/net/send_recv.rs
@@ -11,15 +11,29 @@ pub use backend::net::send_recv::{RecvFlags, SendFlags};
/// `recv(fd, buf, flags)`—Reads data from a socket.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendrecv
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html
/// [Linux]: https://man7.org/linux/man-pages/man2/recv.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/recv.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recv
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2
+/// [NetBSD]: https://man.netbsd.org/recv.2
+/// [OpenBSD]: https://man.openbsd.org/recv.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=recv&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/recv
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Receiving-Data.html
#[inline]
pub fn recv<Fd: AsFd>(fd: Fd, buf: &mut [u8], flags: RecvFlags) -> io::Result<usize> {
backend::net::syscalls::recv(fd.as_fd(), buf, flags)
@@ -28,15 +42,29 @@ pub fn recv<Fd: AsFd>(fd: Fd, buf: &mut [u8], flags: RecvFlags) -> io::Result<us
/// `send(fd, buf, flags)`—Writes data to a socket.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendrecv
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html
/// [Linux]: https://man7.org/linux/man-pages/man2/send.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/send.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2
+/// [NetBSD]: https://man.netbsd.org/send.2
+/// [OpenBSD]: https://man.openbsd.org/send.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=send&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/send
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Data.html
#[inline]
pub fn send<Fd: AsFd>(fd: Fd, buf: &[u8], flags: SendFlags) -> io::Result<usize> {
backend::net::syscalls::send(fd.as_fd(), buf, flags)
@@ -46,15 +74,29 @@ pub fn send<Fd: AsFd>(fd: Fd, buf: &[u8], flags: SendFlags) -> io::Result<usize>
/// returns the sender address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html
/// [Linux]: https://man7.org/linux/man-pages/man2/recvfrom.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/recvfrom.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recvfrom
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=recvfrom&sektion=2
+/// [NetBSD]: https://man.netbsd.org/recvfrom.2
+/// [OpenBSD]: https://man.openbsd.org/recvfrom.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=recvfrom&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/recvfrom
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Receiving-Datagrams.html
#[inline]
pub fn recvfrom<Fd: AsFd>(
fd: Fd,
@@ -68,15 +110,29 @@ pub fn recvfrom<Fd: AsFd>(
/// address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html
/// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2
+/// [NetBSD]: https://man.netbsd.org/sendto.2
+/// [OpenBSD]: https://man.openbsd.org/sendto.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/sendto
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html
pub fn sendto<Fd: AsFd>(
fd: Fd,
buf: &[u8],
@@ -102,15 +158,29 @@ fn _sendto(
/// address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html
/// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2
+/// [NetBSD]: https://man.netbsd.org/sendto.2
+/// [OpenBSD]: https://man.openbsd.org/sendto.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/sendto
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html
pub fn sendto_any<Fd: AsFd>(
fd: Fd,
buf: &[u8],
@@ -138,15 +208,29 @@ fn _sendto_any(
/// a socket to a specific IPv4 address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html
/// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2
+/// [NetBSD]: https://man.netbsd.org/sendto.2
+/// [OpenBSD]: https://man.openbsd.org/sendto.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/sendto
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html
#[inline]
#[doc(alias = "sendto")]
pub fn sendto_v4<Fd: AsFd>(
@@ -162,15 +246,29 @@ pub fn sendto_v4<Fd: AsFd>(
/// to a socket to a specific IPv6 address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html
/// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2
+/// [NetBSD]: https://man.netbsd.org/sendto.2
+/// [OpenBSD]: https://man.openbsd.org/sendto.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/sendto
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html
#[inline]
#[doc(alias = "sendto")]
pub fn sendto_v6<Fd: AsFd>(
@@ -186,15 +284,29 @@ pub fn sendto_v6<Fd: AsFd>(
/// a socket to a specific Unix-domain socket address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html
/// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2
+/// [NetBSD]: https://man.netbsd.org/sendto.2
+/// [OpenBSD]: https://man.openbsd.org/sendto.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/sendto
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html
#[cfg(unix)]
#[inline]
#[doc(alias = "sendto")]
diff --git a/vendor/rustix/src/net/socket.rs b/vendor/rustix/src/net/socket.rs
index 5840d39ff..dbfb391ba 100644
--- a/vendor/rustix/src/net/socket.rs
+++ b/vendor/rustix/src/net/socket.rs
@@ -5,9 +5,10 @@ use backend::fd::{AsFd, BorrowedFd};
#[cfg(unix)]
pub use backend::net::addr::SocketAddrUnix;
-pub use backend::net::types::{
- AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType,
-};
+pub use backend::net::types::{AddressFamily, Protocol, Shutdown, SocketFlags, SocketType};
+
+/// Compatibility alias for `SocketFlags`. Use `SocketFlags` instead of this.
+pub type AcceptFlags = SocketFlags;
impl Default for Protocol {
#[inline]
@@ -25,15 +26,29 @@ impl Default for Protocol {
/// To pass extra flags such as [`SocketFlags::CLOEXEC`], use [`socket_with`].
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#socket
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html
/// [Linux]: https://man7.org/linux/man-pages/man2/socket.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/socket.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2
+/// [NetBSD]: https://man.netbsd.org/socket.2
+/// [OpenBSD]: https://man.openbsd.org/socket.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=socket&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/socket
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Creating-a-Socket.html
#[inline]
pub fn socket(domain: AddressFamily, type_: SocketType, protocol: Protocol) -> io::Result<OwnedFd> {
backend::net::syscalls::socket(domain, type_, protocol)
@@ -50,15 +65,29 @@ pub fn socket(domain: AddressFamily, type_: SocketType, protocol: Protocol) -> i
/// operand.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#socket
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html
/// [Linux]: https://man7.org/linux/man-pages/man2/socket.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/socket.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2
+/// [NetBSD]: https://man.netbsd.org/socket.2
+/// [OpenBSD]: https://man.openbsd.org/socket.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=socket&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/socket
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Creating-a-Socket.html
#[inline]
pub fn socket_with(
domain: AddressFamily,
@@ -72,15 +101,29 @@ pub fn socket_with(
/// `bind(sockfd, addr)`—Binds a socket to an IP address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html
/// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2
+/// [NetBSD]: https://man.netbsd.org/bind.2
+/// [OpenBSD]: https://man.openbsd.org/bind.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/bind
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html
pub fn bind<Fd: AsFd>(sockfd: Fd, addr: &SocketAddr) -> io::Result<()> {
_bind(sockfd.as_fd(), addr)
}
@@ -95,15 +138,29 @@ fn _bind(sockfd: BorrowedFd<'_>, addr: &SocketAddr) -> io::Result<()> {
/// `bind(sockfd, addr)`—Binds a socket to an address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html
/// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2
+/// [NetBSD]: https://man.netbsd.org/bind.2
+/// [OpenBSD]: https://man.openbsd.org/bind.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/bind
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html
#[doc(alias = "bind")]
pub fn bind_any<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrAny) -> io::Result<()> {
_bind_any(sockfd.as_fd(), addr)
@@ -122,15 +179,29 @@ fn _bind_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()> {
/// IPv4 address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html
/// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2
+/// [NetBSD]: https://man.netbsd.org/bind.2
+/// [OpenBSD]: https://man.openbsd.org/bind.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/bind
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html
#[inline]
#[doc(alias = "bind")]
pub fn bind_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> {
@@ -141,15 +212,29 @@ pub fn bind_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> {
/// IPv6 address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html
/// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2
+/// [NetBSD]: https://man.netbsd.org/bind.2
+/// [OpenBSD]: https://man.openbsd.org/bind.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/bind
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html
#[inline]
#[doc(alias = "bind")]
pub fn bind_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> {
@@ -160,15 +245,29 @@ pub fn bind_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> {
/// Unix-domain address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html
/// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2
+/// [NetBSD]: https://man.netbsd.org/bind.2
+/// [OpenBSD]: https://man.openbsd.org/bind.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/bind
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html
#[cfg(unix)]
#[inline]
#[doc(alias = "bind")]
@@ -179,15 +278,29 @@ pub fn bind_unix<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<()>
/// `connect(sockfd, addr)`—Initiates a connection to an IP address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#connect
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html
/// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2
+/// [NetBSD]: https://man.netbsd.org/connect.2
+/// [OpenBSD]: https://man.openbsd.org/connect.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/connect
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html
pub fn connect<Fd: AsFd>(sockfd: Fd, addr: &SocketAddr) -> io::Result<()> {
_connect(sockfd.as_fd(), addr)
}
@@ -202,15 +315,29 @@ fn _connect(sockfd: BorrowedFd<'_>, addr: &SocketAddr) -> io::Result<()> {
/// `connect(sockfd, addr)`—Initiates a connection.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#connect
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html
/// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2
+/// [NetBSD]: https://man.netbsd.org/connect.2
+/// [OpenBSD]: https://man.openbsd.org/connect.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/connect
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html
#[doc(alias = "connect")]
pub fn connect_any<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrAny) -> io::Result<()> {
_connect_any(sockfd.as_fd(), addr)
@@ -229,15 +356,29 @@ fn _connect_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()>
/// connection to an IPv4 address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#connect
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html
/// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2
+/// [NetBSD]: https://man.netbsd.org/connect.2
+/// [OpenBSD]: https://man.openbsd.org/connect.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/connect
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html
#[inline]
#[doc(alias = "connect")]
pub fn connect_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> {
@@ -248,15 +389,29 @@ pub fn connect_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> {
/// connection to an IPv6 address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#connect
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html
/// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2
+/// [NetBSD]: https://man.netbsd.org/connect.2
+/// [OpenBSD]: https://man.openbsd.org/connect.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/connect
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html
#[inline]
#[doc(alias = "connect")]
pub fn connect_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> {
@@ -267,15 +422,29 @@ pub fn connect_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> {
/// connection to a Unix-domain address.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#connect
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html
/// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2
+/// [NetBSD]: https://man.netbsd.org/connect.2
+/// [OpenBSD]: https://man.openbsd.org/connect.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/connect
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html
#[cfg(unix)]
#[inline]
#[doc(alias = "connect")]
@@ -286,15 +455,29 @@ pub fn connect_unix<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<(
/// `listen(fd, backlog)`—Enables listening for incoming connections.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#listen
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html
/// [Linux]: https://man7.org/linux/man-pages/man2/listen.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/listen.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2
+/// [NetBSD]: https://man.netbsd.org/listen.2
+/// [OpenBSD]: https://man.openbsd.org/listen.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=listen&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/listen
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Listening.html
#[inline]
pub fn listen<Fd: AsFd>(sockfd: Fd, backlog: i32) -> io::Result<()> {
backend::net::syscalls::listen(sockfd.as_fd(), backlog)
@@ -309,17 +492,30 @@ pub fn listen<Fd: AsFd>(sockfd: Fd, backlog: i32) -> io::Result<()> {
/// be unexpectedly allocated on other threads or in libraries.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#acceptthank-you-for-calling-port-3490.
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html
/// [Linux]: https://man7.org/linux/man-pages/man2/accept.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/accept.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2
+/// [NetBSD]: https://man.netbsd.org/accept.2
+/// [OpenBSD]: https://man.openbsd.org/accept.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=accept&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/accept
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Accepting-Connections.html
#[inline]
-#[doc(alias = "accept4")]
pub fn accept<Fd: AsFd>(sockfd: Fd) -> io::Result<OwnedFd> {
backend::net::syscalls::accept(sockfd.as_fd())
}
@@ -338,11 +534,21 @@ pub fn accept<Fd: AsFd>(sockfd: Fd) -> io::Result<OwnedFd> {
///
/// # References
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/accept4.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=accept4&sektion=2
+/// [NetBSD]: https://man.netbsd.org/accept4.2
+/// [OpenBSD]: https://man.openbsd.org/accept4.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=accept4&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/accept4
#[inline]
#[doc(alias = "accept4")]
-pub fn accept_with<Fd: AsFd>(sockfd: Fd, flags: AcceptFlags) -> io::Result<OwnedFd> {
+pub fn accept_with<Fd: AsFd>(sockfd: Fd, flags: SocketFlags) -> io::Result<OwnedFd> {
backend::net::syscalls::accept_with(sockfd.as_fd(), flags)
}
@@ -352,17 +558,31 @@ pub fn accept_with<Fd: AsFd>(sockfd: Fd, flags: AcceptFlags) -> io::Result<Owned
/// Use [`accept`] if the peer address isn't needed.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#acceptthank-you-for-calling-port-3490.
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html
/// [Linux]: https://man7.org/linux/man-pages/man2/accept.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/accept.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2
+/// [NetBSD]: https://man.netbsd.org/accept.2
+/// [OpenBSD]: https://man.openbsd.org/accept.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=accept&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/accept
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Accepting-Connections.html
#[inline]
-#[doc(alias = "accept4")]
+#[doc(alias = "accept")]
pub fn acceptfrom<Fd: AsFd>(sockfd: Fd) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> {
backend::net::syscalls::acceptfrom(sockfd.as_fd())
}
@@ -377,13 +597,23 @@ pub fn acceptfrom<Fd: AsFd>(sockfd: Fd) -> io::Result<(OwnedFd, Option<SocketAdd
///
/// # References
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/accept4.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=accept4&sektion=2
+/// [NetBSD]: https://man.netbsd.org/accept4.2
+/// [OpenBSD]: https://man.openbsd.org/accept4.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=accept4&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/accept4
#[inline]
#[doc(alias = "accept4")]
pub fn acceptfrom_with<Fd: AsFd>(
sockfd: Fd,
- flags: AcceptFlags,
+ flags: SocketFlags,
) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> {
backend::net::syscalls::acceptfrom_with(sockfd.as_fd(), flags)
}
@@ -391,15 +621,29 @@ pub fn acceptfrom_with<Fd: AsFd>(
/// `shutdown(fd, how)`—Closes the read and/or write sides of a stream.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#close-and-shutdownget-outta-my-face
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html
/// [Linux]: https://man7.org/linux/man-pages/man2/shutdown.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/shutdown.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-shutdown
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=shutdown&sektion=2
+/// [NetBSD]: https://man.netbsd.org/shutdown.2
+/// [OpenBSD]: https://man.openbsd.org/shutdown.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=shutdown&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/shutdown
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Closing-a-Socket.html
#[inline]
pub fn shutdown<Fd: AsFd>(sockfd: Fd, how: Shutdown) -> io::Result<()> {
backend::net::syscalls::shutdown(sockfd.as_fd(), how)
@@ -412,11 +656,23 @@ pub fn shutdown<Fd: AsFd>(sockfd: Fd, how: Shutdown) -> io::Result<()> {
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html
/// [Linux]: https://man7.org/linux/man-pages/man2/getsockname.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockname.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockname
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockname&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockname.2
+/// [OpenBSD]: https://man.openbsd.org/getsockname.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockname&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockname
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Reading-Address.html
#[inline]
pub fn getsockname<Fd: AsFd>(sockfd: Fd) -> io::Result<SocketAddrAny> {
backend::net::syscalls::getsockname(sockfd.as_fd())
@@ -426,15 +682,29 @@ pub fn getsockname<Fd: AsFd>(sockfd: Fd) -> io::Result<SocketAddrAny> {
/// to.
///
/// # References
+/// - [Beej's Guide to Network Programming]
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [Winsock2]
-///
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#getpeernamewho-are-you
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html
/// [Linux]: https://man7.org/linux/man-pages/man2/getpeername.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getpeername.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getpeername
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getpeername.2
+/// [OpenBSD]: https://man.openbsd.org/getpeername.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getpeername&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getpeername
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Who-is-Connected.html
#[inline]
pub fn getpeername<Fd: AsFd>(sockfd: Fd) -> io::Result<Option<SocketAddrAny>> {
backend::net::syscalls::getpeername(sockfd.as_fd())
diff --git a/vendor/rustix/src/net/socketpair.rs b/vendor/rustix/src/net/socketpair.rs
index 4a9568ce7..b2d46060e 100644
--- a/vendor/rustix/src/net/socketpair.rs
+++ b/vendor/rustix/src/net/socketpair.rs
@@ -7,9 +7,23 @@ use crate::{backend, io};
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html
/// [Linux]: https://man7.org/linux/man-pages/man2/socketpair.2.html
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/socketpair.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=socketpair&sektion=2
+/// [NetBSD]: https://man.netbsd.org/socketpair.2
+/// [OpenBSD]: https://man.openbsd.org/socketpair.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=socketpair&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/socketpair
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Socket-Pairs.html
#[inline]
pub fn socketpair(
domain: AddressFamily,
diff --git a/vendor/rustix/src/net/sockopt.rs b/vendor/rustix/src/net/sockopt.rs
index ffdc67942..26de89e0a 100644
--- a/vendor/rustix/src/net/sockopt.rs
+++ b/vendor/rustix/src/net/sockopt.rs
@@ -22,6 +22,14 @@ pub use backend::net::types::Timeout;
/// - [Linux `socket`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
@@ -29,6 +37,14 @@ pub use backend::net::types::Timeout;
/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
#[inline]
#[doc(alias = "SO_TYPE")]
pub fn get_socket_type<Fd: AsFd>(fd: Fd) -> io::Result<SocketType> {
@@ -44,6 +60,14 @@ pub fn get_socket_type<Fd: AsFd>(fd: Fd) -> io::Result<SocketType> {
/// - [Linux `socket`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `setsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
@@ -51,6 +75,14 @@ pub fn get_socket_type<Fd: AsFd>(fd: Fd) -> io::Result<SocketType> {
/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/setsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/setsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt
+/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
#[inline]
#[doc(alias = "SO_REUSEADDR")]
pub fn set_socket_reuseaddr<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> {
@@ -66,6 +98,14 @@ pub fn set_socket_reuseaddr<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> {
/// - [Linux `socket`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `setsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
@@ -73,6 +113,14 @@ pub fn set_socket_reuseaddr<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> {
/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/setsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/setsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt
+/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
#[inline]
#[doc(alias = "SO_BROADCAST")]
pub fn set_socket_broadcast<Fd: AsFd>(fd: Fd, broadcast: bool) -> io::Result<()> {
@@ -88,6 +136,14 @@ pub fn set_socket_broadcast<Fd: AsFd>(fd: Fd, broadcast: bool) -> io::Result<()>
/// - [Linux `socket`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
@@ -95,6 +151,14 @@ pub fn set_socket_broadcast<Fd: AsFd>(fd: Fd, broadcast: bool) -> io::Result<()>
/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
#[inline]
#[doc(alias = "SO_BROADCAST")]
pub fn get_socket_broadcast<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
@@ -110,6 +174,14 @@ pub fn get_socket_broadcast<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
/// - [Linux `socket`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `setsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
@@ -117,6 +189,14 @@ pub fn get_socket_broadcast<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/setsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/setsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt
+/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
#[inline]
#[doc(alias = "SO_LINGER")]
pub fn set_socket_linger<Fd: AsFd>(fd: Fd, linger: Option<Duration>) -> io::Result<()> {
@@ -132,6 +212,14 @@ pub fn set_socket_linger<Fd: AsFd>(fd: Fd, linger: Option<Duration>) -> io::Resu
/// - [Linux `socket`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
@@ -139,6 +227,14 @@ pub fn set_socket_linger<Fd: AsFd>(fd: Fd, linger: Option<Duration>) -> io::Resu
/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
#[inline]
#[doc(alias = "SO_LINGER")]
pub fn get_socket_linger<Fd: AsFd>(fd: Fd) -> io::Result<Option<Duration>> {
@@ -175,8 +271,8 @@ pub fn get_socket_passcred<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
backend::net::syscalls::sockopt::get_socket_passcred(fd.as_fd())
}
-/// `setsockopt(fd, SOL_SOCKET, id, timeout)`—Set the sending
-/// or receiving timeout.
+/// `setsockopt(fd, SOL_SOCKET, id, timeout)`—Set the sending or receiving
+/// timeout.
///
/// # References
/// - [POSIX `setsockopt`]
@@ -185,6 +281,14 @@ pub fn get_socket_passcred<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
/// - [Linux `socket`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `setsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
@@ -192,6 +296,14 @@ pub fn get_socket_passcred<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/setsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/setsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt
+/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
#[inline]
#[doc(alias = "SO_RCVTIMEO")]
#[doc(alias = "SO_SNDTIMEO")]
@@ -212,6 +324,14 @@ pub fn set_socket_timeout<Fd: AsFd>(
/// - [Linux `socket`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
@@ -219,6 +339,14 @@ pub fn set_socket_timeout<Fd: AsFd>(
/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
#[inline]
#[doc(alias = "SO_RCVTIMEO")]
#[doc(alias = "SO_SNDTIMEO")]
@@ -235,6 +363,14 @@ pub fn get_socket_timeout<Fd: AsFd>(fd: Fd, id: Timeout) -> io::Result<Option<Du
/// - [Linux `socket`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
@@ -242,12 +378,326 @@ pub fn get_socket_timeout<Fd: AsFd>(fd: Fd, id: Timeout) -> io::Result<Option<Du
/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
#[inline]
#[doc(alias = "SO_ERROR")]
-pub fn get_socket_error<Fd: AsFd>(fd: Fd) -> io::Result<Result<(), crate::io::Errno>> {
+pub fn get_socket_error<Fd: AsFd>(fd: Fd) -> io::Result<Result<(), io::Errno>> {
backend::net::syscalls::sockopt::get_socket_error(fd.as_fd())
}
+/// `getsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[cfg(any(apple, target_os = "freebsd"))]
+#[doc(alias = "SO_NOSIGPIPE")]
+#[inline]
+pub fn getsockopt_nosigpipe<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
+ backend::net::syscalls::sockopt::getsockopt_nosigpipe(fd.as_fd())
+}
+
+/// `setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, val)`
+///
+/// # References
+/// - [POSIX `setsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `setsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `setsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `setsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/setsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/setsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt
+/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[cfg(any(apple, target_os = "freebsd"))]
+#[doc(alias = "SO_NOSIGPIPE")]
+#[inline]
+pub fn setsockopt_nosigpipe<Fd: AsFd>(fd: Fd, val: bool) -> io::Result<()> {
+ backend::net::syscalls::sockopt::setsockopt_nosigpipe(fd.as_fd(), val)
+}
+
+/// `setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, keepalive)`
+///
+/// # References
+/// - [POSIX `setsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `setsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `setsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `setsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/setsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/setsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt
+/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[inline]
+#[doc(alias = "SO_KEEPALIVE")]
+pub fn set_socket_keepalive<Fd: AsFd>(fd: Fd, keepalive: bool) -> io::Result<()> {
+ backend::net::syscalls::sockopt::set_socket_keepalive(fd.as_fd(), keepalive)
+}
+
+/// `getsockopt(fd, SOL_SOCKET, SO_KEEPALIVE)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[inline]
+#[doc(alias = "SO_KEEPALIVE")]
+pub fn get_socket_keepalive<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
+ backend::net::syscalls::sockopt::get_socket_keepalive(fd.as_fd())
+}
+
+/// `setsockopt(fd, SOL_SOCKET, SO_RCVBUF, size)`
+///
+/// # References
+/// - [POSIX `setsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `setsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `setsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `setsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/setsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/setsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt
+/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[inline]
+#[doc(alias = "SO_RCVBUF")]
+pub fn set_socket_recv_buffer_size<Fd: AsFd>(fd: Fd, size: usize) -> io::Result<()> {
+ backend::net::syscalls::sockopt::set_socket_recv_buffer_size(fd.as_fd(), size)
+}
+
+/// `getsockopt(fd, SOL_SOCKET, SO_RCVBUF)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[inline]
+#[doc(alias = "SO_RCVBUF")]
+pub fn get_socket_recv_buffer_size<Fd: AsFd>(fd: Fd) -> io::Result<usize> {
+ backend::net::syscalls::sockopt::get_socket_recv_buffer_size(fd.as_fd())
+}
+
+/// `setsockopt(fd, SOL_SOCKET, SO_SNDBUF, size)`
+///
+/// # References
+/// - [POSIX `setsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `setsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `setsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `setsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/setsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/setsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt
+/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[inline]
+#[doc(alias = "SO_SNDBUF")]
+pub fn set_socket_send_buffer_size<Fd: AsFd>(fd: Fd, size: usize) -> io::Result<()> {
+ backend::net::syscalls::sockopt::set_socket_send_buffer_size(fd.as_fd(), size)
+}
+
+/// `getsockopt(fd, SOL_SOCKET, SO_SNDBUF)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[inline]
+#[doc(alias = "SO_SNDBUF")]
+pub fn get_socket_send_buffer_size<Fd: AsFd>(fd: Fd) -> io::Result<usize> {
+ backend::net::syscalls::sockopt::get_socket_send_buffer_size(fd.as_fd())
+}
+
/// `setsockopt(fd, IPPROTO_IP, IP_TTL, ttl)`
///
/// # References
@@ -257,12 +707,36 @@ pub fn get_socket_error<Fd: AsFd>(fd: Fd) -> io::Result<Result<(), crate::io::Er
/// - [Linux `ip`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_IP` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html
/// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip`]: https://man.netbsd.org/ip.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip`]: https://illumos.org/man/4P/ip
#[inline]
#[doc(alias = "IP_TTL")]
pub fn set_ip_ttl<Fd: AsFd>(fd: Fd, ttl: u32) -> io::Result<()> {
@@ -277,7 +751,19 @@ pub fn set_ip_ttl<Fd: AsFd>(fd: Fd, ttl: u32) -> io::Result<()> {
/// - [Linux `getsockopt`]
/// - [Linux `ip`]
/// - [Winsock2 `getsockopt`]
-/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Winsock2 `IPPROTO_IP` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `ip`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `ip`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `ip`]
+/// - [OpenBSD `getsockopt`]
+/// - [OpenBSD `ip`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `ip`]
+/// - [illumos `getsockopt`]
+/// - [illumos `ip`]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -285,6 +771,18 @@ pub fn set_ip_ttl<Fd: AsFd>(fd: Fd, ttl: u32) -> io::Result<()> {
/// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html
/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
/// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip`]: https://man.netbsd.org/ip.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip`]: https://illumos.org/man/4P/ip
#[inline]
#[doc(alias = "IP_TTL")]
pub fn get_ip_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
@@ -300,6 +798,18 @@ pub fn get_ip_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
/// - [Linux `ipv6`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip6`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip6`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip6`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip6`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip6`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip6`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -307,6 +817,18 @@ pub fn get_ip_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip6`]: https://illumos.org/man/4P/ip6
#[inline]
#[doc(alias = "IPV6_V6ONLY")]
pub fn set_ipv6_v6only<Fd: AsFd>(fd: Fd, only_v6: bool) -> io::Result<()> {
@@ -322,6 +844,18 @@ pub fn set_ipv6_v6only<Fd: AsFd>(fd: Fd, only_v6: bool) -> io::Result<()> {
/// - [Linux `ipv6`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `ip6`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `ip6`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `ip6`]
+/// - [OpenBSD `getsockopt`]
+/// - [OpenBSD `ip6`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `ip6`]
+/// - [illumos `getsockopt`]
+/// - [illumos `ip6`]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -329,6 +863,18 @@ pub fn set_ipv6_v6only<Fd: AsFd>(fd: Fd, only_v6: bool) -> io::Result<()> {
/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4
+/// [OpenBSD `getsockopt`]: https://man.openbsd.org/getsockopt.2
+/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `ip6`]: https://illumos.org/man/4P/ip6
#[inline]
#[doc(alias = "IPV6_V6ONLY")]
pub fn get_ipv6_v6only<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
@@ -344,6 +890,18 @@ pub fn get_ipv6_v6only<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
/// - [Linux `ip`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_IP` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -351,6 +909,18 @@ pub fn get_ipv6_v6only<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
/// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip`]: https://man.netbsd.org/ip.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip`]: https://illumos.org/man/4P/ip
#[inline]
#[doc(alias = "IP_MULTICAST_LOOP")]
pub fn set_ip_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Result<()> {
@@ -366,6 +936,18 @@ pub fn set_ip_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Resu
/// - [Linux `ip`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `IPPROTO_IP` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `ip`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `ip`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `ip`]
+/// - [OpenBSD `getsockopt`]
+/// - [OpenBSD `ip`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `ip`]
+/// - [illumos `getsockopt`]
+/// - [illumos `ip`]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -388,6 +970,18 @@ pub fn get_ip_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
/// - [Linux `ip`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_IP` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -395,6 +989,18 @@ pub fn get_ip_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
/// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip`]: https://man.netbsd.org/ip.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip`]: https://illumos.org/man/4P/ip
#[inline]
#[doc(alias = "IP_MULTICAST_TTL")]
pub fn set_ip_multicast_ttl<Fd: AsFd>(fd: Fd, multicast_ttl: u32) -> io::Result<()> {
@@ -410,6 +1016,18 @@ pub fn set_ip_multicast_ttl<Fd: AsFd>(fd: Fd, multicast_ttl: u32) -> io::Result<
/// - [Linux `ip`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `IPPROTO_IP` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `ip`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `ip`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `ip`]
+/// - [OpenBSD `getsockopt`]
+/// - [OpenBSD `ip`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `ip`]
+/// - [illumos `getsockopt`]
+/// - [illumos `ip`]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -432,6 +1050,18 @@ pub fn get_ip_multicast_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
/// - [Linux `ipv6`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip6`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip6`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip6`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip6`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip6`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip6`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -439,6 +1069,18 @@ pub fn get_ip_multicast_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip6`]: https://illumos.org/man/4P/ip6
#[inline]
#[doc(alias = "IPV6_MULTICAST_LOOP")]
pub fn set_ipv6_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Result<()> {
@@ -454,6 +1096,18 @@ pub fn set_ipv6_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Re
/// - [Linux `ipv6`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `ip6`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `ip6`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `ip6`]
+/// - [OpenBSD `getsockopt`]
+/// - [OpenBSD `ip6`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `ip6`]
+/// - [illumos `getsockopt`]
+/// - [illumos `ip6`]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -461,13 +1115,25 @@ pub fn set_ipv6_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Re
/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4
+/// [OpenBSD `getsockopt`]: https://man.openbsd.org/getsockopt.2
+/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `ip6`]: https://illumos.org/man/4P/ip6
#[inline]
#[doc(alias = "IPV6_MULTICAST_LOOP")]
pub fn get_ipv6_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
backend::net::syscalls::sockopt::get_ipv6_multicast_loop(fd.as_fd())
}
-/// `setsockopt(fd, IPPROTO_IP, IPV6_MULTICAST_HOPS, multicast_hops)`
+/// `setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, multicast_hops)`
///
/// # References
/// - [POSIX `setsockopt`]
@@ -476,6 +1142,18 @@ pub fn get_ipv6_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
/// - [Linux `ipv6`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip6`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip6`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip6`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip6`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip6`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip6`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -483,13 +1161,117 @@ pub fn get_ipv6_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip6`]: https://illumos.org/man/4P/ip6
#[inline]
#[doc(alias = "IP_MULTICAST_TTL")]
pub fn set_ipv6_multicast_hops<Fd: AsFd>(fd: Fd, multicast_hops: u32) -> io::Result<()> {
backend::net::syscalls::sockopt::set_ipv6_multicast_hops(fd.as_fd(), multicast_hops)
}
-/// `getsockopt(fd, IPPROTO_IP, IPV6_MULTICAST_HOPS)`
+/// `getsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `netinet/in.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `ipv6`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `ip6`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `ip6`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `ip6`]
+/// - [OpenBSD `getsockopt`]
+/// - [OpenBSD `ip6`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `ip6`]
+/// - [illumos `getsockopt`]
+/// - [illumos `ip6`]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4
+/// [OpenBSD `getsockopt`]: https://man.openbsd.org/getsockopt.2
+/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `ip6`]: https://illumos.org/man/4P/ip6
+#[inline]
+#[doc(alias = "IPV6_UNICAST_HOPS")]
+pub fn get_ipv6_unicast_hops<Fd: AsFd>(fd: Fd) -> io::Result<u8> {
+ backend::net::syscalls::sockopt::get_ipv6_unicast_hops(fd.as_fd())
+}
+
+/// `setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, unicast_hops)`
+///
+/// # References
+/// - [POSIX `setsockopt`]
+/// - [POSIX `netinet/in.h`]
+/// - [Linux `setsockopt`]
+/// - [Linux `ipv6`]
+/// - [Winsock2 `setsockopt`]
+/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip6`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip6`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip6`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip6`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip6`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip6`]
+///
+/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
+/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
+/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html
+/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
+/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
+/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip6`]: https://illumos.org/man/4P/ip6
+#[inline]
+#[doc(alias = "IPV6_UNICAST_HOPS")]
+pub fn set_ipv6_unicast_hops<Fd: AsFd>(fd: Fd, unicast_hops: Option<u8>) -> io::Result<()> {
+ backend::net::syscalls::sockopt::set_ipv6_unicast_hops(fd.as_fd(), unicast_hops)
+}
+
+/// `getsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS)`
///
/// # References
/// - [POSIX `getsockopt`]
@@ -498,6 +1280,18 @@ pub fn set_ipv6_multicast_hops<Fd: AsFd>(fd: Fd, multicast_hops: u32) -> io::Res
/// - [Linux `ipv6`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `ip6`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `ip6`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `ip6`]
+/// - [OpenBSD `getsockopt`]
+/// - [OpenBSD `ip6`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `ip6`]
+/// - [illumos `getsockopt`]
+/// - [illumos `ip6`]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -505,6 +1299,18 @@ pub fn set_ipv6_multicast_hops<Fd: AsFd>(fd: Fd, multicast_hops: u32) -> io::Res
/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4
+/// [OpenBSD `getsockopt`]: https://man.openbsd.org/getsockopt.2
+/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `ip6`]: https://illumos.org/man/4P/ip6
#[inline]
#[doc(alias = "IP_MULTICAST_TTL")]
pub fn get_ipv6_multicast_hops<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
@@ -520,6 +1326,18 @@ pub fn get_ipv6_multicast_hops<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
/// - [Linux `ip`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_IP` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -527,6 +1345,18 @@ pub fn get_ipv6_multicast_hops<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
/// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip`]: https://man.netbsd.org/ip.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip`]: https://illumos.org/man/4P/ip
#[inline]
#[doc(alias = "IP_ADD_MEMBERSHIP")]
pub fn set_ip_add_membership<Fd: AsFd>(
@@ -545,9 +1375,21 @@ pub fn set_ip_add_membership<Fd: AsFd>(
/// - [POSIX `setsockopt`]
/// - [POSIX `netinet/in.h`]
/// - [Linux `setsockopt`]
-/// - [Linux `ipv6]
+/// - [Linux `ipv6`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip6`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip6`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip6`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip6`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip6`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip6`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -555,6 +1397,18 @@ pub fn set_ip_add_membership<Fd: AsFd>(
/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip6`]: https://illumos.org/man/4P/ip6
#[inline]
#[doc(alias = "IPV6_JOIN_GROUP")]
#[doc(alias = "IPV6_ADD_MEMBERSHIP")]
@@ -575,6 +1429,18 @@ pub fn set_ipv6_add_membership<Fd: AsFd>(
/// - [Linux `ip`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_IP` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -582,6 +1448,18 @@ pub fn set_ipv6_add_membership<Fd: AsFd>(
/// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip`]: https://man.netbsd.org/ip.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip`]: https://illumos.org/man/4P/ip
#[inline]
#[doc(alias = "IP_DROP_MEMBERSHIP")]
pub fn set_ip_drop_membership<Fd: AsFd>(
@@ -603,6 +1481,18 @@ pub fn set_ip_drop_membership<Fd: AsFd>(
/// - [Linux `ipv6`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_IPV6` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `ip6`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `ip6`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `ip6`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `ip6`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `ip6`]
+/// - [illumos `setsockopt`]
+/// - [illumos `ip6`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
@@ -610,6 +1500,18 @@ pub fn set_ip_drop_membership<Fd: AsFd>(
/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `ip6`]: https://illumos.org/man/4P/ip6
#[inline]
#[doc(alias = "IPV6_LEAVE_GROUP")]
#[doc(alias = "IPV6_DROP_MEMBERSHIP")]
@@ -630,6 +1532,18 @@ pub fn set_ipv6_drop_membership<Fd: AsFd>(
/// - [Linux `tcp`]
/// - [Winsock2 `setsockopt`]
/// - [Winsock2 `IPPROTO_TCP` options]
+/// - [Apple `setsockopt`]
+/// - [Apple `tcp`]
+/// - [FreeBSD `setsockopt`]
+/// - [FreeBSD `tcp`]
+/// - [NetBSD `setsockopt`]
+/// - [NetBSD `tcp`]
+/// - [OpenBSD `setsockopt`]
+/// - [OpenBSD `tcp`]
+/// - [DragonFly BSD `setsockopt`]
+/// - [DragonFly BSD `tcp`]
+/// - [illumos `setsockopt`]
+/// - [illumos `tcp`]
///
/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
@@ -637,6 +1551,18 @@ pub fn set_ipv6_drop_membership<Fd: AsFd>(
/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
+/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html
+/// [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html
+/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2
+/// [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4
+/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2
+/// [NetBSD `tcp`]: https://man.netbsd.org/tcp.4
+/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2
+/// [OpenBSD `tcp`]: https://man.openbsd.org/tcp.4
+/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt&section=2
+/// [DragonFly BSD `tcp`]: https://man.dragonflybsd.org/?command=tcp&section=4
+/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt
+/// [illumos `tcp`]: https://illumos.org/man/4P/tcp
#[inline]
#[doc(alias = "TCP_NODELAY")]
pub fn set_tcp_nodelay<Fd: AsFd>(fd: Fd, nodelay: bool) -> io::Result<()> {
@@ -652,61 +1578,39 @@ pub fn set_tcp_nodelay<Fd: AsFd>(fd: Fd, nodelay: bool) -> io::Result<()> {
/// - [Linux `tcp`]
/// - [Winsock2 `getsockopt`]
/// - [Winsock2 `IPPROTO_TCP` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `tcp`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `tcp`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `tcp`]
+/// - [OpenBSD `getsockopt`]
+/// - [OpenBSD `tcp`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `tcp`]
+/// - [illumos `getsockopt`]
+/// - [illumos `tcp`]
///
/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
-/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `tcp`]: https://man.netbsd.org/tcp.4
+/// [OpenBSD `getsockopt`]: https://man.openbsd.org/getsockopt.2
+/// [OpenBSD `tcp`]: https://man.openbsd.org/tcp.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `tcp`]: https://man.dragonflybsd.org/?command=tcp&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `tcp`]: https://illumos.org/man/4P/tcp
#[inline]
#[doc(alias = "TCP_NODELAY")]
pub fn get_tcp_nodelay<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
backend::net::syscalls::sockopt::get_tcp_nodelay(fd.as_fd())
}
-
-/// `getsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE)`
-///
-/// # References
-/// - [POSIX `getsockopt`]
-/// - [POSIX `netinet/tcp.h`]
-/// - [Linux `getsockopt`]
-/// - [Linux `tcp`]
-/// - [Winsock2 `getsockopt`]
-/// - [Winsock2 `IPPROTO_TCP` options]
-///
-/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
-/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
-/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
-/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
-/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
-/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
-#[cfg(any(apple, target_os = "freebsd"))]
-#[doc(alias = "SO_NOSIGPIPE")]
-#[inline]
-pub fn getsockopt_nosigpipe<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
- backend::net::syscalls::sockopt::getsockopt_nosigpipe(fd.as_fd())
-}
-
-/// `setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, val)`
-///
-/// # References
-/// - [POSIX `getsockopt`]
-/// - [POSIX `netinet/tcp.h`]
-/// - [Linux `getsockopt`]
-/// - [Linux `tcp`]
-/// - [Winsock2 `getsockopt`]
-/// - [Winsock2 `IPPROTO_TCP` options]
-///
-/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
-/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
-/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
-/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
-/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
-/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
-#[cfg(any(apple, target_os = "freebsd"))]
-#[doc(alias = "SO_NOSIGPIPE")]
-#[inline]
-pub fn setsockopt_nosigpipe<Fd: AsFd>(fd: Fd, val: bool) -> io::Result<()> {
- backend::net::syscalls::sockopt::setsockopt_nosigpipe(fd.as_fd(), val)
-}
diff --git a/vendor/rustix/src/path/arg.rs b/vendor/rustix/src/path/arg.rs
index 3d976ce3e..b6b2a8a73 100644
--- a/vendor/rustix/src/path/arg.rs
+++ b/vendor/rustix/src/path/arg.rs
@@ -957,8 +957,8 @@ where
// This helps test our safety condition below.
debug_assert!(bytes.len() + 1 <= SMALL_PATH_BUFFER_SIZE);
- // SAFETY: bytes.len() < SMALL_PATH_BUFFER_SIZE which means we have space for
- // bytes.len() + 1 u8s:
+ // SAFETY: `bytes.len() < SMALL_PATH_BUFFER_SIZE` which means we have space for
+ // `bytes.len() + 1` u8s:
unsafe {
ptr::copy_nonoverlapping(bytes.as_ptr(), buf_ptr, bytes.len());
buf_ptr.add(bytes.len()).write(0);
diff --git a/vendor/rustix/src/process/chroot.rs b/vendor/rustix/src/process/chroot.rs
new file mode 100644
index 000000000..d68a8b081
--- /dev/null
+++ b/vendor/rustix/src/process/chroot.rs
@@ -0,0 +1,12 @@
+use crate::{backend, io, path};
+
+/// `chroot(path)`—Change the process root directory.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/chroot.2.html
+#[inline]
+pub fn chroot<P: path::Arg>(path: P) -> io::Result<()> {
+ path.into_with_c_str(backend::process::syscalls::chroot)
+}
diff --git a/vendor/rustix/src/process/exit.rs b/vendor/rustix/src/process/exit.rs
index 56db99b4f..2bbbcf538 100644
--- a/vendor/rustix/src/process/exit.rs
+++ b/vendor/rustix/src/process/exit.rs
@@ -24,11 +24,13 @@ pub const EXIT_SUCCESS: i32 = backend::process::types::EXIT_SUCCESS;
/// [Linux]: https://man7.org/linux/man-pages/man3/exit.3.html
pub const EXIT_FAILURE: i32 = backend::process::types::EXIT_FAILURE;
-/// The exit status used by a process terminated with `SIGABRT` signal.
+/// The exit status used by a process terminated with a [`Signal::Abort`]
+/// signal.
///
/// # References
/// - [Linux]
///
/// [Linux]: https://tldp.org/LDP/abs/html/exitcodes.html
+/// [`Signal::Abort`]: crate::process::Signal::Abort
#[cfg(not(target_os = "wasi"))]
pub const EXIT_SIGNALED_SIGABRT: i32 = backend::process::types::EXIT_SIGNALED_SIGABRT;
diff --git a/vendor/rustix/src/process/id.rs b/vendor/rustix/src/process/id.rs
index 04f1b879c..687596a31 100644
--- a/vendor/rustix/src/process/id.rs
+++ b/vendor/rustix/src/process/id.rs
@@ -8,6 +8,7 @@
#![allow(unsafe_code)]
use crate::{backend, io};
+use alloc::vec::Vec;
#[cfg(any(target_os = "android", target_os = "linux"))]
use backend::process::types::RawCpuid;
@@ -280,6 +281,19 @@ pub fn getpgid(pid: Option<Pid>) -> io::Result<Pid> {
backend::process::syscalls::getpgid(pid)
}
+/// `setpgid(pid, pgid)`—Sets the process group ID of the given process.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setpgid.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/setpgid.2.html
+#[inline]
+pub fn setpgid(pid: Option<Pid>, pgid: Option<Pid>) -> io::Result<()> {
+ backend::process::syscalls::setpgid(pid, pgid)
+}
+
/// `getpgrp()`—Returns the process' group ID.
///
/// # References
@@ -294,6 +308,20 @@ pub fn getpgrp() -> Pid {
backend::process::syscalls::getpgrp()
}
+/// `getsid(pid)`—Get the session ID of the given process.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsid.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/getsid.2.html
+#[cfg(not(target_os = "redox"))]
+#[inline]
+pub fn getsid(pid: Option<Pid>) -> io::Result<Pid> {
+ backend::process::syscalls::getsid(pid)
+}
+
/// `setsid()`—Create a new session.
///
/// # References
@@ -307,9 +335,39 @@ pub fn setsid() -> io::Result<Pid> {
backend::process::syscalls::setsid()
}
-// translate_fchown_args returns the raw value of the IDs. In case of `None`
-// it returns `u32::MAX` since it has the same bit pattern as `-1` indicating
-// no change to the owner/group ID.
+/// `getgroups()`—Return a list of the current user's groups.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getgroups.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/getgroups.2.html
+pub fn getgroups() -> io::Result<Vec<Gid>> {
+ let mut buffer = Vec::new();
+
+ // This code would benefit from having a better way to read into
+ // uninitialized memory, but that requires `unsafe`.
+ buffer.reserve(8);
+ buffer.resize(buffer.capacity(), Gid::ROOT);
+
+ loop {
+ let ngroups = backend::process::syscalls::getgroups(&mut buffer)?;
+
+ let ngroups = ngroups as usize;
+ assert!(ngroups <= buffer.len());
+ if ngroups < buffer.len() {
+ buffer.resize(ngroups, Gid::ROOT);
+ return Ok(buffer);
+ }
+ buffer.reserve(1); // use `Vec` reallocation strategy to grow capacity exponentially
+ buffer.resize(buffer.capacity(), Gid::ROOT);
+ }
+}
+
+// Return the raw value of the IDs. In case of `None` it returns `u32::MAX`
+// since it has the same bit pattern as `-1` indicating no change to the
+// owner/group ID.
pub(crate) fn translate_fchown_args(owner: Option<Uid>, group: Option<Gid>) -> (u32, u32) {
let ow = match owner {
Some(o) => o.as_raw(),
diff --git a/vendor/rustix/src/process/kill.rs b/vendor/rustix/src/process/kill.rs
index 69cfba261..807cc1028 100644
--- a/vendor/rustix/src/process/kill.rs
+++ b/vendor/rustix/src/process/kill.rs
@@ -49,3 +49,49 @@ pub fn kill_process_group(pid: Pid, sig: Signal) -> io::Result<()> {
pub fn kill_current_process_group(sig: Signal) -> io::Result<()> {
backend::process::syscalls::kill_current_process_group(sig)
}
+
+/// `kill(pid, 0)`—Check validity of pid and permissions to send signals to
+/// the process, without actually sending any signals.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/kill.2.html
+#[inline]
+#[doc(alias = "kill")]
+pub fn test_kill_process(pid: Pid) -> io::Result<()> {
+ backend::process::syscalls::test_kill_process(pid)
+}
+
+/// `kill(-pid, 0)`—Check validity of pid and permissions to send signals to
+/// all processes in the process group, without actually sending any signals.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/kill.2.html
+#[inline]
+#[doc(alias = "kill")]
+pub fn test_kill_process_group(pid: Pid) -> io::Result<()> {
+ backend::process::syscalls::test_kill_process_group(pid)
+}
+
+/// `kill(0, 0)`—Check validity of pid and permissions to send signals to the
+/// all processes in the current process group, without actually sending any
+/// signals.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/kill.2.html
+#[inline]
+#[doc(alias = "kill")]
+pub fn test_kill_current_process_group() -> io::Result<()> {
+ backend::process::syscalls::test_kill_current_process_group()
+}
diff --git a/vendor/rustix/src/process/mod.rs b/vendor/rustix/src/process/mod.rs
index 3ae976439..0002c0f46 100644
--- a/vendor/rustix/src/process/mod.rs
+++ b/vendor/rustix/src/process/mod.rs
@@ -2,6 +2,8 @@
#[cfg(not(target_os = "wasi"))]
mod chdir;
+#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
+mod chroot;
mod exit;
#[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id.
mod id;
@@ -27,15 +29,17 @@ mod rlimit;
))]
mod sched;
mod sched_yield;
+#[cfg(not(target_os = "wasi"))] // WASI doesn't have uname.
+mod system;
#[cfg(not(target_os = "wasi"))] // WASI doesn't have umask.
mod umask;
-#[cfg(not(target_os = "wasi"))] // WASI doesn't have uname.
-mod uname;
#[cfg(not(target_os = "wasi"))]
mod wait;
#[cfg(not(target_os = "wasi"))]
pub use chdir::*;
+#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
+pub use chroot::*;
pub use exit::*;
#[cfg(not(target_os = "wasi"))]
pub use id::*;
@@ -62,9 +66,9 @@ pub use rlimit::*;
pub use sched::*;
pub use sched_yield::sched_yield;
#[cfg(not(target_os = "wasi"))]
-pub use umask::*;
+pub use system::*;
#[cfg(not(target_os = "wasi"))]
-pub use uname::{uname, Uname};
+pub use umask::*;
#[cfg(not(target_os = "wasi"))]
pub use wait::*;
diff --git a/vendor/rustix/src/process/prctl.rs b/vendor/rustix/src/process/prctl.rs
index 34eef7aa4..a4e1e546c 100644
--- a/vendor/rustix/src/process/prctl.rs
+++ b/vendor/rustix/src/process/prctl.rs
@@ -76,7 +76,7 @@ const PR_GET_PDEATHSIG: c_int = 2;
/// - [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]
///
/// [Linux: `prctl(PR_GET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
-/// [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn parent_process_death_signal() -> io::Result<Option<Signal>> {
unsafe { prctl_get_at_arg2_optional::<c_int>(PR_GET_PDEATHSIG) }.map(Signal::from_raw)
@@ -91,7 +91,7 @@ const PR_SET_PDEATHSIG: c_int = 1;
/// - [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]
///
/// [Linux: `prctl(PR_SET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
-/// [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn set_parent_process_death_signal(signal: Option<Signal>) -> io::Result<()> {
let signal = signal.map_or(0_usize, |signal| signal as usize);
@@ -175,7 +175,7 @@ bitflags! {
pub struct UnalignedAccessControl: u32 {
/// Silently fix up unaligned user accesses.
const NO_PRINT = 1;
- /// Generate `SIGBUS` on unaligned user access.
+ /// Generate a [`Signal::Bus`] signal on unaligned user access.
const SIGBUS = 2;
}
}
@@ -216,7 +216,8 @@ bitflags! {
pub struct FloatingPointEmulationControl: u32 {
/// Silently emulate floating point operations accesses.
const NO_PRINT = 1;
- /// Don't emulate floating point operations, send `SIGFPE` instead.
+ /// Don't emulate floating point operations, send a [`Signal::Fpe`]
+ /// signal instead.
const SIGFPE = 2;
}
}
@@ -442,7 +443,7 @@ const PR_TSC_SIGSEGV: u32 = 2;
pub enum TimeStampCounterReadability {
/// Allow the use of the timestamp counter.
Readable = PR_TSC_ENABLE,
- /// Throw a `SIGSEGV` instead of reading the TSC.
+ /// Throw a [`Signal::Segv`] signal instead of reading the TSC.
RaiseSIGSEGV = PR_TSC_SIGSEGV,
}
@@ -721,9 +722,9 @@ pub struct PrctlMmMap {
pub start_data: u64,
/// Data section end address.
pub end_data: u64,
- /// brk() start address.
+ /// `brk` start address.
pub start_brk: u64,
- /// brk() current address.
+ /// `brk` current address.
pub brk: u64,
/// Stack start address.
pub start_stack: u64,
diff --git a/vendor/rustix/src/process/procctl.rs b/vendor/rustix/src/process/procctl.rs
index 9e2b3c6e6..443aa90a4 100644
--- a/vendor/rustix/src/process/procctl.rs
+++ b/vendor/rustix/src/process/procctl.rs
@@ -85,7 +85,7 @@ const PROC_PDEATHSIG_STATUS: c_int = 12;
/// - [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]
///
/// [Linux: `prctl(PR_GET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
-/// [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn parent_process_death_signal() -> io::Result<Option<Signal>> {
unsafe { procctl_get_optional::<c_int>(PROC_PDEATHSIG_STATUS, None) }.map(Signal::from_raw)
@@ -100,7 +100,7 @@ const PROC_PDEATHSIG_CTL: c_int = 11;
/// - [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]
///
/// [Linux: `prctl(PR_SET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
-/// [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn set_parent_process_death_signal(signal: Option<Signal>) -> io::Result<()> {
let signal = signal.map_or(0, |signal| signal as c_int);
@@ -140,9 +140,9 @@ pub enum DumpableBehavior {
/// Linux.
///
/// # References
-/// - [`procctl(PROC_TRACE_CTL,...)`]
+/// - [FreeBSD `procctl(PROC_TRACE_CTL,...)`]
///
-/// [`procctl(PROC_TRACE_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD `procctl(PROC_TRACE_CTL,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn set_dumpable_behavior(process: ProcSelector, config: DumpableBehavior) -> io::Result<()> {
unsafe { procctl(PROC_TRACE_CTL, process, config as usize as *mut _) }
@@ -170,9 +170,9 @@ pub enum TracingStatus {
/// Get the tracing status of the process indicated by `idtype` and `id`.
///
/// # References
-/// - [`procctl(PROC_TRACE_STATUS,...)`]
+/// - [FreeBSD `procctl(PROC_TRACE_STATUS,...)`]
///
-/// [`procctl(PROC_TRACE_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD `procctl(PROC_TRACE_STATUS,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn trace_status(process: ProcSelector) -> io::Result<TracingStatus> {
let val = unsafe { procctl_get_optional::<c_int>(PROC_TRACE_STATUS, process) }?;
@@ -198,7 +198,7 @@ const PROC_REAP_RELEASE: c_int = 3;
/// # References
/// - [FreeBSD: `procctl(PROC_REAP_ACQUIRE/RELEASE,...)`]
///
-/// [FreeBSD: `procctl(PROC_REAP_ACQUIRE/RELEASE,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_REAP_ACQUIRE/RELEASE,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn set_reaper_status(reaper: bool) -> io::Result<()> {
unsafe {
@@ -258,7 +258,7 @@ pub struct ReaperStatus {
/// # References
/// - [FreeBSD: `procctl(PROC_REAP_STATUS,...)`]
///
-/// [FreeBSD: `procctl(PROC_REAP_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_REAP_STATUS,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn get_reaper_status(process: ProcSelector) -> io::Result<ReaperStatus> {
let raw = unsafe { procctl_get_optional::<procctl_reaper_status>(PROC_REAP_STATUS, process) }?;
@@ -282,6 +282,12 @@ bitflags! {
const CHILD = 2;
/// The reported process is itself a reaper. Descendants of a subordinate reaper are not reported.
const REAPER = 4;
+ /// The reported process is in the zombie state.
+ const ZOMBIE = 8;
+ /// The reported process is stopped by SIGSTOP/SIGTSTP.
+ const STOPPED = 16;
+ /// The reported process is in the process of exiting.
+ const EXITING = 32;
}
}
@@ -318,7 +324,7 @@ pub struct PidInfo {
/// # References
/// - [FreeBSD: `procctl(PROC_REAP_GETPIDS,...)`]
///
-/// [FreeBSD: `procctl(PROC_REAP_GETPIDS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_REAP_GETPIDS,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
pub fn get_reaper_pids(process: ProcSelector) -> io::Result<Vec<PidInfo>> {
// Sadly no better way to guarantee that we get all the results than to
// allocate ~8MB of memory..
@@ -385,7 +391,7 @@ pub struct KillResult {
/// # References
/// - [FreeBSD: `procctl(PROC_REAP_KILL,...)`]
///
-/// [FreeBSD: `procctl(PROC_REAP_KILL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_REAP_KILL,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
pub fn reaper_kill(
process: ProcSelector,
signal: Signal,
@@ -433,18 +439,18 @@ const PROC_TRAPCAP_CTL_DISABLE: i32 = 2;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(i32)]
pub enum TrapCapBehavior {
- /// Disable the SIGTRAP signal delivery on capability mode access
+ /// Disable the [`Signal::Trap`] signal delivery on capability mode access
/// violations.
Disable = PROC_TRAPCAP_CTL_DISABLE,
- /// Enable the SIGTRAP signal delivery on capability mode access
+ /// Enable the [`Signal::Trap`] signal delivery on capability mode access
/// violations.
Enable = PROC_TRAPCAP_CTL_ENABLE,
}
/// Set the current value of the capability mode violation trapping behavior.
-/// If this behavior is enabled, the kernel would deliver a SIGTRAP signal on
-/// any return from a system call that would result in a `ENOTCAPABLE` or
-/// `ECAPMODE` error.
+/// If this behavior is enabled, the kernel would deliver a [`Signal::Trap`]
+/// signal on any return from a system call that would result in a
+/// [`io::Errno::NOTCAPABLE`]` or [`io::Errno::CAPMODE`] error.
///
/// This behavior is inherited by the children of the process and is kept
/// across `execve` calls.
@@ -452,7 +458,7 @@ pub enum TrapCapBehavior {
/// # References
/// - [FreeBSD: `procctl(PROC_TRAPCAP_CTL,...)`]
///
-/// [FreeBSD: `procctl(PROC_TRAPCAP_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_TRAPCAP_CTL,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn set_trap_cap_behavior(process: ProcSelector, config: TrapCapBehavior) -> io::Result<()> {
let config = config as c_int;
@@ -466,7 +472,7 @@ const PROC_TRAPCAP_STATUS: c_int = 10;
/// # References
/// - [FreeBSD: `procctl(PROC_TRAPCAP_STATUS,...)`]
///
-/// [FreeBSD: `procctl(PROC_TRAPCAP_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_TRAPCAP_STATUS,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn trap_cap_behavior(process: ProcSelector) -> io::Result<TrapCapBehavior> {
let val = unsafe { procctl_get_optional::<c_int>(PROC_TRAPCAP_STATUS, process) }?;
@@ -497,7 +503,7 @@ const PROC_NO_NEW_PRIVS_ENABLE: c_int = 1;
/// - [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_CTL,...)`]
///
/// [Linux: `prctl(PR_SET_NO_NEW_PRIVS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
-/// [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_CTL,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn set_no_new_privs(process: ProcSelector) -> io::Result<()> {
unsafe { procctl_set::<c_int>(PROC_NO_NEW_PRIVS_CTL, process, &PROC_NO_NEW_PRIVS_ENABLE) }
@@ -512,7 +518,7 @@ const PROC_NO_NEW_PRIVS_STATUS: c_int = 20;
/// - [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_STATUS,...)`]
///
/// [Linux: `prctl(PR_GET_NO_NEW_PRIVS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
-/// [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+/// [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_STATUS,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
pub fn no_new_privs(process: ProcSelector) -> io::Result<bool> {
unsafe { procctl_get_optional::<c_int>(PROC_NO_NEW_PRIVS_STATUS, process) }
diff --git a/vendor/rustix/src/process/uname.rs b/vendor/rustix/src/process/system.rs
index 904532a99..cf9a312fc 100644
--- a/vendor/rustix/src/process/uname.rs
+++ b/vendor/rustix/src/process/system.rs
@@ -1,4 +1,4 @@
-//! Uname support.
+//! Uname and other system-level functions.
//!
//! # Safety
//!
@@ -8,10 +8,22 @@
use crate::backend;
use crate::ffi::CStr;
+#[cfg(not(target_os = "emscripten"))]
+use crate::io;
use core::fmt;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub use backend::process::types::Sysinfo;
+
/// `uname()`—Returns high-level information about the runtime OS and
/// hardware.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/uname.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/uname.2.html
#[inline]
pub fn uname() -> Uname {
Uname(backend::process::syscalls::uname())
@@ -99,3 +111,27 @@ impl fmt::Debug for Uname {
}
}
}
+
+/// `sysinfo()`—Returns status information about the runtime OS.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/uname.2.html
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub fn sysinfo() -> Sysinfo {
+ backend::process::syscalls::sysinfo()
+}
+
+/// `sethostname(name)—Sets the system host name.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/sethostname.2.html
+#[cfg(not(any(target_os = "emscripten", target_os = "redox", target_os = "wasi")))]
+#[inline]
+pub fn sethostname(name: &[u8]) -> io::Result<()> {
+ backend::process::syscalls::sethostname(name)
+}
diff --git a/vendor/rustix/src/process/wait.rs b/vendor/rustix/src/process/wait.rs
index 784e6627c..ea2691ae1 100644
--- a/vendor/rustix/src/process/wait.rs
+++ b/vendor/rustix/src/process/wait.rs
@@ -5,14 +5,20 @@ use bitflags::bitflags;
#[cfg(target_os = "linux")]
use crate::fd::BorrowedFd;
+#[cfg(linux_raw)]
+use crate::backend::process::wait::SiginfoExt;
+
bitflags! {
/// Options for modifying the behavior of wait/waitpid
pub struct WaitOptions: u32 {
/// Return immediately if no child has exited.
const NOHANG = backend::process::wait::WNOHANG as _;
- /// Return if a child has stopped (but not traced via `ptrace(2)`)
+ /// Return if a child has stopped (but not traced via [`ptrace`])
+ ///
+ /// [`ptrace`]: https://man7.org/linux/man-pages/man2/ptrace.2.html
const UNTRACED = backend::process::wait::WUNTRACED as _;
- /// Return if a stopped child has been resumed by delivery of `SIGCONT`
+ /// Return if a stopped child has been resumed by delivery of
+ /// [`Signal::Cont`].
const CONTINUED = backend::process::wait::WCONTINUED as _;
}
}
@@ -23,7 +29,8 @@ bitflags! {
pub struct WaitidOptions: u32 {
/// Return immediately if no child has exited.
const NOHANG = backend::process::wait::WNOHANG as _;
- /// Return if a stopped child has been resumed by delivery of `SIGCONT`
+ /// Return if a stopped child has been resumed by delivery of
+ /// [`Signal::Cont`]
const CONTINUED = backend::process::wait::WCONTINUED as _;
/// Wait for processed that have exited.
const EXITED = backend::process::wait::WEXITED as _;
@@ -34,12 +41,13 @@ bitflags! {
}
}
-/// the status of the child processes the caller waited on
+/// The status of a child process after calling [`wait`]/[`waitpid`].
#[derive(Debug, Clone, Copy)]
+#[repr(transparent)]
pub struct WaitStatus(u32);
impl WaitStatus {
- /// create a `WaitStatus` out of an integer.
+ /// Creates a `WaitStatus` out of an integer.
#[inline]
pub(crate) fn new(status: u32) -> Self {
Self(status)
@@ -57,6 +65,18 @@ impl WaitStatus {
backend::process::wait::WIFSTOPPED(self.0 as _)
}
+ /// Returns whether the process has exited normally.
+ #[inline]
+ pub fn exited(self) -> bool {
+ backend::process::wait::WIFEXITED(self.0 as _)
+ }
+
+ /// Returns whether the process was terminated by a signal.
+ #[inline]
+ pub fn signaled(self) -> bool {
+ backend::process::wait::WIFSIGNALED(self.0 as _)
+ }
+
/// Returns whether the process has continued from a job control stop.
#[inline]
pub fn continued(self) -> bool {
@@ -78,7 +98,7 @@ impl WaitStatus {
/// if it exited normally.
#[inline]
pub fn exit_status(self) -> Option<u32> {
- if backend::process::wait::WIFEXITED(self.0 as _) {
+ if self.exited() {
Some(backend::process::wait::WEXITSTATUS(self.0 as _) as _)
} else {
None
@@ -89,7 +109,7 @@ impl WaitStatus {
/// if the process was terminated by a signal.
#[inline]
pub fn terminating_signal(self) -> Option<u32> {
- if backend::process::wait::WIFSIGNALED(self.0 as _) {
+ if self.signaled() {
Some(backend::process::wait::WTERMSIG(self.0 as _) as _)
} else {
None
@@ -99,9 +119,125 @@ impl WaitStatus {
/// The status of a process after calling [`waitid`].
#[derive(Clone, Copy)]
+#[repr(transparent)]
#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
pub struct WaitidStatus(pub(crate) backend::c::siginfo_t);
+#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+impl WaitidStatus {
+ /// Returns whether the process is currently stopped.
+ #[inline]
+ pub fn stopped(&self) -> bool {
+ self.si_code() == backend::c::CLD_STOPPED
+ }
+
+ /// Returns whether the process is currently trapped.
+ #[inline]
+ pub fn trapped(&self) -> bool {
+ self.si_code() == backend::c::CLD_TRAPPED
+ }
+
+ /// Returns whether the process has exited normally.
+ #[inline]
+ pub fn exited(&self) -> bool {
+ self.si_code() == backend::c::CLD_EXITED
+ }
+
+ /// Returns whether the process was terminated by a signal
+ /// and did not create a core file.
+ #[inline]
+ pub fn killed(&self) -> bool {
+ self.si_code() == backend::c::CLD_KILLED
+ }
+
+ /// Returns whether the process was terminated by a signal
+ /// and did create a core file.
+ #[inline]
+ pub fn dumped(&self) -> bool {
+ self.si_code() == backend::c::CLD_DUMPED
+ }
+
+ /// Returns whether the process has continued from a job control stop.
+ #[inline]
+ pub fn continued(&self) -> bool {
+ self.si_code() == backend::c::CLD_CONTINUED
+ }
+
+ /// Returns the number of the signal that stopped the process,
+ /// if the process was stopped by a signal.
+ #[inline]
+ #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))]
+ pub fn stopping_signal(&self) -> Option<u32> {
+ if self.stopped() {
+ Some(self.si_status() as _)
+ } else {
+ None
+ }
+ }
+
+ /// Returns the number of the signal that trapped the process,
+ /// if the process was trapped by a signal.
+ #[inline]
+ #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))]
+ pub fn trapping_signal(&self) -> Option<u32> {
+ if self.trapped() {
+ Some(self.si_status() as _)
+ } else {
+ None
+ }
+ }
+
+ /// Returns the exit status number returned by the process,
+ /// if it exited normally.
+ #[inline]
+ #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))]
+ pub fn exit_status(&self) -> Option<u32> {
+ if self.exited() {
+ Some(self.si_status() as _)
+ } else {
+ None
+ }
+ }
+
+ /// Returns the number of the signal that terminated the process,
+ /// if the process was terminated by a signal.
+ #[inline]
+ #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))]
+ pub fn terminating_signal(&self) -> Option<u32> {
+ if self.killed() || self.dumped() {
+ Some(self.si_status() as _)
+ } else {
+ None
+ }
+ }
+
+ /// Returns a reference to the raw platform-specific `siginfo_t` struct.
+ #[inline]
+ pub const fn as_raw(&self) -> &backend::c::siginfo_t {
+ &self.0
+ }
+
+ #[cfg(linux_raw)]
+ fn si_code(&self) -> u32 {
+ self.0.si_code() as u32 // CLD_ consts are unsigned
+ }
+
+ #[cfg(not(linux_raw))]
+ fn si_code(&self) -> backend::c::c_int {
+ self.0.si_code
+ }
+
+ #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))]
+ #[allow(unsafe_code)]
+ fn si_status(&self) -> backend::c::c_int {
+ // SAFETY: POSIX [specifies] that the `siginfo_t` returned by a `waitid`
+ // call always has a valid `si_status` value.
+ //
+ // [specifies]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html
+ unsafe { self.0.si_status() }
+ }
+}
+
/// The identifier to wait on in a call to [`waitid`].
#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
#[derive(Debug, Clone)]
diff --git a/vendor/rustix/src/rand/getrandom.rs b/vendor/rustix/src/rand/getrandom.rs
index 83043800d..79d5319d5 100644
--- a/vendor/rustix/src/rand/getrandom.rs
+++ b/vendor/rustix/src/rand/getrandom.rs
@@ -1,6 +1,6 @@
use crate::{backend, io};
-/// `GRND_*`
+/// `GRND_*` constants for use with `getrandom`.
pub use backend::rand::types::GetRandomFlags;
/// `getrandom(buf, flags)`—Reads a sequence of random bytes.
diff --git a/vendor/rustix/src/runtime.rs b/vendor/rustix/src/runtime.rs
index af3c98ff9..587ad1e2a 100644
--- a/vendor/rustix/src/runtime.rs
+++ b/vendor/rustix/src/runtime.rs
@@ -28,13 +28,45 @@ use crate::fs::AtFlags;
#[cfg(linux_raw)]
use crate::io;
#[cfg(linux_raw)]
-use crate::process::Pid;
+use crate::process::{Pid, Signal};
#[cfg(linux_raw)]
#[cfg(feature = "fs")]
use backend::fd::AsFd;
#[cfg(linux_raw)]
use core::ffi::c_void;
+/// `sigaction`
+#[cfg(linux_raw)]
+pub type Sigaction = linux_raw_sys::general::kernel_sigaction;
+
+/// `stack_t`
+#[cfg(linux_raw)]
+pub type Stack = linux_raw_sys::general::stack_t;
+
+/// `sigset_t`
+#[cfg(linux_raw)]
+pub type Sigset = linux_raw_sys::general::kernel_sigset_t;
+
+/// `siginfo_t`
+#[cfg(linux_raw)]
+pub type Siginfo = linux_raw_sys::general::siginfo_t;
+
+pub use backend::time::types::{Nsecs, Secs, Timespec};
+
+/// `SIG_*` constants for use with [`sigprocmask`].
+#[cfg(linux_raw)]
+#[repr(u32)]
+pub enum How {
+ /// `SIG_BLOCK`
+ BLOCK = linux_raw_sys::general::SIG_BLOCK,
+
+ /// `SIG_UNBLOCK`
+ UNBLOCK = linux_raw_sys::general::SIG_UNBLOCK,
+
+ /// `SIG_SETMASK`
+ SETMASK = linux_raw_sys::general::SIG_SETMASK,
+}
+
#[cfg(linux_raw)]
#[cfg(target_arch = "x86")]
#[inline]
@@ -109,7 +141,7 @@ pub unsafe fn exit_thread(status: i32) -> ! {
///
/// [POSIX `_Exit`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/_Exit.html
/// [Linux `exit_group`]: https://man7.org/linux/man-pages/man2/exit_group.2.html
-/// [Linux `_Exit`]: https://man7.org/linux/man-pages/man2/exit.2.html
+/// [Linux `_Exit`]: https://man7.org/linux/man-pages/man2/_Exit.2.html
#[doc(alias = "_exit")]
#[doc(alias = "_Exit")]
#[inline]
@@ -211,7 +243,7 @@ pub use backend::runtime::tls::StartupTlsInfo;
/// > It is better you
/// > Do not.
///
-/// - "Rules", by Karla Kuskin
+/// - “Rules”, by Karla Kuskin
///
/// [`MAP_SHARED`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html
/// [not considered unsafe]: https://doc.rust-lang.org/reference/behavior-not-considered-unsafe.html#deadlocks
@@ -267,3 +299,114 @@ pub unsafe fn execveat<Fd: AsFd>(
pub unsafe fn execve(path: &CStr, argv: *const *const u8, envp: *const *const u8) -> io::Errno {
backend::runtime::syscalls::execve(path, argv, envp)
}
+
+/// `sigaction(signal, &new, &old)`—Modify or query a signal handler.
+///
+/// # Safety
+///
+/// You're on your own. And on top of all the troubles with signal handlers,
+/// this implementation is highly experimental.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/sigaction.2.html
+#[cfg(linux_raw)]
+#[inline]
+pub unsafe fn sigaction(signal: Signal, new: Option<Sigaction>) -> io::Result<Sigaction> {
+ backend::runtime::syscalls::sigaction(signal, new)
+}
+
+/// `sigaltstack(new, old)`—Modify or query a signal stack.
+///
+/// # Safety
+///
+/// You're on your own. And on top of all the troubles with signal handlers,
+/// this implementation is highly experimental.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaltstack.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/sigaltstack.2.html
+#[cfg(linux_raw)]
+#[inline]
+pub unsafe fn sigaltstack(new: Option<Stack>) -> io::Result<Stack> {
+ backend::runtime::syscalls::sigaltstack(new)
+}
+
+/// `tkill(tid, sig)`—Send a signal to a thread.
+///
+/// # Safety
+///
+/// You're on your own. And on top of all the troubles with signal handlers,
+/// this implementation is highly experimental.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/tkill.2.html
+#[cfg(linux_raw)]
+#[inline]
+pub unsafe fn tkill(tid: Pid, sig: Signal) -> io::Result<()> {
+ backend::runtime::syscalls::tkill(tid, sig)
+}
+
+/// `sigprocmask(how, set, oldset)`—Adjust the process signal mask.
+///
+/// # Safety
+///
+/// You're on your own. And on top of all the troubles with signal handlers,
+/// this implementation is highly experimental.
+///
+/// # References
+/// - [Linux `sigprocmask`]
+/// - [Linux `pthread_sigmask`]
+///
+/// [Linux `sigprocmask`]: https://man7.org/linux/man-pages/man2/sigprocmask.2.html
+/// [Linux `pthread_sigmask`]: https://man7.org/linux/man-pages/man3/pthread_sigmask.3.html
+#[cfg(linux_raw)]
+#[inline]
+#[doc(alias = "pthread_sigmask")]
+pub unsafe fn sigprocmask(how: How, set: &Sigset) -> io::Result<Sigset> {
+ backend::runtime::syscalls::sigprocmask(how, set)
+}
+
+/// `sigwait(set)`—Wait for signals.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man3/sigwait.3.html
+#[cfg(linux_raw)]
+#[inline]
+pub fn sigwait(set: &Sigset) -> io::Result<Signal> {
+ backend::runtime::syscalls::sigwait(set)
+}
+
+/// `sigwait(set)`—Wait for signals, returning a [`Siginfo`].
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/sigwaitinfo.2.html
+#[cfg(linux_raw)]
+#[inline]
+pub fn sigwaitinfo(set: &Sigset) -> io::Result<Siginfo> {
+ backend::runtime::syscalls::sigwaitinfo(set)
+}
+
+/// `sigtimedwait(set)`—Wait for signals, optionally with a timeout.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/sigtimedwait.2.html
+#[cfg(linux_raw)]
+#[inline]
+pub fn sigtimedwait(set: &Sigset, timeout: Option<Timespec>) -> io::Result<Siginfo> {
+ backend::runtime::syscalls::sigtimedwait(set, timeout)
+}
diff --git a/vendor/rustix/src/termios/tty.rs b/vendor/rustix/src/termios/tty.rs
index 2bf5d3ceb..76ffd8609 100644
--- a/vendor/rustix/src/termios/tty.rs
+++ b/vendor/rustix/src/termios/tty.rs
@@ -42,6 +42,7 @@ pub fn isatty<Fd: AsFd>(fd: Fd) -> bool {
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
#[cfg(feature = "procfs")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))]
+#[doc(alias = "ttyname_r")]
#[inline]
pub fn ttyname<Fd: AsFd, B: Into<Vec<u8>>>(dirfd: Fd, reuse: B) -> io::Result<CString> {
_ttyname(dirfd.as_fd(), reuse.into())
diff --git a/vendor/rustix/src/thread/id.rs b/vendor/rustix/src/thread/id.rs
index 59610ff03..3143b068b 100644
--- a/vendor/rustix/src/thread/id.rs
+++ b/vendor/rustix/src/thread/id.rs
@@ -26,7 +26,8 @@ pub fn gettid() -> Pid {
/// though that is in violation of the POSIX standard.
///
/// For details on this distinction, see the C library vs. kernel differences
-/// in the [man page][linux_notes]. This call implements the kernel behavior.
+/// in the [manual page][linux_notes]. This call implements the kernel
+/// behavior.
///
/// # References
/// - [POSIX]
@@ -50,7 +51,7 @@ pub fn set_thread_uid(uid: Uid) -> io::Result<()> {
/// though that is in violation of the POSIX standard.
///
/// For details on this distinction, see the C library vs. kernel differences
-/// in the [man page][linux_notes] and the notes in [`set_thread_uid`]. This
+/// in the [manual page][linux_notes] and the notes in [`set_thread_uid`]. This
/// call implements the kernel behavior.
///
/// # References
@@ -73,7 +74,8 @@ pub fn set_thread_res_uid(ruid: Uid, euid: Uid, suid: Uid) -> io::Result<()> {
/// though that is in violation of the POSIX standard.
///
/// For details on this distinction, see the C library vs. kernel differences
-/// in the [man page][linux_notes]. This call implements the kernel behavior.
+/// in the [manual page][linux_notes]. This call implements the kernel
+/// behavior.
///
/// # References
/// - [POSIX]
@@ -97,7 +99,7 @@ pub fn set_thread_gid(gid: Gid) -> io::Result<()> {
/// though that is in violation of the POSIX standard.
///
/// For details on this distinction, see the C library vs. kernel differences
-/// in the [man page][linux_notes] and the notes in [`set_thread_gid`]. This
+/// in the [manual page][linux_notes] and the notes in [`set_thread_gid`]. This
/// call implements the kernel behavior.
///
/// # References
diff --git a/vendor/rustix/src/thread/prctl.rs b/vendor/rustix/src/thread/prctl.rs
index f1ddf7d36..2e11ff247 100644
--- a/vendor/rustix/src/thread/prctl.rs
+++ b/vendor/rustix/src/thread/prctl.rs
@@ -129,20 +129,23 @@ impl TryFrom<i32> for SecureComputingMode {
/*
/// Get the secure computing mode of the calling thread.
///
-/// If the caller is not in secure computing mode, this returns [`SecureComputingMode::Disabled`].
-/// If the caller is in strict secure computing mode, then this call will cause a `SIGKILL` signal
-/// to be sent to the process.
-/// If the caller is in filter mode, and this system call is allowed by the seccomp filters,
-/// it returns [`SecureComputingMode::Filter`]; otherwise, the process is killed with
-/// a `SIGKILL` signal.
-///
-/// Since Linux 3.8, the Seccomp field of the `/proc/[pid]/status` file provides a method
-/// of obtaining the same information, without the risk that the process is killed; see `proc(5)`.
+/// If the caller is not in secure computing mode, this returns
+/// [`SecureComputingMode::Disabled`]. If the caller is in strict secure
+/// computing mode, then this call will cause a [`Signal::Kill`] signal to be
+/// sent to the process. If the caller is in filter mode, and this system call
+/// is allowed by the seccomp filters, it returns
+/// [`SecureComputingMode::Filter`]; otherwise, the process is killed with
+/// a [`Signal::Kill`] signal.
+///
+/// Since Linux 3.8, the Seccomp field of the `/proc/[pid]/status` file
+/// provides a method of obtaining the same information, without the risk that
+/// the process is killed; see [the `proc` manual page].
///
/// # References
/// - [`prctl(PR_GET_SECCOMP,...)`]
///
/// [`prctl(PR_GET_SECCOMP,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+/// [the `proc` manual page]: https://man7.org/linux/man-pages/man5/proc.5.html
#[inline]
pub fn secure_computing_mode() -> io::Result<SecureComputingMode> {
unsafe { prctl_1arg(PR_GET_SECCOMP) }.and_then(TryInto::try_into)
diff --git a/vendor/rustix/src/time/clock.rs b/vendor/rustix/src/time/clock.rs
index 1bf74d60b..2aa38b213 100644
--- a/vendor/rustix/src/time/clock.rs
+++ b/vendor/rustix/src/time/clock.rs
@@ -11,9 +11,19 @@ pub use backend::time::types::{ClockId, DynamicClockId};
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_getres.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=clock_getres&sektion=2
+/// [NetBSD]: https://man.netbsd.org/clock_getres.2
+/// [OpenBSD]: https://man.openbsd.org/clock_getres.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=clock_getres&section=2
+/// [illumos]: https://illumos.org/man/3C/clock_getres
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[inline]
#[must_use]
@@ -31,9 +41,19 @@ pub fn clock_getres(id: ClockId) -> Timespec {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_gettime.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=clock_getres&sektion=2
+/// [NetBSD]: https://man.netbsd.org/clock_getres.2
+/// [OpenBSD]: https://man.openbsd.org/clock_getres.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=clock_getres&section=2
+/// [illumos]: https://illumos.org/man/3C/clock_gettime
#[cfg(not(target_os = "wasi"))]
#[inline]
#[must_use]
@@ -64,9 +84,19 @@ pub fn clock_gettime_dynamic(id: DynamicClockId<'_>) -> io::Result<Timespec> {
/// # References
/// - [POSIX]
/// - [Linux]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_settime.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_settime.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=clock_settime&sektion=2
+/// [NetBSD]: https://man.netbsd.org/clock_settime.2
+/// [OpenBSD]: https://man.openbsd.org/clock_settime.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=clock_settime&section=2
+/// [illumos]: https://illumos.org/man/3C/clock_settime
#[cfg(not(any(
target_os = "redox",
target_os = "wasi",
diff --git a/vendor/rustix/src/utils.rs b/vendor/rustix/src/utils.rs
index dcbadb260..d6ad43b54 100644
--- a/vendor/rustix/src/utils.rs
+++ b/vendor/rustix/src/utils.rs
@@ -12,6 +12,26 @@ pub(crate) fn as_mut_ptr<T>(t: &mut T) -> *mut T {
t
}
+/// Convert an `Option<&T>` into a possibly-null `*const T`.
+#[inline]
+#[allow(dead_code)]
+pub(crate) const fn optional_as_ptr<T>(t: Option<&T>) -> *const T {
+ match t {
+ Some(t) => t,
+ None => core::ptr::null(),
+ }
+}
+
+/// Convert an `Option<&mut T>` into a possibly-null `*mut T`.
+#[inline]
+#[allow(dead_code)]
+pub(crate) fn optional_as_mut_ptr<T>(t: Option<&mut T>) -> *mut T {
+ match t {
+ Some(t) => t,
+ None => core::ptr::null_mut(),
+ }
+}
+
/// Convert a `*mut c_void` to a `*mut T`, checking that it is not null,
/// misaligned, or pointing to a region of memory that wraps around the address
/// space.
diff --git a/vendor/rustix/src/backend/linux_raw/weak.rs b/vendor/rustix/src/weak.rs
index ae7d6832e..fae3ce058 100644
--- a/vendor/rustix/src/backend/linux_raw/weak.rs
+++ b/vendor/rustix/src/weak.rs
@@ -2,7 +2,7 @@
// library/std/src/sys/unix/weak.rs at revision
// fd0cb0cdc21dd9c06025277d772108f8d42cb25f.
-#![allow(unsafe_code)]
+#![cfg_attr(linux_raw, allow(unsafe_code))]
//! Support for "weak linkage" to symbols on Unix
//!
@@ -40,8 +40,8 @@ const INVALID: *mut c_void = 1 as *mut c_void;
macro_rules! weak {
($vis:vis fn $name:ident($($t:ty),*) -> $ret:ty) => (
#[allow(non_upper_case_globals)]
- $vis static $name: $crate::backend::weak::Weak<unsafe extern fn($($t),*) -> $ret> =
- $crate::backend::weak::Weak::new(concat!(stringify!($name), '\0'));
+ $vis static $name: $crate::weak::Weak<unsafe extern fn($($t),*) -> $ret> =
+ $crate::weak::Weak::new(concat!(stringify!($name), '\0'));
)
}