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/fs/dir.rs16
-rw-r--r--vendor/rustix/src/backend/libc/io/errno.rs2
-rw-r--r--vendor/rustix/src/backend/libc/mod.rs3
-rw-r--r--vendor/rustix/src/backend/libc/offset.rs2
-rw-r--r--vendor/rustix/src/backend/libc/termios/mod.rs1
-rw-r--r--vendor/rustix/src/backend/libc/termios/syscalls.rs47
-rw-r--r--vendor/rustix/src/backend/libc/thread/syscalls.rs6
-rw-r--r--vendor/rustix/src/backend/linux_raw/mod.rs1
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/auxv.rs7
-rw-r--r--vendor/rustix/src/backend/linux_raw/termios/types.rs8
-rw-r--r--vendor/rustix/src/backend/linux_raw/thread/syscalls.rs6
-rw-r--r--vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs2
-rw-r--r--vendor/rustix/src/fs/at.rs2
-rw-r--r--vendor/rustix/src/io/fcntl.rs3
-rw-r--r--vendor/rustix/src/lib.rs2
-rw-r--r--vendor/rustix/src/termios/mod.rs183
-rw-r--r--vendor/rustix/src/termios/tty.rs1
-rw-r--r--vendor/rustix/src/thread/setns.rs41
-rw-r--r--vendor/rustix/src/time/clock.rs2
19 files changed, 243 insertions, 92 deletions
diff --git a/vendor/rustix/src/backend/libc/fs/dir.rs b/vendor/rustix/src/backend/libc/fs/dir.rs
index 8e5477401..6b69c3600 100644
--- a/vendor/rustix/src/backend/libc/fs/dir.rs
+++ b/vendor/rustix/src/backend/libc/fs/dir.rs
@@ -242,7 +242,7 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
// 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(target_os = "dragonfly"))]
+ #[cfg(not(any(target_os = "freebsd", target_os = "dragonfly")))]
let mut dirent = libc_dirent {
#[cfg(not(any(
target_os = "aix",
@@ -253,7 +253,7 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
d_type,
#[cfg(not(any(
target_os = "aix",
- target_os = "freebsd",
+ target_os = "freebsd", // Until FreeBSD 12
target_os = "haiku",
target_os = "ios",
target_os = "macos",
@@ -306,14 +306,18 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
// */
- // On dragonfly, `dirent` has some non-public padding fields so we can't
- // directly initialize it.
- #[cfg(target_os = "dragonfly")]
- let mut dirent = unsafe {
+ // On dragonfly and FreeBSD 12, `dirent` has some non-public padding fields
+ // so we can't directly initialize it.
+ #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
+ 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
};
diff --git a/vendor/rustix/src/backend/libc/io/errno.rs b/vendor/rustix/src/backend/libc/io/errno.rs
index 131709e0c..25323771c 100644
--- a/vendor/rustix/src/backend/libc/io/errno.rs
+++ b/vendor/rustix/src/backend/libc/io/errno.rs
@@ -158,7 +158,7 @@ impl Errno {
/// `ECANCELED`
pub const CANCELED: Self = Self(c::ECANCELED);
/// `ECAPMODE`
- #[cfg(any(target_os = "freebsd"))]
+ #[cfg(target_os = "freebsd")]
pub const CAPMODE: Self = Self(c::ECAPMODE);
/// `ECHILD`
#[cfg(not(windows))]
diff --git a/vendor/rustix/src/backend/libc/mod.rs b/vendor/rustix/src/backend/libc/mod.rs
index 16d21b657..70029282f 100644
--- a/vendor/rustix/src/backend/libc/mod.rs
+++ b/vendor/rustix/src/backend/libc/mod.rs
@@ -61,7 +61,6 @@ pub(crate) mod fs;
pub(crate) mod io;
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg(feature = "io_uring")]
-#[cfg_attr(doc_cfg, doc(cfg(feature = "io_uring")))]
pub(crate) mod io_uring;
#[cfg(not(any(windows, target_os = "wasi")))]
#[cfg(feature = "mm")]
@@ -82,7 +81,7 @@ pub(crate) mod process;
#[cfg(not(windows))]
#[cfg(feature = "rand")]
pub(crate) mod rand;
-#[cfg(not(any(windows, target_os = "wasi")))]
+#[cfg(not(windows))]
#[cfg(feature = "termios")]
pub(crate) mod termios;
#[cfg(not(windows))]
diff --git a/vendor/rustix/src/backend/libc/offset.rs b/vendor/rustix/src/backend/libc/offset.rs
index 48729be0c..8aae9d073 100644
--- a/vendor/rustix/src/backend/libc/offset.rs
+++ b/vendor/rustix/src/backend/libc/offset.rs
@@ -360,7 +360,7 @@ pub(super) use readwrite_pv::{preadv as libc_preadv, pwritev as libc_pwritev};
)))]
#[cfg(feature = "fs")]
pub(super) use c::posix_fallocate as libc_posix_fallocate;
-#[cfg(any(target_os = "l4re"))]
+#[cfg(target_os = "l4re")]
#[cfg(feature = "fs")]
pub(super) use c::posix_fallocate64 as libc_posix_fallocate;
#[cfg(not(any(
diff --git a/vendor/rustix/src/backend/libc/termios/mod.rs b/vendor/rustix/src/backend/libc/termios/mod.rs
index 1e0181a99..c82c95958 100644
--- a/vendor/rustix/src/backend/libc/termios/mod.rs
+++ b/vendor/rustix/src/backend/libc/termios/mod.rs
@@ -1,2 +1,3 @@
pub(crate) mod syscalls;
+#[cfg(not(target_os = "wasi"))]
pub(crate) mod types;
diff --git a/vendor/rustix/src/backend/libc/termios/syscalls.rs b/vendor/rustix/src/backend/libc/termios/syscalls.rs
index e0ab7a016..f54e9a6f3 100644
--- a/vendor/rustix/src/backend/libc/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/termios/syscalls.rs
@@ -10,12 +10,15 @@ use crate::fd::BorrowedFd;
#[cfg(feature = "procfs")]
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
use crate::ffi::CStr;
+#[cfg(not(target_os = "wasi"))]
use crate::io;
+#[cfg(not(target_os = "wasi"))]
use crate::process::{Pid, RawNonZeroPid};
+#[cfg(not(target_os = "wasi"))]
use crate::termios::{Action, OptionalActions, QueueSelector, Speed, Termios, Winsize};
use core::mem::MaybeUninit;
-use libc_errno::errno;
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
let mut result = MaybeUninit::<Termios>::uninit();
unsafe {
@@ -24,6 +27,7 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
}
}
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcgetpgrp(fd: BorrowedFd<'_>) -> io::Result<Pid> {
unsafe {
let pid = ret_pid_t(c::tcgetpgrp(borrowed_fd(fd)))?;
@@ -32,10 +36,12 @@ pub(crate) fn tcgetpgrp(fd: BorrowedFd<'_>) -> io::Result<Pid> {
}
}
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcsetpgrp(fd: BorrowedFd<'_>, pid: Pid) -> io::Result<()> {
unsafe { ret(c::tcsetpgrp(borrowed_fd(fd), pid.as_raw_nonzero().get())) }
}
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcsetattr(
fd: BorrowedFd,
optional_actions: OptionalActions,
@@ -50,22 +56,27 @@ pub(crate) fn tcsetattr(
}
}
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcsendbreak(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::tcsendbreak(borrowed_fd(fd), 0)) }
}
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcdrain(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::tcdrain(borrowed_fd(fd))) }
}
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcflush(fd: BorrowedFd, queue_selector: QueueSelector) -> io::Result<()> {
unsafe { ret(c::tcflush(borrowed_fd(fd), queue_selector as _)) }
}
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcflow(fd: BorrowedFd, action: Action) -> io::Result<()> {
unsafe { ret(c::tcflow(borrowed_fd(fd), action as _)) }
}
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result<Pid> {
unsafe {
let pid = ret_pid_t(c::tcgetsid(borrowed_fd(fd)))?;
@@ -74,10 +85,12 @@ pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result<Pid> {
}
}
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcsetwinsize(fd: BorrowedFd, winsize: Winsize) -> io::Result<()> {
unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCSWINSZ, &winsize)) }
}
+#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcgetwinsize(fd: BorrowedFd) -> io::Result<Winsize> {
unsafe {
let mut buf = MaybeUninit::<Winsize>::uninit();
@@ -90,59 +103,51 @@ pub(crate) fn tcgetwinsize(fd: BorrowedFd) -> io::Result<Winsize> {
}
}
+#[cfg(not(target_os = "wasi"))]
#[inline]
#[must_use]
pub(crate) fn cfgetospeed(termios: &Termios) -> Speed {
unsafe { c::cfgetospeed(termios) }
}
+#[cfg(not(target_os = "wasi"))]
#[inline]
#[must_use]
pub(crate) fn cfgetispeed(termios: &Termios) -> Speed {
unsafe { c::cfgetispeed(termios) }
}
+#[cfg(not(target_os = "wasi"))]
#[inline]
pub(crate) fn cfmakeraw(termios: &mut Termios) {
unsafe { c::cfmakeraw(termios) }
}
+#[cfg(not(target_os = "wasi"))]
#[inline]
pub(crate) fn cfsetospeed(termios: &mut Termios, speed: Speed) -> io::Result<()> {
unsafe { ret(c::cfsetospeed(termios, speed)) }
}
+#[cfg(not(target_os = "wasi"))]
#[inline]
pub(crate) fn cfsetispeed(termios: &mut Termios, speed: Speed) -> io::Result<()> {
unsafe { ret(c::cfsetispeed(termios, speed)) }
}
+#[cfg(not(target_os = "wasi"))]
#[inline]
pub(crate) fn cfsetspeed(termios: &mut Termios, speed: Speed) -> io::Result<()> {
unsafe { ret(c::cfsetspeed(termios, speed)) }
}
pub(crate) fn isatty(fd: BorrowedFd<'_>) -> bool {
- let res = unsafe { c::isatty(borrowed_fd(fd)) };
- if res == 0 {
- match errno().0 {
- #[cfg(not(any(target_os = "android", target_os = "linux")))]
- c::ENOTTY => false,
-
- // Old Linux versions reportedly return `EINVAL`.
- // <https://man7.org/linux/man-pages/man3/isatty.3.html#ERRORS>
- #[cfg(any(target_os = "android", target_os = "linux"))]
- c::ENOTTY | c::EINVAL => false,
-
- // Darwin mysteriously returns `EOPNOTSUPP` sometimes.
- #[cfg(any(target_os = "ios", target_os = "macos"))]
- c::EOPNOTSUPP => false,
-
- err => panic!("unexpected error from isatty: {:?}", err),
- }
- } else {
- true
- }
+ // 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.
+ unsafe { c::isatty(borrowed_fd(fd)) != 0 }
}
#[cfg(feature = "procfs")]
diff --git a/vendor/rustix/src/backend/libc/thread/syscalls.rs b/vendor/rustix/src/backend/libc/thread/syscalls.rs
index 0709fbb19..4f69b8f63 100644
--- a/vendor/rustix/src/backend/libc/thread/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/thread/syscalls.rs
@@ -293,3 +293,9 @@ pub(crate) fn gettid() -> Pid {
pub(crate) fn setns(fd: BorrowedFd, nstype: c::c_int) -> io::Result<c::c_int> {
unsafe { ret_c_int(c::setns(borrowed_fd(fd), nstype)) }
}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn unshare(flags: crate::thread::UnshareFlags) -> io::Result<()> {
+ unsafe { ret(c::unshare(flags.bits() as i32)) }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/mod.rs b/vendor/rustix/src/backend/linux_raw/mod.rs
index 231dc37b6..e7e073e32 100644
--- a/vendor/rustix/src/backend/linux_raw/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/mod.rs
@@ -28,7 +28,6 @@ mod vdso_wrappers;
pub(crate) mod fs;
pub(crate) mod io;
#[cfg(feature = "io_uring")]
-#[cfg_attr(doc_cfg, doc(cfg(feature = "io_uring")))]
pub(crate) mod io_uring;
#[cfg(feature = "mm")]
pub(crate) mod mm;
diff --git a/vendor/rustix/src/backend/linux_raw/param/auxv.rs b/vendor/rustix/src/backend/linux_raw/param/auxv.rs
index 20a3d5da6..acdd9d0e7 100644
--- a/vendor/rustix/src/backend/linux_raw/param/auxv.rs
+++ b/vendor/rustix/src/backend/linux_raw/param/auxv.rs
@@ -10,6 +10,7 @@ use super::super::elf::*;
use crate::fd::OwnedFd;
#[cfg(feature = "param")]
use crate::ffi::CStr;
+#[cfg(not(target_vendor = "mustang"))]
use crate::fs::{Mode, OFlags};
use crate::utils::{as_ptr, check_raw_pointer};
use alloc::vec::Vec;
@@ -130,6 +131,7 @@ static PHNUM: AtomicUsize = AtomicUsize::new(0);
static EXECFN: AtomicPtr<c::c_char> = AtomicPtr::new(null_mut());
/// On non-Mustang platforms, we read the aux vector from /proc/self/auxv.
+#[cfg(not(target_vendor = "mustang"))]
fn init_from_proc_self_auxv() {
// Open "/proc/self/auxv", either because we trust "/proc", or because
// we're running inside QEMU and `proc_self_auxv`'s extra checking foils
@@ -146,6 +148,11 @@ fn init_from_proc_self_auxv() {
let _ = init_from_auxv_file(file);
}
+#[cfg(target_vendor = "mustang")]
+fn init_from_proc_self_auxv() {
+ panic!("mustang should have initialized the auxv values");
+}
+
/// Process auxv entries from the open file `auxv`.
fn init_from_auxv_file(auxv: OwnedFd) -> Option<()> {
let mut buffer = Vec::<u8>::with_capacity(512);
diff --git a/vendor/rustix/src/backend/linux_raw/termios/types.rs b/vendor/rustix/src/backend/linux_raw/termios/types.rs
index 88db4e1c9..a44f1eda5 100644
--- a/vendor/rustix/src/backend/linux_raw/termios/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/termios/types.rs
@@ -338,19 +338,19 @@ pub const B1500000: Speed = linux_raw_sys::general::B1500000;
pub const B2000000: Speed = linux_raw_sys::general::B2000000;
/// `B2500000`
-#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
+#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
pub const B2500000: Speed = linux_raw_sys::general::B2500000;
/// `B3000000`
-#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
+#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
pub const B3000000: Speed = linux_raw_sys::general::B3000000;
/// `B3500000`
-#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
+#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
pub const B3500000: Speed = linux_raw_sys::general::B3500000;
/// `B4000000`
-#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
+#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
pub const B4000000: Speed = linux_raw_sys::general::B4000000;
/// `CSIZE`
diff --git a/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
index 99c632e7e..2ec3e43e8 100644
--- a/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
@@ -288,3 +288,9 @@ unsafe fn futex_old(
pub(crate) fn setns(fd: BorrowedFd, nstype: c::c_int) -> io::Result<c::c_int> {
unsafe { ret_c_int(syscall_readonly!(__NR_setns, fd, c_int(nstype))) }
}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn unshare(flags: crate::thread::UnshareFlags) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_unshare, c_uint(flags.bits()))) }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
index 487835314..aaa000622 100644
--- a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
+++ b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
@@ -364,7 +364,7 @@ fn init() {
// On all 64-bit platforms, the 64-bit `clock_gettime` symbols are
// always available.
- #[cfg(any(target_pointer_width = "64"))]
+ #[cfg(target_pointer_width = "64")]
let ok = true;
// On some 32-bit platforms, the 64-bit `clock_gettime` symbols are not
diff --git a/vendor/rustix/src/fs/at.rs b/vendor/rustix/src/fs/at.rs
index 463c247c0..925a0aa01 100644
--- a/vendor/rustix/src/fs/at.rs
+++ b/vendor/rustix/src/fs/at.rs
@@ -372,7 +372,7 @@ pub fn mknodat<P: path::Arg, Fd: AsFd>(
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchownat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/fchownat.2.html
-#[cfg(not(any(target_os = "wasi")))]
+#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn chownat<P: path::Arg, Fd: AsFd>(
dirfd: Fd,
diff --git a/vendor/rustix/src/io/fcntl.rs b/vendor/rustix/src/io/fcntl.rs
index 109e4540b..ba79149ff 100644
--- a/vendor/rustix/src/io/fcntl.rs
+++ b/vendor/rustix/src/io/fcntl.rs
@@ -8,8 +8,7 @@
//!
//! [`io`]: crate::io
-use crate::backend;
-use crate::io;
+use crate::{backend, io};
use backend::fd::{AsFd, OwnedFd, RawFd};
pub use backend::io::types::FdFlags;
diff --git a/vendor/rustix/src/lib.rs b/vendor/rustix/src/lib.rs
index f8bf0729f..83a686454 100644
--- a/vendor/rustix/src/lib.rs
+++ b/vendor/rustix/src/lib.rs
@@ -188,7 +188,7 @@ pub mod process;
#[cfg(feature = "rand")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
pub mod rand;
-#[cfg(not(any(windows, target_os = "wasi")))]
+#[cfg(not(windows))]
#[cfg(feature = "termios")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "termios")))]
pub mod termios;
diff --git a/vendor/rustix/src/termios/mod.rs b/vendor/rustix/src/termios/mod.rs
index ec35f96fb..5c4cccca9 100644
--- a/vendor/rustix/src/termios/mod.rs
+++ b/vendor/rustix/src/termios/mod.rs
@@ -1,11 +1,15 @@
//! Terminal I/O stream operations.
+#[cfg(not(target_os = "wasi"))]
mod cf;
+#[cfg(not(target_os = "wasi"))]
mod constants;
+#[cfg(not(target_os = "wasi"))]
mod tc;
#[cfg(not(windows))]
mod tty;
+#[cfg(not(target_os = "wasi"))]
pub use cf::{cfgetispeed, cfgetospeed, cfmakeraw, cfsetispeed, cfsetospeed, cfsetspeed};
#[cfg(not(any(
target_os = "dragonfly",
@@ -16,6 +20,7 @@ pub use cf::{cfgetispeed, cfgetospeed, cfmakeraw, cfsetispeed, cfsetospeed, cfse
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::B1000000;
#[cfg(not(any(
@@ -27,6 +32,7 @@ pub use constants::B1000000;
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::B1152000;
#[cfg(not(any(
@@ -38,6 +44,7 @@ pub use constants::B1152000;
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::B1500000;
#[cfg(not(any(
@@ -49,6 +56,7 @@ pub use constants::B1500000;
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::B2000000;
#[cfg(not(any(
@@ -62,6 +70,7 @@ pub use constants::B2000000;
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::B2500000;
#[cfg(not(any(
@@ -75,6 +84,7 @@ pub use constants::B2500000;
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::B3000000;
#[cfg(not(any(
@@ -88,6 +98,7 @@ pub use constants::B3000000;
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::B3500000;
#[cfg(not(any(
@@ -101,6 +112,7 @@ pub use constants::B3500000;
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::B4000000;
#[cfg(not(any(
@@ -108,7 +120,8 @@ pub use constants::B4000000;
target_os = "haiku",
target_os = "ios",
target_os = "macos",
- target_os = "openbsd"
+ target_os = "openbsd",
+ target_os = "wasi",
)))]
pub use constants::B460800;
#[cfg(not(any(
@@ -121,6 +134,7 @@ pub use constants::B460800;
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::B500000;
#[cfg(not(any(
@@ -133,6 +147,7 @@ pub use constants::B500000;
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::B576000;
#[cfg(not(any(
@@ -140,10 +155,11 @@ pub use constants::B576000;
target_os = "haiku",
target_os = "ios",
target_os = "macos",
- target_os = "openbsd"
+ target_os = "openbsd",
+ target_os = "wasi",
)))]
pub use constants::B921600;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::BRKINT;
#[cfg(not(any(
target_os = "dragonfly",
@@ -156,6 +172,7 @@ pub use constants::BRKINT;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::BS0;
#[cfg(not(any(
@@ -171,6 +188,7 @@ pub use constants::BS0;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::BS1;
#[cfg(not(any(
@@ -183,6 +201,7 @@ pub use constants::BS1;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::BSDLY;
#[cfg(not(any(
@@ -194,6 +213,7 @@ pub use constants::BSDLY;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "wasi",
)))]
pub use constants::CBAUD;
#[cfg(not(any(
@@ -207,6 +227,7 @@ pub use constants::CBAUD;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::CBAUDEX;
#[cfg(not(any(
@@ -219,9 +240,10 @@ pub use constants::CBAUDEX;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "wasi",
)))]
pub use constants::CIBAUD;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::CLOCAL;
#[cfg(not(any(
target_os = "dragonfly",
@@ -235,6 +257,7 @@ pub use constants::CLOCAL;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::CMSPAR;
#[cfg(not(any(
@@ -248,6 +271,7 @@ pub use constants::CMSPAR;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::CR0;
#[cfg(not(any(
@@ -263,6 +287,7 @@ pub use constants::CR0;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::CR1;
#[cfg(not(any(
@@ -278,6 +303,7 @@ pub use constants::CR1;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::CR2;
#[cfg(not(any(
@@ -293,6 +319,7 @@ pub use constants::CR2;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::CR3;
#[cfg(not(any(
@@ -305,37 +332,58 @@ pub use constants::CR3;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::CRDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::CREAD;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub use constants::CRTSCTS;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::CS5;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::CS6;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::CS7;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::CS8;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::CSIZE;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::CSTOPB;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::ECHO;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub use constants::ECHOCTL;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::ECHOE;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::ECHOK;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub use constants::ECHOKE;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::ECHONL;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub use constants::ECHOPRT;
#[cfg(not(any(
target_os = "emscripten",
@@ -345,6 +393,7 @@ pub use constants::ECHOPRT;
target_os = "macos",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::EXTA;
#[cfg(not(any(
@@ -355,13 +404,15 @@ pub use constants::EXTA;
target_os = "macos",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::EXTB;
#[cfg(not(any(
target_os = "haiku",
target_os = "ios",
target_os = "macos",
- target_os = "redox"
+ target_os = "redox",
+ target_os = "wasi",
)))]
pub use constants::EXTPROC;
#[cfg(not(any(
@@ -375,6 +426,7 @@ pub use constants::EXTPROC;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::FF0;
#[cfg(not(any(
@@ -390,6 +442,7 @@ pub use constants::FF0;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::FF1;
#[cfg(not(any(
@@ -403,36 +456,43 @@ pub use constants::FF1;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::FFDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub use constants::FLUSHO;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::HUPCL;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::ICRNL;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::IEXTEN;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::IGNBRK;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::IGNCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::IGNPAR;
#[cfg(not(any(
target_os = "haiku",
target_os = "ios",
target_os = "macos",
- target_os = "redox"
+ target_os = "redox",
+ target_os = "wasi",
)))]
pub use constants::IMAXBEL;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::INLCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::INPCK;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::ISIG;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::ISTRIP;
#[cfg(any(
linux_raw,
@@ -454,13 +514,19 @@ pub use constants::IUCLC;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::IUTF8;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub use constants::IXANY;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::IXOFF;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::IXON;
#[cfg(not(any(
target_os = "dragonfly",
@@ -473,6 +539,7 @@ pub use constants::IXON;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::NL0;
#[cfg(not(any(
@@ -486,6 +553,7 @@ pub use constants::NL0;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::NL1;
#[cfg(not(any(
@@ -498,11 +566,12 @@ pub use constants::NL1;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::NLDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::NOFLSH;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::OCRNL;
#[cfg(not(any(
target_os = "dragonfly",
@@ -511,6 +580,7 @@ pub use constants::OCRNL;
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "wasi",
)))]
pub use constants::OFDEL;
#[cfg(not(any(
@@ -520,6 +590,7 @@ pub use constants::OFDEL;
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "wasi",
)))]
pub use constants::OFILL;
#[cfg(not(any(
@@ -529,23 +600,29 @@ pub use constants::OFILL;
target_os = "macos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "wasi",
)))]
pub use constants::OLCUC;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::ONLCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::ONLRET;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::ONOCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::OPOST;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::PARENB;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::PARMRK;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::PARODD;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub use constants::PENDIN;
#[cfg(not(any(
target_os = "dragonfly",
@@ -557,6 +634,7 @@ pub use constants::PENDIN;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::TAB0;
#[cfg(not(any(
@@ -572,6 +650,7 @@ pub use constants::TAB0;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::TAB1;
#[cfg(not(any(
@@ -587,6 +666,7 @@ pub use constants::TAB1;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::TAB2;
#[cfg(not(any(
@@ -601,6 +681,7 @@ pub use constants::TAB2;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::TAB3;
#[cfg(not(any(
@@ -612,9 +693,10 @@ pub use constants::TAB3;
target_os = "illumos",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::TABDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
pub use constants::TOSTOP;
#[cfg(not(any(
target_os = "dragonfly",
@@ -626,6 +708,7 @@ pub use constants::TOSTOP;
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::VSWTC;
#[cfg(not(any(
@@ -639,6 +722,7 @@ pub use constants::VSWTC;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::VT0;
#[cfg(not(any(
@@ -654,6 +738,7 @@ pub use constants::VT0;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::VT1;
#[cfg(not(any(
@@ -667,6 +752,7 @@ pub use constants::VT1;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::VTDLY;
#[cfg(any(linux_raw, all(libc, any(target_arch = "s390x", target_os = "haiku"))))]
@@ -682,15 +768,18 @@ pub use constants::XCASE;
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
+ target_os = "wasi",
)))]
pub use constants::XTABS;
+#[cfg(not(target_os = "wasi"))]
pub use constants::{
speed_value, B0, B110, B115200, B1200, B134, B150, B1800, B19200, B200, B230400, B2400, B300,
B38400, B4800, B50, B57600, B600, B75, B9600, ICANON, VEOF, VEOL, VEOL2, VERASE, VINTR, VKILL,
VMIN, VQUIT, VSTART, VSTOP, VSUSP, VTIME,
};
-#[cfg(not(target_os = "haiku"))]
+#[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
pub use constants::{VDISCARD, VLNEXT, VREPRINT, VWERASE};
+#[cfg(not(target_os = "wasi"))]
pub use tc::{
tcdrain, tcflow, tcflush, tcgetattr, tcgetpgrp, tcgetsid, tcgetwinsize, tcsendbreak, tcsetattr,
tcsetpgrp, tcsetwinsize, Action, OptionalActions, QueueSelector, Speed, Tcflag, Termios,
diff --git a/vendor/rustix/src/termios/tty.rs b/vendor/rustix/src/termios/tty.rs
index 9a1692330..2bf5d3ceb 100644
--- a/vendor/rustix/src/termios/tty.rs
+++ b/vendor/rustix/src/termios/tty.rs
@@ -5,7 +5,6 @@ use crate::backend;
all(linux_raw, feature = "procfs"),
all(libc, not(any(target_os = "fuchsia", target_os = "wasi"))),
))]
-#[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))]
use crate::io;
use backend::fd::AsFd;
#[cfg(any(
diff --git a/vendor/rustix/src/thread/setns.rs b/vendor/rustix/src/thread/setns.rs
index 0a5564ae1..5295bab94 100644
--- a/vendor/rustix/src/thread/setns.rs
+++ b/vendor/rustix/src/thread/setns.rs
@@ -2,8 +2,8 @@
use bitflags::bitflags;
use linux_raw_sys::general::{
- CLONE_NEWCGROUP, CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID, CLONE_NEWTIME,
- CLONE_NEWUSER, CLONE_NEWUTS,
+ CLONE_FILES, CLONE_FS, CLONE_NEWCGROUP, CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID,
+ CLONE_NEWTIME, CLONE_NEWUSER, CLONE_NEWUTS, CLONE_SYSVSEM,
};
use crate::backend::c::c_int;
@@ -55,6 +55,32 @@ pub enum LinkNameSpaceType {
Network = CLONE_NEWNET,
}
+bitflags! {
+ /// `CLONE_*` for use with [`unshare`].
+ pub struct UnshareFlags: u32 {
+ /// `CLONE_FILES`.
+ const FILES = CLONE_FILES;
+ /// `CLONE_FS`.
+ const FS = CLONE_FS;
+ /// `CLONE_NEWCGROUP`.
+ const NWCGROUP = CLONE_NEWCGROUP;
+ /// `CLONE_NEWIPC`.
+ const NEWIPC = CLONE_NEWIPC;
+ /// `CLONE_NEWNET`.
+ const NEWNET = CLONE_NEWNET;
+ /// `CLONE_NEWNS`.
+ const NEWNS = CLONE_NEWNS;
+ /// `CLONE_NEWPID`.
+ const NEWPID = CLONE_NEWPID;
+ /// `CLONE_NEWTIME`.
+ const NEWTIME = CLONE_NEWTIME;
+ /// `CLONE_NEWUSER`.
+ const NEWUSER = CLONE_NEWUSER;
+ /// `CLONE_SYSVSEM`.
+ const SYSVSEM = CLONE_SYSVSEM;
+ }
+}
+
/// Reassociate the calling thread with the namespace associated with link referred to by `fd`.
///
/// `fd` must refer to one of the magic links in a `/proc/[pid]/ns/` directory, or a bind mount
@@ -87,3 +113,14 @@ pub fn move_into_thread_name_spaces(
) -> io::Result<()> {
syscalls::setns(fd, allowed_types.bits() as c_int).map(|_r| ())
}
+
+/// `unshare(flags)`—Disassociate parts of the current thread's execution
+/// context with other threads.
+///
+/// # References
+/// - [`unshare`]
+///
+/// [`unshare`]: https://man7.org/linux/man-pages/man2/unshare.2.html
+pub fn unshare(flags: UnshareFlags) -> io::Result<()> {
+ syscalls::unshare(flags)
+}
diff --git a/vendor/rustix/src/time/clock.rs b/vendor/rustix/src/time/clock.rs
index 2e23f91b8..f76e3fa18 100644
--- a/vendor/rustix/src/time/clock.rs
+++ b/vendor/rustix/src/time/clock.rs
@@ -3,7 +3,7 @@ use crate::{backend, io};
pub use backend::time::types::{Nsecs, Secs, Timespec};
/// `clockid_t`
-#[cfg(any(not(target_os = "wasi")))]
+#[cfg(not(target_os = "wasi"))]
pub use backend::time::types::{ClockId, DynamicClockId};
/// `clock_getres(id)`—Returns the resolution of a clock.