summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/io
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/rustix/src/io
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/io')
-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
14 files changed, 485 insertions, 55 deletions
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 {