summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/backend
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /vendor/rustix/src/backend
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/backend')
-rw-r--r--vendor/rustix/src/backend/libc/c.rs29
-rw-r--r--vendor/rustix/src/backend/libc/conv.rs36
-rw-r--r--vendor/rustix/src/backend/libc/event/poll_fd.rs6
-rw-r--r--vendor/rustix/src/backend/libc/event/syscalls.rs14
-rw-r--r--vendor/rustix/src/backend/libc/fs/dir.rs23
-rw-r--r--vendor/rustix/src/backend/libc/fs/mod.rs9
-rw-r--r--vendor/rustix/src/backend/libc/fs/syscalls.rs352
-rw-r--r--vendor/rustix/src/backend/libc/fs/types.rs192
-rw-r--r--vendor/rustix/src/backend/libc/io/errno.rs254
-rw-r--r--vendor/rustix/src/backend/libc/io/syscalls.rs63
-rw-r--r--vendor/rustix/src/backend/libc/mm/types.rs39
-rw-r--r--vendor/rustix/src/backend/libc/mod.rs13
-rw-r--r--vendor/rustix/src/backend/libc/mount/mod.rs2
-rw-r--r--vendor/rustix/src/backend/libc/mount/syscalls.rs272
-rw-r--r--vendor/rustix/src/backend/libc/mount/types.rs311
-rw-r--r--vendor/rustix/src/backend/libc/net/addr.rs16
-rw-r--r--vendor/rustix/src/backend/libc/net/ext.rs4
-rw-r--r--vendor/rustix/src/backend/libc/net/mod.rs2
-rw-r--r--vendor/rustix/src/backend/libc/net/read_sockaddr.rs6
-rw-r--r--vendor/rustix/src/backend/libc/net/send_recv.rs7
-rw-r--r--vendor/rustix/src/backend/libc/net/syscalls.rs64
-rw-r--r--vendor/rustix/src/backend/libc/net/write_sockaddr.rs6
-rw-r--r--vendor/rustix/src/backend/libc/pipe/syscalls.rs24
-rw-r--r--vendor/rustix/src/backend/libc/pipe/types.rs7
-rw-r--r--vendor/rustix/src/backend/libc/process/mod.rs2
-rw-r--r--vendor/rustix/src/backend/libc/process/syscalls.rs129
-rw-r--r--vendor/rustix/src/backend/libc/process/types.rs56
-rw-r--r--vendor/rustix/src/backend/libc/pty/syscalls.rs21
-rw-r--r--vendor/rustix/src/backend/libc/system/syscalls.rs24
-rw-r--r--vendor/rustix/src/backend/libc/termios/syscalls.rs62
-rw-r--r--vendor/rustix/src/backend/libc/thread/syscalls.rs234
-rw-r--r--vendor/rustix/src/backend/libc/time/syscalls.rs401
-rw-r--r--vendor/rustix/src/backend/libc/time/types.rs46
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/aarch64.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/inline/aarch64.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/arm.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/inline/arm.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/mips.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/inline/mips.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs543
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/mips64.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/inline/mips64.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs470
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/powerpc64.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/inline/powerpc64.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/riscv64.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/inline/riscv64.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/thumb.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/x86.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/inline/x86.rs)12
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/x86_64.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/inline/x86_64.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/mod.rs16
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/mips.s211
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s189
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs28
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs166
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s132
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs285
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/x86.s381
-rw-r--r--vendor/rustix/src/backend/linux_raw/c.rs14
-rw-r--r--vendor/rustix/src/backend/linux_raw/conv.rs80
-rw-r--r--vendor/rustix/src/backend/linux_raw/elf.rs7
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/syscalls.rs125
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/types.rs124
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/syscalls.rs65
-rw-r--r--vendor/rustix/src/backend/linux_raw/mm/types.rs63
-rw-r--r--vendor/rustix/src/backend/linux_raw/mod.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/mount/mod.rs2
-rw-r--r--vendor/rustix/src/backend/linux_raw/mount/syscalls.rs239
-rw-r--r--vendor/rustix/src/backend/linux_raw/mount/types.rs303
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/syscalls.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/auxv.rs6
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs20
-rw-r--r--vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/syscalls.rs1
-rw-r--r--vendor/rustix/src/backend/linux_raw/pty/syscalls.rs2
-rw-r--r--vendor/rustix/src/backend/linux_raw/reg.rs13
-rw-r--r--vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs12
-rw-r--r--vendor/rustix/src/backend/linux_raw/termios/syscalls.rs7
-rw-r--r--vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs56
74 files changed, 3805 insertions, 2507 deletions
diff --git a/vendor/rustix/src/backend/libc/c.rs b/vendor/rustix/src/backend/libc/c.rs
index 90d3c26f3..f9e94416c 100644
--- a/vendor/rustix/src/backend/libc/c.rs
+++ b/vendor/rustix/src/backend/libc/c.rs
@@ -12,10 +12,6 @@ pub(crate) const PROC_SUPER_MAGIC: u32 = 0x0000_9fa0;
#[cfg(all(linux_kernel, target_env = "musl"))]
pub(crate) const NFS_SUPER_MAGIC: u32 = 0x0000_6969;
-// Submitted upstream in <https://github.com/rust-lang/libc/pull/3272>.
-#[cfg(all(linux_kernel, feature = "net"))]
-pub(crate) const IPPROTO_ETHERNET: c_int = linux_raw_sys::net::IPPROTO_ETHERNET as _;
-
// TODO: Upstream these.
#[cfg(all(linux_kernel, feature = "net"))]
pub(crate) const ETH_P_TSN: c_int = linux_raw_sys::if_ether::ETH_P_TSN as _;
@@ -66,7 +62,9 @@ pub(crate) const ETH_P_MCTP: c_int = linux_raw_sys::if_ether::ETH_P_MCTP as _;
linux_kernel,
any(
target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "sparc",
target_arch = "sparc64"
)
@@ -97,8 +95,6 @@ pub(crate) use {
#[cfg(target_os = "vxworks")]
pub(super) use libc::_Vx_ticks64_t as _Vx_ticks_t;
-#[cfg(target_os = "aix")]
-pub(super) use libc::blksize64_t as blksize_t;
#[cfg(linux_kernel)]
pub(super) use libc::fallocate64 as fallocate;
#[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))]
@@ -108,7 +104,15 @@ pub(super) use libc::open64 as open;
pub(super) use libc::posix_fallocate64 as posix_fallocate;
#[cfg(any(all(linux_like, not(target_os = "android")), target_os = "aix"))]
pub(super) use libc::{blkcnt64_t as blkcnt_t, rlim64_t as rlim_t};
-#[cfg(any(linux_like, target_os = "aix"))]
+#[cfg(target_os = "aix")]
+pub(super) use libc::{
+ blksize64_t as blksize_t, fstat64 as fstat, fstatat, fstatfs64 as fstatfs,
+ fstatvfs64 as fstatvfs, ftruncate64 as ftruncate, getrlimit64 as getrlimit, ino_t,
+ lseek64 as lseek, mmap, off64_t as off_t, openat, posix_fadvise64 as posix_fadvise, preadv,
+ pwritev, rlimit64 as rlimit, setrlimit64 as setrlimit, statfs64 as statfs,
+ statvfs64 as statvfs, RLIM_INFINITY,
+};
+#[cfg(linux_like)]
pub(super) use libc::{
fstat64 as fstat, fstatat64 as fstatat, fstatfs64 as fstatfs, fstatvfs64 as fstatvfs,
ftruncate64 as ftruncate, getrlimit64 as getrlimit, ino64_t as ino_t, lseek64 as lseek,
@@ -121,12 +125,19 @@ pub(super) use libc::{
host_info64_t as host_info_t, host_statistics64 as host_statistics,
vm_statistics64_t as vm_statistics_t,
};
-#[cfg(not(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64"))))]
+#[cfg(not(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+)))]
#[cfg(any(linux_like, target_os = "aix"))]
pub(super) use libc::{lstat64 as lstat, stat64 as stat};
#[cfg(any(linux_kernel, target_os = "aix", target_os = "emscripten"))]
pub(super) use libc::{pread64 as pread, pwrite64 as pwrite};
-#[cfg(any(target_os = "aix", target_os = "linux", target_os = "emscripten"))]
+#[cfg(any(target_os = "linux", target_os = "emscripten"))]
pub(super) use libc::{preadv64 as preadv, pwritev64 as pwritev};
#[cfg(all(target_os = "linux", target_env = "gnu"))]
diff --git a/vendor/rustix/src/backend/libc/conv.rs b/vendor/rustix/src/backend/libc/conv.rs
index d6bcc16ee..baf2a05ed 100644
--- a/vendor/rustix/src/backend/libc/conv.rs
+++ b/vendor/rustix/src/backend/libc/conv.rs
@@ -2,10 +2,10 @@
//! `c_uint`, or libc-specific pointer types. This module provides functions
//! for converting between rustix's types and libc types.
-#![allow(dead_code)]
-
use super::c;
-use super::fd::{AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, LibcFd, OwnedFd, RawFd};
+#[cfg(not(any(windows, target_os = "espidf")))]
+use super::fd::IntoRawFd;
+use super::fd::{AsRawFd, BorrowedFd, FromRawFd, LibcFd, OwnedFd, RawFd};
#[cfg(not(windows))]
use crate::ffi::CStr;
use crate::io;
@@ -16,7 +16,7 @@ pub(super) fn c_str(c: &CStr) -> *const c::c_char {
c.as_ptr()
}
-#[cfg(not(windows))]
+#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))]
#[inline]
pub(super) fn no_fd() -> LibcFd {
-1
@@ -27,6 +27,7 @@ pub(super) fn borrowed_fd(fd: BorrowedFd<'_>) -> LibcFd {
fd.as_raw_fd() as LibcFd
}
+#[cfg(not(any(windows, target_os = "espidf", target_os = "redox")))]
#[inline]
pub(super) fn owned_fd(fd: OwnedFd) -> LibcFd {
fd.into_raw_fd() as LibcFd
@@ -41,6 +42,7 @@ pub(super) fn ret(raw: c::c_int) -> io::Result<()> {
}
}
+#[cfg(apple)]
#[inline]
pub(super) fn nonnegative_ret(raw: c::c_int) -> io::Result<()> {
if raw >= 0 {
@@ -50,6 +52,7 @@ pub(super) fn nonnegative_ret(raw: c::c_int) -> io::Result<()> {
}
}
+#[cfg(not(any(windows, target_os = "wasi")))]
#[inline]
pub(super) unsafe fn ret_infallible(raw: c::c_int) {
debug_assert_eq!(raw, 0, "unexpected error: {:?}", io::Errno::last_os_error());
@@ -64,6 +67,7 @@ pub(super) fn ret_c_int(raw: c::c_int) -> io::Result<c::c_int> {
}
}
+#[cfg(linux_kernel)]
#[inline]
pub(super) fn ret_u32(raw: c::c_int) -> io::Result<u32> {
if raw == -1 {
@@ -94,7 +98,7 @@ pub(super) fn ret_off_t(raw: c::off_t) -> io::Result<c::off_t> {
}
}
-#[cfg(not(windows))]
+#[cfg(not(any(windows, target_os = "wasi")))]
#[inline]
pub(super) fn ret_pid_t(raw: c::pid_t) -> io::Result<c::pid_t> {
if raw == -1 {
@@ -119,6 +123,7 @@ pub(super) unsafe fn ret_owned_fd(raw: LibcFd) -> io::Result<OwnedFd> {
}
}
+#[cfg(not(any(windows, target_os = "wasi")))]
#[inline]
pub(super) fn ret_discarded_fd(raw: LibcFd) -> io::Result<()> {
if raw == !0 {
@@ -128,6 +133,7 @@ pub(super) fn ret_discarded_fd(raw: LibcFd) -> io::Result<()> {
}
}
+#[cfg(not(any(windows, target_os = "wasi")))]
#[inline]
pub(super) fn ret_discarded_char_ptr(raw: *mut c::c_char) -> io::Result<()> {
if raw.is_null() {
@@ -138,7 +144,7 @@ pub(super) fn ret_discarded_char_ptr(raw: *mut c::c_char) -> io::Result<()> {
}
/// Convert the buffer-length argument value of a `send` or `recv` call.
-#[cfg(not(windows))]
+#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
#[inline]
pub(super) fn send_recv_len(len: usize) -> usize {
len
@@ -155,7 +161,7 @@ pub(super) fn send_recv_len(len: usize) -> i32 {
}
/// Convert the return value of a `send` or `recv` call.
-#[cfg(not(windows))]
+#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
#[inline]
pub(super) fn ret_send_recv(len: isize) -> io::Result<usize> {
ret_usize(len)
@@ -170,7 +176,7 @@ pub(super) fn ret_send_recv(len: i32) -> io::Result<usize> {
/// Convert the value to the `msg_iovlen` field of a `msghdr` struct.
#[cfg(all(
- not(any(windows, target_os = "wasi")),
+ not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")),
any(
target_os = "android",
all(target_os = "linux", not(target_env = "musl"))
@@ -183,7 +189,7 @@ pub(super) fn msg_iov_len(len: usize) -> c::size_t {
/// Convert the value to the `msg_iovlen` field of a `msghdr` struct.
#[cfg(all(
- not(any(windows, target_os = "wasi")),
+ not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")),
not(any(
target_os = "android",
all(target_os = "linux", not(target_env = "musl"))
@@ -200,8 +206,9 @@ pub(crate) fn msg_iov_len(len: usize) -> c::c_int {
solarish,
target_env = "musl",
target_os = "emscripten",
+ target_os = "fuchsia",
target_os = "haiku",
- target_os = "fuchsia"
+ target_os = "nto",
))]
#[inline]
pub(crate) fn msg_control_len(len: usize) -> c::socklen_t {
@@ -212,12 +219,15 @@ pub(crate) fn msg_control_len(len: usize) -> c::socklen_t {
#[cfg(not(any(
bsd,
solarish,
+ windows,
target_env = "musl",
target_os = "emscripten",
- target_os = "haiku",
+ target_os = "espidf",
target_os = "fuchsia",
- windows,
- target_os = "wasi"
+ target_os = "haiku",
+ target_os = "nto",
+ target_os = "redox",
+ target_os = "wasi",
)))]
#[inline]
pub(crate) fn msg_control_len(len: usize) -> c::size_t {
diff --git a/vendor/rustix/src/backend/libc/event/poll_fd.rs b/vendor/rustix/src/backend/libc/event/poll_fd.rs
index 49a6d1126..a06812aaa 100644
--- a/vendor/rustix/src/backend/libc/event/poll_fd.rs
+++ b/vendor/rustix/src/backend/libc/event/poll_fd.rs
@@ -26,18 +26,20 @@ bitflags! {
/// `POLLRDNORM`
const RDNORM = c::POLLRDNORM;
/// `POLLWRNORM`
+ #[cfg(not(target_os = "l4re"))]
const WRNORM = c::POLLWRNORM;
/// `POLLRDBAND`
- #[cfg(not(target_os = "wasi"))]
+ #[cfg(not(any(target_os = "l4re", target_os = "wasi")))]
const RDBAND = c::POLLRDBAND;
/// `POLLWRBAND`
- #[cfg(not(target_os = "wasi"))]
+ #[cfg(not(any(target_os = "l4re", target_os = "wasi")))]
const WRBAND = c::POLLWRBAND;
/// `POLLERR`
const ERR = c::POLLERR;
/// `POLLHUP`
const HUP = c::POLLHUP;
/// `POLLNVAL`
+ #[cfg(not(target_os = "espidf"))]
const NVAL = c::POLLNVAL;
/// `POLLRDHUP`
#[cfg(all(
diff --git a/vendor/rustix/src/backend/libc/event/syscalls.rs b/vendor/rustix/src/backend/libc/event/syscalls.rs
index 11f6af83e..eac88d4bb 100644
--- a/vendor/rustix/src/backend/libc/event/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/event/syscalls.rs
@@ -33,7 +33,19 @@ pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd>
ret_owned_fd(eventfd2(initval, bitflags_bits!(flags)))
}
- #[cfg(any(target_os = "freebsd", target_os = "illumos"))]
+ // `eventfd` was added in FreeBSD 13, so it isn't available on FreeBSD 12.
+ #[cfg(target_os = "freebsd")]
+ unsafe {
+ weakcall! {
+ fn eventfd(
+ initval: c::c_uint,
+ flags: c::c_int
+ ) -> c::c_int
+ }
+ ret_owned_fd(eventfd(initval, bitflags_bits!(flags)))
+ }
+
+ #[cfg(target_os = "illumos")]
unsafe {
ret_owned_fd(c::eventfd(initval, bitflags_bits!(flags)))
}
diff --git a/vendor/rustix/src/backend/libc/fs/dir.rs b/vendor/rustix/src/backend/libc/fs/dir.rs
index c8a4d77c9..6cfeb242b 100644
--- a/vendor/rustix/src/backend/libc/fs/dir.rs
+++ b/vendor/rustix/src/backend/libc/fs/dir.rs
@@ -1,4 +1,4 @@
-#[cfg(not(any(solarish, target_os = "haiku")))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "nto")))]
use super::types::FileType;
use crate::backend::c;
use crate::backend::conv::owned_fd;
@@ -9,6 +9,7 @@ use crate::fs::{fcntl_getfl, fstat, openat, Mode, OFlags, Stat};
solarish,
target_os = "haiku",
target_os = "netbsd",
+ target_os = "nto",
target_os = "redox",
target_os = "wasi",
)))]
@@ -94,7 +95,12 @@ impl Dir {
check_dirent_layout(dirent);
let result = DirEntry {
- #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
+ #[cfg(not(any(
+ solarish,
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "nto"
+ )))]
d_type: dirent.d_type,
#[cfg(not(any(freebsdlike, netbsdlike)))]
@@ -122,6 +128,7 @@ impl Dir {
solarish,
target_os = "haiku",
target_os = "netbsd",
+ target_os = "nto",
target_os = "redox",
target_os = "wasi",
)))]
@@ -180,7 +187,7 @@ impl fmt::Debug for Dir {
/// `struct dirent`
#[derive(Debug)]
pub struct DirEntry {
- #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
+ #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku", target_os = "nto")))]
d_type: u8,
#[cfg(not(any(freebsdlike, netbsdlike)))]
@@ -200,7 +207,7 @@ impl DirEntry {
}
/// Returns the type of this directory entry.
- #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
+ #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku", target_os = "nto")))]
#[inline]
pub fn file_type(&self) -> FileType {
FileType::from_dirent_d_type(self.d_type)
@@ -242,11 +249,13 @@ struct libc_dirent {
#[cfg(target_os = "openbsd")]
fn check_dirent_layout(dirent: &c::dirent) {
use crate::utils::as_ptr;
- use core::mem::{align_of, size_of};
// Check that the basic layouts match.
- assert_eq!(size_of::<libc_dirent>(), size_of::<c::dirent>());
- assert_eq!(align_of::<libc_dirent>(), align_of::<c::dirent>());
+ #[cfg(test)]
+ {
+ assert_eq_size!(libc_dirent, c::dirent);
+ assert_eq_size!(libc_dirent, c::dirent);
+ }
// Check that the field offsets match.
assert_eq!(
diff --git a/vendor/rustix/src/backend/libc/fs/mod.rs b/vendor/rustix/src/backend/libc/fs/mod.rs
index 28579c993..17b4da70f 100644
--- a/vendor/rustix/src/backend/libc/fs/mod.rs
+++ b/vendor/rustix/src/backend/libc/fs/mod.rs
@@ -1,8 +1,13 @@
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
pub(crate) mod dir;
#[cfg(linux_kernel)]
pub mod inotify;
-#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub(crate) mod makedev;
#[cfg(not(windows))]
pub(crate) mod syscalls;
diff --git a/vendor/rustix/src/backend/libc/fs/syscalls.rs b/vendor/rustix/src/backend/libc/fs/syscalls.rs
index bdba777e9..698bf34ad 100644
--- a/vendor/rustix/src/backend/libc/fs/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/fs/syscalls.rs
@@ -13,21 +13,24 @@ use crate::ffi::CString;
netbsdlike,
solarish,
target_os = "dragonfly",
+ target_os = "espidf",
target_os = "haiku",
target_os = "redox",
)))]
use crate::fs::Advice;
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
use crate::fs::AtFlags;
#[cfg(not(any(
netbsdlike,
solarish,
target_os = "aix",
target_os = "dragonfly",
+ target_os = "espidf",
+ target_os = "nto",
target_os = "redox",
)))]
use crate::fs::FallocateFlags;
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
use crate::fs::FlockOperation;
#[cfg(any(linux_kernel, target_os = "freebsd"))]
use crate::fs::MemfdFlags;
@@ -35,30 +38,26 @@ use crate::fs::MemfdFlags;
use crate::fs::SealFlags;
#[cfg(not(any(
solarish,
+ target_os = "espidf",
target_os = "haiku",
target_os = "netbsd",
+ target_os = "nto",
target_os = "redox",
target_os = "wasi",
)))]
use crate::fs::StatFs;
-use crate::fs::{Access, Mode, OFlags, SeekFrom, Stat, Timestamps};
-#[cfg(not(any(apple, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(target_os = "espidf"))]
+use crate::fs::{Access, Timestamps};
+#[cfg(not(any(apple, target_os = "espidf", target_os = "redox", target_os = "wasi")))]
use crate::fs::{Dev, FileType};
+use crate::fs::{Mode, OFlags, SeekFrom, Stat};
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
use crate::fs::{StatVfs, StatVfsMountFlags};
use crate::io;
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
use crate::timespec::LibcTimespec;
#[cfg(not(target_os = "wasi"))]
use crate::ugid::{Gid, Uid};
-#[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-)))]
-use crate::utils::as_ptr;
#[cfg(apple)]
use alloc::vec;
use core::mem::MaybeUninit;
@@ -75,15 +74,9 @@ use {
core::ptr::null,
};
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
weak!(fn __utimensat64(c::c_int, *const c::c_char, *const LibcTimespec, c::c_int) -> c::c_int);
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
weak!(fn __futimens64(c::c_int, *const LibcTimespec) -> c::c_int);
/// Use a direct syscall (via libc) for `open`.
@@ -91,14 +84,25 @@ weak!(fn __futimens64(c::c_int, *const LibcTimespec) -> c::c_int);
/// This is only currently necessary as a workaround for old glibc; see below.
#[cfg(all(unix, target_env = "gnu"))]
fn open_via_syscall(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result<OwnedFd> {
- // Linux on aarch64 and riscv64 has no `open` syscall so use `openat`.
- #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
+ // Linux on aarch64, loongarch64 and riscv64 has no `open` syscall so use
+ // `openat`.
+ #[cfg(any(
+ target_arch = "aarch64",
+ target_arch = "riscv32",
+ target_arch = "riscv64",
+ target_arch = "loongarch64"
+ ))]
{
openat_via_syscall(CWD, path, oflags, mode)
}
// Use the `open` syscall.
- #[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))]
+ #[cfg(not(any(
+ target_arch = "aarch64",
+ target_arch = "riscv32",
+ target_arch = "riscv64",
+ target_arch = "loongarch64"
+ )))]
unsafe {
syscall! {
fn open(
@@ -216,8 +220,10 @@ pub(crate) fn openat(
#[cfg(not(any(
solarish,
+ target_os = "espidf",
target_os = "haiku",
target_os = "netbsd",
+ target_os = "nto",
target_os = "redox",
target_os = "wasi",
)))]
@@ -243,11 +249,9 @@ pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
#[inline]
pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
unsafe {
- ret_usize(c::readlink(
- c_str(path),
- buf.as_mut_ptr().cast::<c::c_char>(),
- buf.len(),
- ))
+ ret_usize(
+ c::readlink(c_str(path), buf.as_mut_ptr().cast::<c::c_char>(), buf.len()) as isize,
+ )
}
}
@@ -264,7 +268,7 @@ pub(crate) fn readlinkat(
c_str(path),
buf.as_mut_ptr().cast::<c::c_char>(),
buf.len(),
- ))
+ ) as isize)
}
}
@@ -308,7 +312,7 @@ pub(crate) fn link(old_path: &CStr, new_path: &CStr) -> io::Result<()> {
unsafe { ret(c::link(c_str(old_path), c_str(new_path))) }
}
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
pub(crate) fn linkat(
old_dirfd: BorrowedFd<'_>,
old_path: &CStr,
@@ -371,7 +375,7 @@ pub(crate) fn unlink(path: &CStr) -> io::Result<()> {
unsafe { ret(c::unlink(c_str(path))) }
}
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
pub(crate) fn unlinkat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<()> {
// macOS <= 10.9 lacks `unlinkat`.
#[cfg(target_os = "macos")]
@@ -533,7 +537,14 @@ pub(crate) fn symlinkat(
pub(crate) fn stat(path: &CStr) -> io::Result<Stat> {
// See the comments in `fstat` about using `crate::fs::statx` here.
- #[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))]
+ #[cfg(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+ ))]
{
match crate::fs::statx(
crate::fs::CWD,
@@ -549,7 +560,14 @@ pub(crate) fn stat(path: &CStr) -> io::Result<Stat> {
// Main version: libc is y2038 safe. Or, the platform is not y2038 safe and
// there's nothing practical we can do.
- #[cfg(not(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64"))))]
+ #[cfg(not(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+ )))]
unsafe {
let mut stat = MaybeUninit::<Stat>::uninit();
ret(c::stat(c_str(path), stat.as_mut_ptr()))?;
@@ -559,7 +577,14 @@ pub(crate) fn stat(path: &CStr) -> io::Result<Stat> {
pub(crate) fn lstat(path: &CStr) -> io::Result<Stat> {
// See the comments in `fstat` about using `crate::fs::statx` here.
- #[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))]
+ #[cfg(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+ ))]
{
match crate::fs::statx(
crate::fs::CWD,
@@ -568,14 +593,21 @@ pub(crate) fn lstat(path: &CStr) -> io::Result<Stat> {
StatxFlags::BASIC_STATS,
) {
Ok(x) => statx_to_stat(x),
- Err(io::Errno::NOSYS) => statat_old(crate::fs::CWD, path, AtFlags::empty()),
+ Err(io::Errno::NOSYS) => statat_old(crate::fs::CWD, path, AtFlags::SYMLINK_NOFOLLOW),
Err(err) => Err(err),
}
}
// Main version: libc is y2038 safe. Or, the platform is not y2038 safe and
// there's nothing practical we can do.
- #[cfg(not(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64"))))]
+ #[cfg(not(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+ )))]
unsafe {
let mut stat = MaybeUninit::<Stat>::uninit();
ret(c::lstat(c_str(path), stat.as_mut_ptr()))?;
@@ -583,10 +615,17 @@ pub(crate) fn lstat(path: &CStr) -> io::Result<Stat> {
}
}
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<Stat> {
// See the comments in `fstat` about using `crate::fs::statx` here.
- #[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))]
+ #[cfg(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+ ))]
{
match crate::fs::statx(dirfd, path, flags, StatxFlags::BASIC_STATS) {
Ok(x) => statx_to_stat(x),
@@ -597,7 +636,14 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::
// Main version: libc is y2038 safe. Or, the platform is not y2038 safe and
// there's nothing practical we can do.
- #[cfg(not(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64"))))]
+ #[cfg(not(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+ )))]
unsafe {
let mut stat = MaybeUninit::<Stat>::uninit();
ret(c::fstatat(
@@ -610,7 +656,14 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::
}
}
-#[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))]
+#[cfg(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+))]
fn statat_old(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<Stat> {
unsafe {
let mut result = MaybeUninit::<c::stat64>::uninit();
@@ -624,12 +677,12 @@ fn statat_old(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<
}
}
-#[cfg(not(target_os = "emscripten"))]
+#[cfg(not(any(target_os = "espidf", target_os = "emscripten")))]
pub(crate) fn access(path: &CStr, access: Access) -> io::Result<()> {
unsafe { ret(c::access(c_str(path), access.bits())) }
}
-#[cfg(not(any(target_os = "emscripten", target_os = "redox")))]
+#[cfg(not(any(target_os = "emscripten", target_os = "espidf", target_os = "redox")))]
pub(crate) fn accessat(
dirfd: BorrowedFd<'_>,
path: &CStr,
@@ -695,47 +748,43 @@ pub(crate) fn accessat(
Ok(())
}
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
pub(crate) fn utimensat(
dirfd: BorrowedFd<'_>,
path: &CStr,
times: &Timestamps,
flags: AtFlags,
) -> io::Result<()> {
- // 32-bit gnu version: libc has `utimensat` but it is not y2038 safe by
- // default.
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
- unsafe {
+ // Old 32-bit version: libc has `utimensat` but it is not y2038 safe by
+ // default. But there may be a `__utimensat16` we can use.
+ #[cfg(fix_y2038)]
+ {
+ #[cfg(target_env = "gnu")]
if let Some(libc_utimensat) = __utimensat64.get() {
let libc_times: [LibcTimespec; 2] = [
times.last_access.clone().into(),
times.last_modification.clone().into(),
];
- ret(libc_utimensat(
- borrowed_fd(dirfd),
- c_str(path),
- libc_times.as_ptr(),
- bitflags_bits!(flags),
- ))
- } else {
- utimensat_old(dirfd, path, times, flags)
+ unsafe {
+ return ret(libc_utimensat(
+ borrowed_fd(dirfd),
+ c_str(path),
+ libc_times.as_ptr(),
+ bitflags_bits!(flags),
+ ));
+ }
}
+
+ utimensat_old(dirfd, path, times, flags)
}
// Main version: libc is y2038 safe and has `utimensat`. Or, the platform
// is not y2038 safe and there's nothing practical we can do.
- #[cfg(not(any(
- apple,
- all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )
- )))]
+ #[cfg(not(any(apple, fix_y2038)))]
unsafe {
+ use crate::utils::as_ptr;
+
// Assert that `Timestamps` has the expected layout.
let _ = core::mem::transmute::<Timestamps, [c::timespec; 2]>(times.clone());
@@ -747,9 +796,11 @@ pub(crate) fn utimensat(
))
}
- // `utimensat` was introduced in macOS 10.13.
+ // Apple version: `utimensat` was introduced in macOS 10.13.
#[cfg(apple)]
unsafe {
+ use crate::utils::as_ptr;
+
// ABI details
weak! {
fn utimensat(
@@ -863,11 +914,8 @@ pub(crate) fn utimensat(
}
}
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
-unsafe fn utimensat_old(
+#[cfg(fix_y2038)]
+fn utimensat_old(
dirfd: BorrowedFd<'_>,
path: &CStr,
times: &Timestamps,
@@ -891,12 +939,14 @@ unsafe fn utimensat_old(
tv_nsec: times.last_modification.tv_nsec,
},
];
- ret(c::utimensat(
- borrowed_fd(dirfd),
- c_str(path),
- old_times.as_ptr(),
- bitflags_bits!(flags),
- ))
+ unsafe {
+ ret(c::utimensat(
+ borrowed_fd(dirfd),
+ c_str(path),
+ old_times.as_ptr(),
+ bitflags_bits!(flags),
+ ))
+ }
}
#[cfg(not(target_os = "wasi"))]
@@ -904,7 +954,12 @@ pub(crate) fn chmod(path: &CStr, mode: Mode) -> io::Result<()> {
unsafe { ret(c::chmod(c_str(path), mode.bits() as c::mode_t)) }
}
-#[cfg(not(any(linux_kernel, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ linux_kernel,
+ target_os = "espidf",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub(crate) fn chmodat(
dirfd: BorrowedFd<'_>,
path: &CStr,
@@ -982,7 +1037,7 @@ pub(crate) fn fclonefileat(
}
}
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "wasi")))]
pub(crate) fn chownat(
dirfd: BorrowedFd<'_>,
path: &CStr,
@@ -1002,7 +1057,7 @@ pub(crate) fn chownat(
}
}
-#[cfg(not(any(apple, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(apple, target_os = "espidf", target_os = "redox", target_os = "wasi")))]
pub(crate) fn mknodat(
dirfd: BorrowedFd<'_>,
path: &CStr,
@@ -1039,7 +1094,8 @@ pub(crate) fn copy_file_range(
) via SYS_copy_file_range -> c::ssize_t
}
- assert_eq!(size_of::<c::loff_t>(), size_of::<u64>());
+ #[cfg(test)]
+ assert_eq_size!(c::loff_t, u64);
let mut off_in_val: c::loff_t = 0;
let mut off_out_val: c::loff_t = 0;
@@ -1080,6 +1136,7 @@ pub(crate) fn copy_file_range(
netbsdlike,
solarish,
target_os = "dragonfly",
+ target_os = "espidf",
target_os = "haiku",
target_os = "redox",
)))]
@@ -1135,6 +1192,7 @@ pub(crate) fn fcntl_add_seals(fd: BorrowedFd<'_>, seals: SealFlags) -> io::Resul
#[cfg(not(any(
target_os = "emscripten",
+ target_os = "espidf",
target_os = "fuchsia",
target_os = "redox",
target_os = "wasi"
@@ -1168,7 +1226,7 @@ pub(crate) fn fcntl_lock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::R
}
pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result<u64> {
- let (whence, offset): (c::c_int, c::off_t) = match pos {
+ let (whence, offset) = match pos {
SeekFrom::Start(pos) => {
let pos: u64 = pos;
// Silently cast; we'll get `EINVAL` if the value is negative.
@@ -1181,6 +1239,11 @@ pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result<u64> {
#[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
SeekFrom::Hole(offset) => (c::SEEK_HOLE, offset),
};
+
+ // ESP-IDF doesn't support 64-bit offsets.
+ #[cfg(target_os = "espidf")]
+ let offset: i32 = offset.try_into().map_err(|_| io::Errno::OVERFLOW)?;
+
let offset = unsafe { ret_off_t(c::lseek(borrowed_fd(fd), offset, whence))? };
Ok(offset as u64)
}
@@ -1237,7 +1300,7 @@ pub(crate) fn fchown(fd: BorrowedFd<'_>, owner: Option<Uid>, group: Option<Gid>)
}
}
-#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
+#[cfg(not(any(target_os = "espidf", target_os = "solaris", target_os = "wasi")))]
pub(crate) fn flock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::Result<()> {
unsafe { ret(c::flock(borrowed_fd(fd), operation as c::c_int)) }
}
@@ -1259,7 +1322,7 @@ pub(crate) fn syncfs(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(syncfs(borrowed_fd(fd))) }
}
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "wasi")))]
pub(crate) fn sync() {
unsafe { c::sync() }
}
@@ -1271,7 +1334,14 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result<Stat> {
// And, some old platforms don't support `statx`, and some fail with a
// confusing error code, so we call `crate::fs::statx` to handle that. If
// `statx` isn't available, fall back to the buggy system call.
- #[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))]
+ #[cfg(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+ ))]
{
match crate::fs::statx(fd, cstr!(""), AtFlags::EMPTY_PATH, StatxFlags::BASIC_STATS) {
Ok(x) => statx_to_stat(x),
@@ -1282,7 +1352,14 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result<Stat> {
// Main version: libc is y2038 safe. Or, the platform is not y2038 safe and
// there's nothing practical we can do.
- #[cfg(not(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64"))))]
+ #[cfg(not(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+ )))]
unsafe {
let mut stat = MaybeUninit::<Stat>::uninit();
ret(c::fstat(borrowed_fd(fd), stat.as_mut_ptr()))?;
@@ -1290,7 +1367,14 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result<Stat> {
}
}
-#[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))]
+#[cfg(all(
+ linux_kernel,
+ any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+))]
fn fstat_old(fd: BorrowedFd<'_>) -> io::Result<Stat> {
unsafe {
let mut result = MaybeUninit::<c::stat64>::uninit();
@@ -1301,8 +1385,10 @@ fn fstat_old(fd: BorrowedFd<'_>) -> io::Result<Stat> {
#[cfg(not(any(
solarish,
+ target_os = "espidf",
target_os = "haiku",
target_os = "netbsd",
+ target_os = "nto",
target_os = "redox",
target_os = "wasi",
)))]
@@ -1340,44 +1426,44 @@ fn libc_statvfs_to_statvfs(from: c::statvfs) -> StatVfs {
}
}
+#[cfg(not(target_os = "espidf"))]
pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> {
- // 32-bit gnu version: libc has `futimens` but it is not y2038 safe by default.
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
- unsafe {
+ // Old 32-bit version: libc has `futimens` but it is not y2038 safe by
+ // default. But there may be a `__futimens64` we can use.
+ #[cfg(fix_y2038)]
+ {
+ #[cfg(target_env = "gnu")]
if let Some(libc_futimens) = __futimens64.get() {
let libc_times: [LibcTimespec; 2] = [
times.last_access.clone().into(),
times.last_modification.clone().into(),
];
- ret(libc_futimens(borrowed_fd(fd), libc_times.as_ptr()))
- } else {
- futimens_old(fd, times)
+ unsafe {
+ return ret(libc_futimens(borrowed_fd(fd), libc_times.as_ptr()));
+ }
}
+
+ futimens_old(fd, times)
}
// Main version: libc is y2038 safe and has `futimens`. Or, the platform
// is not y2038 safe and there's nothing practical we can do.
- #[cfg(not(any(
- apple,
- all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )
- )))]
+ #[cfg(not(any(apple, fix_y2038)))]
unsafe {
+ use crate::utils::as_ptr;
+
// Assert that `Timestamps` has the expected layout.
let _ = core::mem::transmute::<Timestamps, [c::timespec; 2]>(times.clone());
ret(c::futimens(borrowed_fd(fd), as_ptr(times).cast()))
}
- // `futimens` was introduced in macOS 10.13.
+ // Apple version: `futimens` was introduced in macOS 10.13.
#[cfg(apple)]
unsafe {
+ use crate::utils::as_ptr;
+
// ABI details.
weak! {
fn futimens(c::c_int, *const c::timespec) -> c::c_int
@@ -1413,11 +1499,8 @@ pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()>
}
}
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
-unsafe fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> {
+#[cfg(fix_y2038)]
+fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> {
let old_times = [
c::timespec {
tv_sec: times
@@ -1437,7 +1520,7 @@ unsafe fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()>
},
];
- ret(c::futimens(borrowed_fd(fd), old_times.as_ptr()))
+ unsafe { ret(c::futimens(borrowed_fd(fd), old_times.as_ptr())) }
}
#[cfg(not(any(
@@ -1446,6 +1529,8 @@ unsafe fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()>
solarish,
target_os = "aix",
target_os = "dragonfly",
+ target_os = "espidf",
+ target_os = "nto",
target_os = "redox",
)))]
pub(crate) fn fallocate(
@@ -1520,6 +1605,7 @@ pub(crate) fn fsync(fd: BorrowedFd<'_>) -> io::Result<()> {
#[cfg(not(any(
apple,
target_os = "dragonfly",
+ target_os = "espidf",
target_os = "haiku",
target_os = "redox",
)))]
@@ -1648,7 +1734,7 @@ fn statx_to_stat(x: crate::fs::Statx) -> io::Result<Stat> {
/// Convert from a Linux `statx` value to rustix's `Stat`.
///
/// mips64' `struct stat64` in libc has private fields, and `stx_blocks`
-#[cfg(all(linux_kernel, target_arch = "mips64"))]
+#[cfg(all(linux_kernel, any(target_arch = "mips64", target_arch = "mips64r6")))]
fn statx_to_stat(x: crate::fs::Statx) -> io::Result<Stat> {
let mut result: Stat = unsafe { core::mem::zeroed() };
@@ -1720,7 +1806,7 @@ fn stat64_to_stat(s64: c::stat64) -> io::Result<Stat> {
///
/// mips64' `struct stat64` in libc has private fields, and `st_blocks` has
/// type `i64`.
-#[cfg(all(linux_kernel, target_arch = "mips64"))]
+#[cfg(all(linux_kernel, any(target_arch = "mips64", target_arch = "mips64r6")))]
fn stat64_to_stat(s64: c::stat64) -> io::Result<Stat> {
let mut result: Stat = unsafe { core::mem::zeroed() };
@@ -1962,6 +2048,22 @@ pub(crate) fn fcntl_fullfsync(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_FULLFSYNC)) }
}
+#[cfg(apple)]
+pub(crate) fn fcntl_nocache(fd: BorrowedFd, value: bool) -> io::Result<()> {
+ unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_NOCACHE, value as c::c_int)) }
+}
+
+#[cfg(apple)]
+pub(crate) fn fcntl_global_nocache(fd: BorrowedFd, value: bool) -> io::Result<()> {
+ unsafe {
+ ret(c::fcntl(
+ borrowed_fd(fd),
+ c::F_GLOBAL_NOCACHE,
+ value as c::c_int,
+ ))
+ }
+}
+
/// Convert `times` from a `futimens`/`utimensat` argument into `setattrlist`
/// arguments.
#[cfg(apple)]
@@ -2048,30 +2150,6 @@ struct Attrlist {
forkattr: Attrgroup,
}
-#[cfg(linux_kernel)]
-pub(crate) fn mount(
- source: Option<&CStr>,
- target: &CStr,
- file_system_type: Option<&CStr>,
- flags: super::types::MountFlagsArg,
- data: Option<&CStr>,
-) -> io::Result<()> {
- unsafe {
- ret(c::mount(
- source.map_or_else(null, CStr::as_ptr),
- target.as_ptr(),
- file_system_type.map_or_else(null, CStr::as_ptr),
- flags.0,
- data.map_or_else(null, CStr::as_ptr).cast(),
- ))
- }
-}
-
-#[cfg(linux_kernel)]
-pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> {
- unsafe { ret(c::umount2(target.as_ptr(), bitflags_bits!(flags))) }
-}
-
#[cfg(any(apple, linux_kernel))]
pub(crate) fn getxattr(path: &CStr, name: &CStr, value: &mut [u8]) -> io::Result<usize> {
let value_ptr = value.as_mut_ptr();
diff --git a/vendor/rustix/src/backend/libc/fs/types.rs b/vendor/rustix/src/backend/libc/fs/types.rs
index b52f0e210..955bdaa29 100644
--- a/vendor/rustix/src/backend/libc/fs/types.rs
+++ b/vendor/rustix/src/backend/libc/fs/types.rs
@@ -1,6 +1,7 @@
use crate::backend::c;
use bitflags::bitflags;
+#[cfg(not(target_os = "espidf"))]
bitflags! {
/// `*_OK` constants for use with [`accessat`].
///
@@ -22,7 +23,7 @@ bitflags! {
}
}
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
bitflags! {
/// `AT_*` constants for use with [`openat`], [`statat`], and other `*at`
/// functions.
@@ -85,67 +86,68 @@ bitflags! {
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct Mode: RawMode {
/// `S_IRWXU`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const RWXU = c::S_IRWXU as RawMode;
/// `S_IRUSR`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const RUSR = c::S_IRUSR as RawMode;
/// `S_IWUSR`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const WUSR = c::S_IWUSR as RawMode;
/// `S_IXUSR`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const XUSR = c::S_IXUSR as RawMode;
/// `S_IRWXG`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const RWXG = c::S_IRWXG as RawMode;
/// `S_IRGRP`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const RGRP = c::S_IRGRP as RawMode;
/// `S_IWGRP`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const WGRP = c::S_IWGRP as RawMode;
/// `S_IXGRP`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const XGRP = c::S_IXGRP as RawMode;
/// `S_IRWXO`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const RWXO = c::S_IRWXO as RawMode;
/// `S_IROTH`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const ROTH = c::S_IROTH as RawMode;
/// `S_IWOTH`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const WOTH = c::S_IWOTH as RawMode;
/// `S_IXOTH`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const XOTH = c::S_IXOTH as RawMode;
/// `S_ISUID`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const SUID = c::S_ISUID as RawMode;
/// `S_ISGID`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const SGID = c::S_ISGID as RawMode;
/// `S_ISVTX`
- #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
const SVTX = c::S_ISVTX as RawMode;
}
}
+#[cfg(not(target_os = "espidf"))]
impl Mode {
/// Construct a `Mode` from the mode bits of the `st_mode` field of a
/// `Stat`.
@@ -161,6 +163,7 @@ impl Mode {
}
}
+#[cfg(not(target_os = "espidf"))]
impl From<RawMode> for Mode {
/// Support conversions from raw mode values to `Mode`.
///
@@ -174,6 +177,7 @@ impl From<RawMode> for Mode {
}
}
+#[cfg(not(target_os = "espidf"))]
impl From<Mode> for RawMode {
/// Support conversions from `Mode` to raw mode values.
///
@@ -214,10 +218,11 @@ bitflags! {
const CREATE = bitcast!(c::O_CREAT);
/// `O_DIRECTORY`
+ #[cfg(not(target_os = "espidf"))]
const DIRECTORY = bitcast!(c::O_DIRECTORY);
/// `O_DSYNC`
- #[cfg(not(any(target_os = "dragonfly", target_os = "redox")))]
+ #[cfg(not(any(target_os = "dragonfly", target_os = "espidf", target_os = "l4re", target_os = "redox")))]
const DSYNC = bitcast!(c::O_DSYNC);
/// `O_EXCL`
@@ -231,6 +236,7 @@ bitflags! {
const FSYNC = bitcast!(c::O_FSYNC);
/// `O_NOFOLLOW`
+ #[cfg(not(target_os = "espidf"))]
const NOFOLLOW = bitcast!(c::O_NOFOLLOW);
/// `O_NONBLOCK`
@@ -246,7 +252,7 @@ bitflags! {
const RDWR = bitcast!(c::O_RDWR);
/// `O_NOCTTY`
- #[cfg(not(target_os = "redox"))]
+ #[cfg(not(any(target_os = "espidf", target_os = "l4re", target_os = "redox")))]
const NOCTTY = bitcast!(c::O_NOCTTY);
/// `O_RSYNC`
@@ -259,7 +265,7 @@ bitflags! {
const RSYNC = bitcast!(c::O_RSYNC);
/// `O_SYNC`
- #[cfg(not(target_os = "redox"))]
+ #[cfg(not(any(target_os = "l4re", target_os = "redox")))]
const SYNC = bitcast!(c::O_SYNC);
/// `O_TRUNC`
@@ -489,7 +495,13 @@ impl FileType {
}
/// Construct a `FileType` from the `d_type` field of a `c::dirent`.
- #[cfg(not(any(solarish, target_os = "haiku", target_os = "redox")))]
+ #[cfg(not(any(
+ solarish,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto",
+ target_os = "redox"
+ )))]
#[inline]
pub(crate) const fn from_dirent_d_type(d_type: u8) -> Self {
match d_type {
@@ -516,6 +528,7 @@ impl FileType {
netbsdlike,
solarish,
target_os = "dragonfly",
+ target_os = "espidf",
target_os = "haiku",
target_os = "redox",
)))]
@@ -725,7 +738,14 @@ bitflags! {
}
}
-#[cfg(not(any(netbsdlike, solarish, target_os = "aix", target_os = "redox")))]
+#[cfg(not(any(
+ netbsdlike,
+ solarish,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "nto",
+ target_os = "redox"
+)))]
bitflags! {
/// `FALLOC_FL_*` constants for use with [`fallocate`].
///
@@ -753,10 +773,11 @@ bitflags! {
#[cfg(not(any(
bsd,
target_os = "aix",
- target_os = "haiku",
- target_os = "linux",
target_os = "emscripten",
target_os = "fuchsia",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "linux",
target_os = "wasi",
)))]
const NO_HIDE_STALE = bitcast!(c::FALLOC_FL_NO_HIDE_STALE);
@@ -831,9 +852,11 @@ bitflags! {
const NOEXEC = c::ST_NOEXEC as u64;
/// `ST_NOSUID`
+ #[cfg(not(target_os = "espidf"))]
const NOSUID = c::ST_NOSUID as u64;
/// `ST_RDONLY`
+ #[cfg(not(target_os = "espidf"))]
const RDONLY = c::ST_RDONLY as u64;
/// `ST_RELATIME`
@@ -850,7 +873,7 @@ bitflags! {
///
/// [`flock`]: crate::fs::flock
/// [`fcntl_lock`]: crate::fs::fcntl_lock
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u32)]
pub enum FlockOperation {
@@ -923,8 +946,10 @@ pub struct Stat {
#[cfg(not(any(
linux_like,
solarish,
+ target_os = "espidf",
target_os = "haiku",
target_os = "netbsd",
+ target_os = "nto",
target_os = "redox",
target_os = "wasi",
)))]
@@ -1062,10 +1087,16 @@ pub type FsWord = u32;
pub type FsWord = u64;
/// `__fsword_t`
-// s390x uses `u32` for `statfs` entries, even though `__fsword_t` is `u64`.
-#[cfg(all(target_os = "linux", target_arch = "s390x"))]
+// s390x uses `u32` for `statfs` entries on glibc, even though `__fsword_t` is
+// `u64`.
+#[cfg(all(target_os = "linux", target_arch = "s390x", target_env = "gnu"))]
pub type FsWord = u32;
+/// `__fsword_t`
+// s390x uses `u64` for `statfs` entries on musl.
+#[cfg(all(target_os = "linux", target_arch = "s390x", target_env = "musl"))]
+pub type FsWord = u64;
+
/// `copyfile_state_t`—State for use with [`fcopyfile`].
///
/// [`fcopyfile`]: crate::fs::fcopyfile
@@ -1074,112 +1105,3 @@ pub type FsWord = u32;
#[repr(transparent)]
#[derive(Copy, Clone)]
pub struct copyfile_state_t(pub(crate) *mut c::c_void);
-
-#[cfg(linux_kernel)]
-bitflags! {
- /// `MS_*` constants for use with [`mount`].
- ///
- /// [`mount`]: crate::fs::mount
- #[repr(transparent)]
- #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub struct MountFlags: c::c_ulong {
- /// `MS_BIND`
- const BIND = c::MS_BIND;
-
- /// `MS_DIRSYNC`
- const DIRSYNC = c::MS_DIRSYNC;
-
- /// `MS_LAZYTIME`
- const LAZYTIME = c::MS_LAZYTIME;
-
- /// `MS_MANDLOCK`
- #[doc(alias = "MANDLOCK")]
- const PERMIT_MANDATORY_FILE_LOCKING = c::MS_MANDLOCK;
-
- /// `MS_NOATIME`
- const NOATIME = c::MS_NOATIME;
-
- /// `MS_NODEV`
- const NODEV = c::MS_NODEV;
-
- /// `MS_NODIRATIME`
- const NODIRATIME = c::MS_NODIRATIME;
-
- /// `MS_NOEXEC`
- const NOEXEC = c::MS_NOEXEC;
-
- /// `MS_NOSUID`
- const NOSUID = c::MS_NOSUID;
-
- /// `MS_RDONLY`
- const RDONLY = c::MS_RDONLY;
-
- /// `MS_REC`
- const REC = c::MS_REC;
-
- /// `MS_RELATIME`
- const RELATIME = c::MS_RELATIME;
-
- /// `MS_SILENT`
- const SILENT = c::MS_SILENT;
-
- /// `MS_STRICTATIME`
- const STRICTATIME = c::MS_STRICTATIME;
-
- /// `MS_SYNCHRONOUS`
- const SYNCHRONOUS = c::MS_SYNCHRONOUS;
- }
-}
-
-#[cfg(linux_kernel)]
-bitflags! {
- /// `MS_*` constants for use with [`change_mount`].
- ///
- /// [`change_mount`]: crate::fs::mount::change_mount
- #[repr(transparent)]
- #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub struct MountPropagationFlags: c::c_ulong {
- /// `MS_SHARED`
- const SHARED = c::MS_SHARED;
- /// `MS_PRIVATE`
- const PRIVATE = c::MS_PRIVATE;
- /// `MS_SLAVE`
- const SLAVE = c::MS_SLAVE;
- /// `MS_UNBINDABLE`
- const UNBINDABLE = c::MS_UNBINDABLE;
- /// `MS_REC`
- const REC = c::MS_REC;
- }
-}
-
-#[cfg(linux_kernel)]
-bitflags! {
- #[repr(transparent)]
- #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub(crate) struct InternalMountFlags: c::c_ulong {
- const REMOUNT = c::MS_REMOUNT;
- const MOVE = c::MS_MOVE;
- }
-}
-
-#[cfg(linux_kernel)]
-pub(crate) struct MountFlagsArg(pub(crate) c::c_ulong);
-
-#[cfg(linux_kernel)]
-bitflags! {
- /// `MNT_*` constants for use with [`unmount`].
- ///
- /// [`unmount`]: crate::fs::mount::unmount
- #[repr(transparent)]
- #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub struct UnmountFlags: u32 {
- /// `MNT_FORCE`
- const FORCE = bitcast!(c::MNT_FORCE);
- /// `MNT_DETACH`
- const DETACH = bitcast!(c::MNT_DETACH);
- /// `MNT_EXPIRE`
- const EXPIRE = bitcast!(c::MNT_EXPIRE);
- /// `UMOUNT_NOFOLLOW`
- const NOFOLLOW = bitcast!(c::UMOUNT_NOFOLLOW);
- }
-}
diff --git a/vendor/rustix/src/backend/libc/io/errno.rs b/vendor/rustix/src/backend/libc/io/errno.rs
index 71fba49e9..aabd45f8c 100644
--- a/vendor/rustix/src/backend/libc/io/errno.rs
+++ b/vendor/rustix/src/backend/libc/io/errno.rs
@@ -28,15 +28,19 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const ADV: Self = Self(c::EADV);
/// `EAFNOSUPPORT`
+ #[cfg(not(target_os = "l4re"))]
pub const AFNOSUPPORT: Self = Self(c::EAFNOSUPPORT);
/// `EAGAIN`
pub const AGAIN: Self = Self(c::EAGAIN);
/// `EALREADY`
+ #[cfg(not(target_os = "l4re"))]
pub const ALREADY: Self = Self(c::EALREADY);
/// `EAUTH`
#[cfg(bsd)]
@@ -46,7 +50,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const BADE: Self = Self(c::EBADE);
@@ -57,19 +63,23 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const BADFD: Self = Self(c::EBADFD);
/// `EBADMSG`
- #[cfg(not(windows))]
+ #[cfg(not(any(windows, target_os = "l4re")))]
pub const BADMSG: Self = Self(c::EBADMSG);
/// `EBADR`
#[cfg(not(any(
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const BADR: Self = Self(c::EBADR);
@@ -81,7 +91,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const BADRQC: Self = Self(c::EBADRQC);
@@ -90,7 +102,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const BADSLT: Self = Self(c::EBADSLT);
@@ -99,7 +113,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const BFONT: Self = Self(c::EBFONT);
@@ -107,6 +123,7 @@ impl Errno {
#[cfg(not(windows))]
pub const BUSY: Self = Self(c::EBUSY);
/// `ECANCELED`
+ #[cfg(not(target_os = "l4re"))]
pub const CANCELED: Self = Self(c::ECANCELED);
/// `ECAPMODE`
#[cfg(target_os = "freebsd")]
@@ -115,14 +132,23 @@ impl Errno {
#[cfg(not(windows))]
pub const CHILD: Self = Self(c::ECHILD);
/// `ECHRNG`
- #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ bsd,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const CHRNG: Self = Self(c::ECHRNG);
/// `ECOMM`
#[cfg(not(any(
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const COMM: Self = Self(c::ECOMM);
@@ -141,11 +167,13 @@ impl Errno {
windows,
target_os = "aix",
target_os = "android",
+ target_os = "espidf",
target_os = "haiku",
target_os = "wasi",
)))]
pub const DEADLOCK: Self = Self(c::EDEADLOCK);
/// `EDESTADDRREQ`
+ #[cfg(not(target_os = "l4re"))]
pub const DESTADDRREQ: Self = Self(c::EDESTADDRREQ);
/// `EDISCON`
#[cfg(windows)]
@@ -162,7 +190,10 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const DOTDOT: Self = Self(c::EDOTDOT);
@@ -180,7 +211,7 @@ impl Errno {
#[cfg(any(bsd, target_env = "newlib"))]
pub const FTYPE: Self = Self(c::EFTYPE);
/// `EHOSTDOWN`
- #[cfg(not(target_os = "wasi"))]
+ #[cfg(not(any(target_os = "l4re", target_os = "wasi")))]
pub const HOSTDOWN: Self = Self(c::EHOSTDOWN);
/// `EHOSTUNREACH`
pub const HOSTUNREACH: Self = Self(c::EHOSTUNREACH);
@@ -191,18 +222,22 @@ impl Errno {
windows,
target_os = "aix",
target_os = "android",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "redox",
target_os = "wasi",
)))]
pub const HWPOISON: Self = Self(c::EHWPOISON);
/// `EIDRM`
- #[cfg(not(windows))]
+ #[cfg(not(any(windows, target_os = "l4re")))]
pub const IDRM: Self = Self(c::EIDRM);
/// `EILSEQ`
- #[cfg(not(windows))]
+ #[cfg(not(any(windows, target_os = "l4re")))]
pub const ILSEQ: Self = Self(c::EILSEQ);
/// `EINPROGRESS`
+ #[cfg(not(target_os = "l4re"))]
pub const INPROGRESS: Self = Self(c::EINPROGRESS);
/// `EINTR`
///
@@ -223,6 +258,7 @@ impl Errno {
#[cfg(not(windows))]
pub const IO: Self = Self(c::EIO);
/// `EISCONN`
+ #[cfg(not(target_os = "l4re"))]
pub const ISCONN: Self = Self(c::EISCONN);
/// `EISDIR`
#[cfg(not(windows))]
@@ -233,7 +269,10 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const ISNAM: Self = Self(c::EISNAM);
@@ -243,7 +282,10 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const KEYEXPIRED: Self = Self(c::EKEYEXPIRED);
@@ -253,7 +295,10 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const KEYREJECTED: Self = Self(c::EKEYREJECTED);
@@ -263,28 +308,61 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const KEYREVOKED: Self = Self(c::EKEYREVOKED);
/// `EL2HLT`
- #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ bsd,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const L2HLT: Self = Self(c::EL2HLT);
/// `EL2NSYNC`
- #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ bsd,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const L2NSYNC: Self = Self(c::EL2NSYNC);
/// `EL3HLT`
- #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ bsd,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const L3HLT: Self = Self(c::EL3HLT);
/// `EL3RST`
- #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ bsd,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const L3RST: Self = Self(c::EL3RST);
/// `ELIBACC`
#[cfg(not(any(
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const LIBACC: Self = Self(c::ELIBACC);
@@ -293,7 +371,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const LIBBAD: Self = Self(c::ELIBBAD);
@@ -302,7 +382,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const LIBEXEC: Self = Self(c::ELIBEXEC);
@@ -311,7 +393,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const LIBMAX: Self = Self(c::ELIBMAX);
@@ -320,12 +404,21 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const LIBSCN: Self = Self(c::ELIBSCN);
/// `ELNRNG`
- #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ bsd,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const LNRNG: Self = Self(c::ELNRNG);
/// `ELOOP`
pub const LOOP: Self = Self(c::ELOOP);
@@ -335,7 +428,10 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const MEDIUMTYPE: Self = Self(c::EMEDIUMTYPE);
@@ -345,9 +441,10 @@ impl Errno {
#[cfg(not(windows))]
pub const MLINK: Self = Self(c::EMLINK);
/// `EMSGSIZE`
+ #[cfg(not(target_os = "l4re"))]
pub const MSGSIZE: Self = Self(c::EMSGSIZE);
/// `EMULTIHOP`
- #[cfg(not(any(windows, target_os = "openbsd")))]
+ #[cfg(not(any(windows, target_os = "l4re", target_os = "openbsd")))]
pub const MULTIHOP: Self = Self(c::EMULTIHOP);
/// `ENAMETOOLONG`
pub const NAMETOOLONG: Self = Self(c::ENAMETOOLONG);
@@ -357,7 +454,10 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const NAVAIL: Self = Self(c::ENAVAIL);
@@ -367,6 +467,7 @@ impl Errno {
/// `ENETDOWN`
pub const NETDOWN: Self = Self(c::ENETDOWN);
/// `ENETRESET`
+ #[cfg(not(target_os = "l4re"))]
pub const NETRESET: Self = Self(c::ENETRESET);
/// `ENETUNREACH`
pub const NETUNREACH: Self = Self(c::ENETUNREACH);
@@ -378,7 +479,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const NOANO: Self = Self(c::ENOANO);
@@ -386,9 +489,17 @@ impl Errno {
#[cfg(any(bsd, target_os = "haiku"))]
pub const NOATTR: Self = Self(c::ENOATTR);
/// `ENOBUFS`
+ #[cfg(not(target_os = "l4re"))]
pub const NOBUFS: Self = Self(c::ENOBUFS);
/// `ENOCSI`
- #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ bsd,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const NOCSI: Self = Self(c::ENOCSI);
/// `ENODATA`
#[cfg(not(any(
@@ -414,15 +525,18 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const NOKEY: Self = Self(c::ENOKEY);
/// `ENOLCK`
- #[cfg(not(windows))]
+ #[cfg(not(any(windows, target_os = "l4re")))]
pub const NOLCK: Self = Self(c::ENOLCK);
/// `ENOLINK`
- #[cfg(not(any(windows, target_os = "openbsd")))]
+ #[cfg(not(any(windows, target_os = "l4re", target_os = "openbsd")))]
pub const NOLINK: Self = Self(c::ENOLINK);
/// `ENOMEDIUM`
#[cfg(not(any(
@@ -430,7 +544,10 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const NOMEDIUM: Self = Self(c::ENOMEDIUM);
@@ -441,14 +558,16 @@ impl Errno {
#[cfg(windows)]
pub const NOMORE: Self = Self(c::ENOMORE);
/// `ENOMSG`
- #[cfg(not(windows))]
+ #[cfg(not(any(windows, target_os = "l4re")))]
pub const NOMSG: Self = Self(c::ENOMSG);
/// `ENONET`
#[cfg(not(any(
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const NONET: Self = Self(c::ENONET);
@@ -457,11 +576,14 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const NOPKG: Self = Self(c::ENOPKG);
/// `ENOPROTOOPT`
+ #[cfg(not(target_os = "l4re"))]
pub const NOPROTOOPT: Self = Self(c::ENOPROTOOPT);
/// `ENOSPC`
#[cfg(not(windows))]
@@ -471,6 +593,7 @@ impl Errno {
freebsdlike,
windows,
target_os = "haiku",
+ target_os = "l4re",
target_os = "openbsd",
target_os = "wasi",
)))]
@@ -480,6 +603,7 @@ impl Errno {
freebsdlike,
windows,
target_os = "haiku",
+ target_os = "l4re",
target_os = "openbsd",
target_os = "wasi",
)))]
@@ -488,7 +612,7 @@ impl Errno {
#[cfg(not(windows))]
pub const NOSYS: Self = Self(c::ENOSYS);
/// `ENOTBLK`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(windows, target_os = "espidf", target_os = "haiku", target_os = "wasi")))]
pub const NOTBLK: Self = Self(c::ENOTBLK);
/// `ENOTCAPABLE`
#[cfg(any(target_os = "freebsd", target_os = "wasi"))]
@@ -506,14 +630,24 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const NOTNAM: Self = Self(c::ENOTNAM);
/// `ENOTRECOVERABLE`
- #[cfg(not(any(freebsdlike, netbsdlike, windows, target_os = "haiku")))]
+ #[cfg(not(any(
+ freebsdlike,
+ netbsdlike,
+ windows,
+ target_os = "haiku",
+ target_os = "l4re"
+ )))]
pub const NOTRECOVERABLE: Self = Self(c::ENOTRECOVERABLE);
/// `ENOTSOCK`
+ #[cfg(not(target_os = "l4re"))]
pub const NOTSOCK: Self = Self(c::ENOTSOCK);
/// `ENOTSUP`
#[cfg(not(any(windows, target_os = "haiku", target_os = "redox")))]
@@ -526,7 +660,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const NOTUNIQ: Self = Self(c::ENOTUNIQ);
@@ -536,16 +672,22 @@ impl Errno {
/// `EOPNOTSUPP`
pub const OPNOTSUPP: Self = Self(c::EOPNOTSUPP);
/// `EOVERFLOW`
- #[cfg(not(windows))]
+ #[cfg(not(any(windows, target_os = "l4re")))]
pub const OVERFLOW: Self = Self(c::EOVERFLOW);
/// `EOWNERDEAD`
- #[cfg(not(any(freebsdlike, netbsdlike, windows, target_os = "haiku")))]
+ #[cfg(not(any(
+ freebsdlike,
+ netbsdlike,
+ windows,
+ target_os = "haiku",
+ target_os = "l4re"
+ )))]
pub const OWNERDEAD: Self = Self(c::EOWNERDEAD);
/// `EPERM`
#[cfg(not(windows))]
pub const PERM: Self = Self(c::EPERM);
/// `EPFNOSUPPORT`
- #[cfg(not(target_os = "wasi"))]
+ #[cfg(not(any(target_os = "l4re", target_os = "wasi")))]
pub const PFNOSUPPORT: Self = Self(c::EPFNOSUPPORT);
/// `EPIPE`
#[cfg(not(windows))]
@@ -563,11 +705,13 @@ impl Errno {
#[cfg(bsd)]
pub const PROGUNAVAIL: Self = Self(c::EPROGUNAVAIL);
/// `EPROTO`
- #[cfg(not(windows))]
+ #[cfg(not(any(windows, target_os = "l4re")))]
pub const PROTO: Self = Self(c::EPROTO);
/// `EPROTONOSUPPORT`
+ #[cfg(not(target_os = "l4re"))]
pub const PROTONOSUPPORT: Self = Self(c::EPROTONOSUPPORT);
/// `EPROTOTYPE`
+ #[cfg(not(target_os = "l4re"))]
pub const PROTOTYPE: Self = Self(c::EPROTOTYPE);
/// `EPROVIDERFAILEDINIT`
#[cfg(windows)]
@@ -583,12 +727,19 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const REMCHG: Self = Self(c::EREMCHG);
/// `EREMOTE`
- #[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const REMOTE: Self = Self(c::EREMOTE);
/// `EREMOTEIO`
#[cfg(not(any(
@@ -596,12 +747,22 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const REMOTEIO: Self = Self(c::EREMOTEIO);
/// `ERESTART`
- #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ bsd,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const RESTART: Self = Self(c::ERESTART);
/// `ERFKILL`
#[cfg(not(any(
@@ -610,7 +771,10 @@ impl Errno {
windows,
target_os = "aix",
target_os = "android",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "redox",
target_os = "wasi",
)))]
@@ -622,10 +786,15 @@ impl Errno {
#[cfg(bsd)]
pub const RPCMISMATCH: Self = Self(c::ERPCMISMATCH);
/// `ESHUTDOWN`
- #[cfg(not(target_os = "wasi"))]
+ #[cfg(not(any(target_os = "espidf", target_os = "l4re", target_os = "wasi")))]
pub const SHUTDOWN: Self = Self(c::ESHUTDOWN);
/// `ESOCKTNOSUPPORT`
- #[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const SOCKTNOSUPPORT: Self = Self(c::ESOCKTNOSUPPORT);
/// `ESPIPE`
#[cfg(not(windows))]
@@ -638,7 +807,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const SRMNT: Self = Self(c::ESRMNT);
@@ -649,12 +820,20 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const STRPIPE: Self = Self(c::ESTRPIPE);
/// `ETIME`
- #[cfg(not(any(freebsdlike, windows, target_os = "openbsd", target_os = "wasi")))]
+ #[cfg(not(any(
+ freebsdlike,
+ windows,
+ target_os = "l4re",
+ target_os = "openbsd",
+ target_os = "wasi"
+ )))]
pub const TIME: Self = Self(c::ETIME);
/// `ETIMEDOUT`
pub const TIMEDOUT: Self = Self(c::ETIMEDOUT);
@@ -663,7 +842,7 @@ impl Errno {
#[doc(alias = "2BIG")]
pub const TOOBIG: Self = Self(c::E2BIG);
/// `ETOOMANYREFS`
- #[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(target_os = "haiku", target_os = "l4re", target_os = "wasi")))]
pub const TOOMANYREFS: Self = Self(c::ETOOMANYREFS);
/// `ETXTBSY`
#[cfg(not(windows))]
@@ -674,15 +853,30 @@ impl Errno {
solarish,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto",
target_os = "wasi",
)))]
pub const UCLEAN: Self = Self(c::EUCLEAN);
/// `EUNATCH`
- #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ bsd,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const UNATCH: Self = Self(c::EUNATCH);
/// `EUSERS`
- #[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
+ #[cfg(not(any(
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "wasi"
+ )))]
pub const USERS: Self = Self(c::EUSERS);
/// `EWOULDBLOCK`
pub const WOULDBLOCK: Self = Self(c::EWOULDBLOCK);
@@ -694,7 +888,9 @@ impl Errno {
bsd,
windows,
target_os = "aix",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "l4re",
target_os = "wasi",
)))]
pub const XFULL: Self = Self(c::EXFULL);
diff --git a/vendor/rustix/src/backend/libc/io/syscalls.rs b/vendor/rustix/src/backend/libc/io/syscalls.rs
index 6ac1fa593..362af11ee 100644
--- a/vendor/rustix/src/backend/libc/io/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/io/syscalls.rs
@@ -1,19 +1,28 @@
//! libc syscalls supporting `rustix::io`.
-use crate::backend::conv::{
- borrowed_fd, ret, ret_c_int, ret_discarded_fd, ret_owned_fd, ret_usize,
-};
-use crate::backend::{c, MAX_IOV};
+use crate::backend::c;
+#[cfg(not(target_os = "wasi"))]
+use crate::backend::conv::ret_discarded_fd;
+use crate::backend::conv::{borrowed_fd, ret, ret_c_int, ret_owned_fd, ret_usize};
use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd};
-#[cfg(not(any(target_os = "aix", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "nto",
+ target_os = "wasi"
+)))]
use crate::io::DupFlags;
#[cfg(linux_kernel)]
use crate::io::ReadWriteFlags;
-use crate::io::{self, FdFlags, IoSlice, IoSliceMut};
+use crate::io::{self, FdFlags};
use core::cmp::min;
-use core::mem::MaybeUninit;
#[cfg(all(feature = "fs", feature = "net"))]
use libc_errno::errno;
+#[cfg(not(target_os = "espidf"))]
+use {
+ crate::backend::MAX_IOV,
+ crate::io::{IoSlice, IoSliceMut},
+};
pub(crate) fn read(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> {
unsafe {
@@ -41,6 +50,10 @@ 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;
+ // ESP-IDF doesn't support 64-bit offsets.
+ #[cfg(target_os = "espidf")]
+ let offset: i32 = offset.try_into().map_err(|_| io::Errno::OVERFLOW)?;
+
unsafe {
ret_usize(c::pread(
borrowed_fd(fd),
@@ -57,9 +70,14 @@ 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;
+ // ESP-IDF doesn't support 64-bit offsets.
+ #[cfg(target_os = "espidf")]
+ let offset: i32 = offset.try_into().map_err(|_| io::Errno::OVERFLOW)?;
+
unsafe { ret_usize(c::pwrite(borrowed_fd(fd), buf.as_ptr().cast(), len, offset)) }
}
+#[cfg(not(target_os = "espidf"))]
pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut]) -> io::Result<usize> {
unsafe {
ret_usize(c::readv(
@@ -70,6 +88,7 @@ pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut]) -> io::Result<u
}
}
+#[cfg(not(target_os = "espidf"))]
pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice]) -> io::Result<usize> {
unsafe {
ret_usize(c::writev(
@@ -80,7 +99,13 @@ pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice]) -> io::Result<usize>
}
}
-#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto",
+ target_os = "redox",
+ target_os = "solaris"
+)))]
pub(crate) fn preadv(
fd: BorrowedFd<'_>,
bufs: &mut [IoSliceMut],
@@ -98,7 +123,13 @@ pub(crate) fn preadv(
}
}
-#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto",
+ 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;
@@ -172,7 +203,10 @@ pub(crate) unsafe fn close(raw_fd: RawFd) {
let _ = c::close(raw_fd as c::c_int);
}
+#[cfg(not(target_os = "espidf"))]
pub(crate) fn ioctl_fionread(fd: BorrowedFd<'_>) -> io::Result<u64> {
+ use core::mem::MaybeUninit;
+
let mut nread = MaybeUninit::<c::c_int>::uninit();
unsafe {
ret(c::ioctl(borrowed_fd(fd), c::FIONREAD, nread.as_mut_ptr()))?;
@@ -193,6 +227,8 @@ pub(crate) fn ioctl_fionbio(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> {
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(all(feature = "fs", feature = "net"))]
pub(crate) fn is_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)> {
+ use core::mem::MaybeUninit;
+
let (mut read, mut write) = crate::fs::fd::_is_file_read_write(fd)?;
let mut not_socket = false;
if read {
@@ -251,11 +287,16 @@ pub(crate) fn fcntl_setfd(fd: BorrowedFd<'_>, flags: FdFlags) -> io::Result<()>
unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_SETFD, flags.bits())) }
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub(crate) fn fcntl_dupfd_cloexec(fd: BorrowedFd<'_>, min: RawFd) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(c::fcntl(borrowed_fd(fd), c::F_DUPFD_CLOEXEC, min)) }
}
+#[cfg(target_os = "espidf")]
+pub(crate) fn fcntl_dupfd(fd: BorrowedFd<'_>, min: RawFd) -> io::Result<OwnedFd> {
+ unsafe { ret_owned_fd(c::fcntl(borrowed_fd(fd), c::F_DUPFD, min)) }
+}
+
#[cfg(not(target_os = "wasi"))]
pub(crate) fn dup(fd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(c::dup(borrowed_fd(fd))) }
@@ -271,7 +312,9 @@ pub(crate) fn dup2(fd: BorrowedFd<'_>, new: &mut OwnedFd) -> io::Result<()> {
target_os = "aix",
target_os = "android",
target_os = "dragonfly",
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
target_os = "wasi",
)))]
diff --git a/vendor/rustix/src/backend/libc/mm/types.rs b/vendor/rustix/src/backend/libc/mm/types.rs
index e4fecfccd..6a41cbe56 100644
--- a/vendor/rustix/src/backend/libc/mm/types.rs
+++ b/vendor/rustix/src/backend/libc/mm/types.rs
@@ -40,6 +40,21 @@ bitflags! {
/// `PROT_GROWSDOWN`
#[cfg(linux_kernel)]
const GROWSDOWN = bitcast!(c::PROT_GROWSDOWN);
+ /// `PROT_SEM`
+ #[cfg(linux_kernel)]
+ const SEM = linux_raw_sys::general::PROT_SEM;
+ /// `PROT_BTI`
+ #[cfg(all(linux_kernel, target_arch = "aarch64"))]
+ const BTI = linux_raw_sys::general::PROT_BTI;
+ /// `PROT_MTE`
+ #[cfg(all(linux_kernel, target_arch = "aarch64"))]
+ const MTE = linux_raw_sys::general::PROT_MTE;
+ /// `PROT_SAO`
+ #[cfg(all(linux_kernel, any(target_arch = "powerpc", target_arch = "powerpc64")))]
+ const SAO = linux_raw_sys::general::PROT_SAO;
+ /// `PROT_ADI`
+ #[cfg(all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")))]
+ const ADI = linux_raw_sys::general::PROT_ADI;
}
}
@@ -63,6 +78,7 @@ bitflags! {
target_os = "emscripten",
target_os = "fuchsia",
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
)))]
const SHARED_VALIDATE = bitcast!(c::MAP_SHARED_VALIDATE);
@@ -73,6 +89,7 @@ bitflags! {
bsd,
solarish,
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
)))]
const DENYWRITE = bitcast!(c::MAP_DENYWRITE);
@@ -86,6 +103,7 @@ bitflags! {
target_os = "emscripten",
target_os = "fuchsia",
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
)))]
const FIXED_NOREPLACE = bitcast!(c::MAP_FIXED_NOREPLACE);
@@ -94,6 +112,7 @@ bitflags! {
bsd,
solarish,
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
)))]
const GROWSDOWN = bitcast!(c::MAP_GROWSDOWN);
@@ -102,6 +121,7 @@ bitflags! {
bsd,
solarish,
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
)))]
const HUGETLB = bitcast!(c::MAP_HUGETLB);
@@ -113,6 +133,7 @@ bitflags! {
target_os = "emscripten",
target_os = "fuchsia",
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
)))]
const HUGE_2MB = bitcast!(c::MAP_HUGE_2MB);
@@ -124,6 +145,7 @@ bitflags! {
target_os = "emscripten",
target_os = "fuchsia",
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
)))]
const HUGE_1GB = bitcast!(c::MAP_HUGE_1GB);
@@ -132,6 +154,7 @@ bitflags! {
bsd,
solarish,
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
)))]
const LOCKED = bitcast!(c::MAP_LOCKED);
@@ -139,7 +162,7 @@ bitflags! {
#[cfg(freebsdlike)]
const NOCORE = bitcast!(c::MAP_NOCORE);
/// `MAP_NORESERVE`
- #[cfg(not(any(freebsdlike, target_os = "redox")))]
+ #[cfg(not(any(freebsdlike, target_os = "nto", target_os = "redox")))]
const NORESERVE = bitcast!(c::MAP_NORESERVE);
/// `MAP_NOSYNC`
#[cfg(freebsdlike)]
@@ -149,6 +172,7 @@ bitflags! {
bsd,
solarish,
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
)))]
const POPULATE = bitcast!(c::MAP_POPULATE);
@@ -173,10 +197,11 @@ bitflags! {
target_os = "emscripten",
target_os = "fuchsia",
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
all(
linux_kernel,
- any(target_arch = "mips", target_arch = "mips64"),
+ any(target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6"),
)
)))]
const SYNC = bitcast!(c::MAP_SYNC);
@@ -308,7 +333,15 @@ pub enum Advice {
#[cfg(linux_kernel)]
LinuxHwPoison = bitcast!(c::MADV_HWPOISON),
/// `MADV_SOFT_OFFLINE`
- #[cfg(all(linux_kernel, not(any(target_arch = "mips", target_arch = "mips64"))))]
+ #[cfg(all(
+ linux_kernel,
+ not(any(
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ ))
+ ))]
LinuxSoftOffline = bitcast!(c::MADV_SOFT_OFFLINE),
/// `MADV_MERGEABLE`
#[cfg(linux_kernel)]
diff --git a/vendor/rustix/src/backend/libc/mod.rs b/vendor/rustix/src/backend/libc/mod.rs
index 357f99484..59fc3bea1 100644
--- a/vendor/rustix/src/backend/libc/mod.rs
+++ b/vendor/rustix/src/backend/libc/mod.rs
@@ -111,13 +111,19 @@ pub(crate) mod io;
#[cfg(linux_kernel)]
#[cfg(feature = "io_uring")]
pub(crate) mod io_uring;
-#[cfg(not(any(windows, target_os = "wasi")))]
+#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))]
#[cfg(feature = "mm")]
pub(crate) mod mm;
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) mod mount;
+#[cfg(linux_kernel)]
+#[cfg(all(feature = "fs", not(feature = "mount")))]
+pub(crate) mod mount; // for deprecated mount functions in "fs"
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(feature = "net")]
pub(crate) mod net;
-#[cfg(not(windows))]
+#[cfg(not(any(windows, target_os = "espidf")))]
#[cfg(any(
feature = "param",
feature = "runtime",
@@ -148,7 +154,7 @@ pub(crate) mod termios;
#[cfg(not(windows))]
#[cfg(feature = "thread")]
pub(crate) mod thread;
-#[cfg(not(windows))]
+#[cfg(not(any(windows, target_os = "espidf")))]
#[cfg(feature = "time")]
pub(crate) mod time;
@@ -193,6 +199,7 @@ const MAX_IOV: usize = c::UIO_MAXIOV as usize;
linux_kernel,
windows,
target_os = "emscripten",
+ target_os = "espidf",
target_os = "nto",
target_os = "horizon",
)))]
diff --git a/vendor/rustix/src/backend/libc/mount/mod.rs b/vendor/rustix/src/backend/libc/mount/mod.rs
new file mode 100644
index 000000000..1e0181a99
--- /dev/null
+++ b/vendor/rustix/src/backend/libc/mount/mod.rs
@@ -0,0 +1,2 @@
+pub(crate) mod syscalls;
+pub(crate) mod types;
diff --git a/vendor/rustix/src/backend/libc/mount/syscalls.rs b/vendor/rustix/src/backend/libc/mount/syscalls.rs
new file mode 100644
index 000000000..26cdb52dc
--- /dev/null
+++ b/vendor/rustix/src/backend/libc/mount/syscalls.rs
@@ -0,0 +1,272 @@
+use crate::backend::c;
+use crate::backend::conv::ret;
+#[cfg(feature = "mount")]
+use crate::backend::conv::{borrowed_fd, c_str, ret_owned_fd};
+#[cfg(feature = "mount")]
+use crate::fd::{BorrowedFd, OwnedFd};
+use crate::ffi::CStr;
+use crate::io;
+use core::ptr::null;
+
+#[cfg(linux_kernel)]
+pub(crate) fn mount(
+ source: Option<&CStr>,
+ target: &CStr,
+ file_system_type: Option<&CStr>,
+ flags: super::types::MountFlagsArg,
+ data: Option<&CStr>,
+) -> io::Result<()> {
+ unsafe {
+ ret(c::mount(
+ source.map_or_else(null, CStr::as_ptr),
+ target.as_ptr(),
+ file_system_type.map_or_else(null, CStr::as_ptr),
+ flags.0,
+ data.map_or_else(null, CStr::as_ptr).cast(),
+ ))
+ }
+}
+
+#[cfg(linux_kernel)]
+pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> {
+ unsafe { ret(c::umount2(target.as_ptr(), bitflags_bits!(flags))) }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fsopen(fs_name: &CStr, flags: super::types::FsOpenFlags) -> io::Result<OwnedFd> {
+ syscall! {
+ fn fsopen(
+ fs_name: *const c::c_char,
+ flags: c::c_uint
+ ) via SYS_fsopen -> c::c_int
+ }
+ unsafe { ret_owned_fd(fsopen(c_str(fs_name), flags.bits())) }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fsmount(
+ fs_fd: BorrowedFd<'_>,
+ flags: super::types::FsMountFlags,
+ attr_flags: super::types::MountAttrFlags,
+) -> io::Result<()> {
+ syscall! {
+ fn fsmount(
+ fs_fd: c::c_int,
+ flags: c::c_uint,
+ attr_flags: c::c_uint
+ ) via SYS_fsmount -> c::c_int
+ }
+ unsafe { ret(fsmount(borrowed_fd(fs_fd), flags.bits(), attr_flags.bits())) }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn move_mount(
+ from_dfd: BorrowedFd<'_>,
+ from_pathname: &CStr,
+ to_dfd: BorrowedFd<'_>,
+ to_pathname: &CStr,
+ flags: super::types::MoveMountFlags,
+) -> io::Result<()> {
+ syscall! {
+ fn move_mount(
+ from_dfd: c::c_int,
+ from_pathname: *const c::c_char,
+ to_dfd: c::c_int,
+ to_pathname: *const c::c_char,
+ flags: c::c_uint
+ ) via SYS_move_mount -> c::c_int
+ }
+ unsafe {
+ ret(move_mount(
+ borrowed_fd(from_dfd),
+ c_str(from_pathname),
+ borrowed_fd(to_dfd),
+ c_str(to_pathname),
+ flags.bits(),
+ ))
+ }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn open_tree(
+ dfd: BorrowedFd<'_>,
+ filename: &CStr,
+ flags: super::types::OpenTreeFlags,
+) -> io::Result<OwnedFd> {
+ syscall! {
+ fn open_tree(
+ dfd: c::c_int,
+ filename: *const c::c_char,
+ flags: c::c_uint
+ ) via SYS_open_tree -> c::c_int
+ }
+
+ unsafe { ret_owned_fd(open_tree(borrowed_fd(dfd), c_str(filename), flags.bits())) }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fspick(
+ dfd: BorrowedFd<'_>,
+ path: &CStr,
+ flags: super::types::FsPickFlags,
+) -> io::Result<OwnedFd> {
+ syscall! {
+ fn fspick(
+ dfd: c::c_int,
+ path: *const c::c_char,
+ flags: c::c_uint
+ ) via SYS_fspick -> c::c_int
+ }
+
+ unsafe { ret_owned_fd(fspick(borrowed_fd(dfd), c_str(path), flags.bits())) }
+}
+
+#[cfg(feature = "mount")]
+#[cfg(linux_kernel)]
+syscall! {
+ fn fsconfig(
+ fs_fd: c::c_int,
+ cmd: c::c_uint,
+ key: *const c::c_char,
+ val: *const c::c_char,
+ aux: c::c_int
+ ) via SYS_fsconfig -> c::c_int
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fsconfig_set_flag(fs_fd: BorrowedFd<'_>, key: &CStr) -> io::Result<()> {
+ unsafe {
+ ret(fsconfig(
+ borrowed_fd(fs_fd),
+ super::types::FsConfigCmd::SetFlag as _,
+ c_str(key),
+ null(),
+ 0,
+ ))
+ }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fsconfig_set_string(
+ fs_fd: BorrowedFd<'_>,
+ key: &CStr,
+ value: &CStr,
+) -> io::Result<()> {
+ unsafe {
+ ret(fsconfig(
+ borrowed_fd(fs_fd),
+ super::types::FsConfigCmd::SetString as _,
+ c_str(key),
+ c_str(value),
+ 0,
+ ))
+ }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fsconfig_set_binary(
+ fs_fd: BorrowedFd<'_>,
+ key: &CStr,
+ value: &[u8],
+) -> io::Result<()> {
+ unsafe {
+ ret(fsconfig(
+ borrowed_fd(fs_fd),
+ super::types::FsConfigCmd::SetBinary as _,
+ c_str(key),
+ value.as_ptr().cast(),
+ value.len().try_into().map_err(|_| io::Errno::OVERFLOW)?,
+ ))
+ }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fsconfig_set_fd(
+ fs_fd: BorrowedFd<'_>,
+ key: &CStr,
+ fd: BorrowedFd<'_>,
+) -> io::Result<()> {
+ unsafe {
+ ret(fsconfig(
+ borrowed_fd(fs_fd),
+ super::types::FsConfigCmd::SetFd as _,
+ c_str(key),
+ null(),
+ borrowed_fd(fd),
+ ))
+ }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fsconfig_set_path(
+ fs_fd: BorrowedFd<'_>,
+ key: &CStr,
+ path: &CStr,
+ fd: BorrowedFd<'_>,
+) -> io::Result<()> {
+ unsafe {
+ ret(fsconfig(
+ borrowed_fd(fs_fd),
+ super::types::FsConfigCmd::SetPath as _,
+ c_str(key),
+ c_str(path),
+ borrowed_fd(fd),
+ ))
+ }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fsconfig_set_path_empty(
+ fs_fd: BorrowedFd<'_>,
+ key: &CStr,
+ fd: BorrowedFd<'_>,
+) -> io::Result<()> {
+ unsafe {
+ ret(fsconfig(
+ borrowed_fd(fs_fd),
+ super::types::FsConfigCmd::SetPathEmpty as _,
+ c_str(key),
+ c_str(cstr!("")),
+ borrowed_fd(fd),
+ ))
+ }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fsconfig_create(fs_fd: BorrowedFd<'_>) -> io::Result<()> {
+ unsafe {
+ ret(fsconfig(
+ borrowed_fd(fs_fd),
+ super::types::FsConfigCmd::Create as _,
+ null(),
+ null(),
+ 0,
+ ))
+ }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(feature = "mount")]
+pub(crate) fn fsconfig_reconfigure(fs_fd: BorrowedFd<'_>) -> io::Result<()> {
+ unsafe {
+ ret(fsconfig(
+ borrowed_fd(fs_fd),
+ super::types::FsConfigCmd::Reconfigure as _,
+ null(),
+ null(),
+ 0,
+ ))
+ }
+}
diff --git a/vendor/rustix/src/backend/libc/mount/types.rs b/vendor/rustix/src/backend/libc/mount/types.rs
new file mode 100644
index 000000000..660e6ae37
--- /dev/null
+++ b/vendor/rustix/src/backend/libc/mount/types.rs
@@ -0,0 +1,311 @@
+use crate::backend::c;
+use bitflags::bitflags;
+
+#[cfg(linux_kernel)]
+bitflags! {
+ /// `MS_*` constants for use with [`mount`].
+ ///
+ /// [`mount`]: crate::mount::mount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct MountFlags: c::c_ulong {
+ /// `MS_BIND`
+ const BIND = c::MS_BIND;
+
+ /// `MS_DIRSYNC`
+ const DIRSYNC = c::MS_DIRSYNC;
+
+ /// `MS_LAZYTIME`
+ const LAZYTIME = c::MS_LAZYTIME;
+
+ /// `MS_MANDLOCK`
+ #[doc(alias = "MANDLOCK")]
+ const PERMIT_MANDATORY_FILE_LOCKING = c::MS_MANDLOCK;
+
+ /// `MS_NOATIME`
+ const NOATIME = c::MS_NOATIME;
+
+ /// `MS_NODEV`
+ const NODEV = c::MS_NODEV;
+
+ /// `MS_NODIRATIME`
+ const NODIRATIME = c::MS_NODIRATIME;
+
+ /// `MS_NOEXEC`
+ const NOEXEC = c::MS_NOEXEC;
+
+ /// `MS_NOSUID`
+ const NOSUID = c::MS_NOSUID;
+
+ /// `MS_RDONLY`
+ const RDONLY = c::MS_RDONLY;
+
+ /// `MS_REC`
+ const REC = c::MS_REC;
+
+ /// `MS_RELATIME`
+ const RELATIME = c::MS_RELATIME;
+
+ /// `MS_SILENT`
+ const SILENT = c::MS_SILENT;
+
+ /// `MS_STRICTATIME`
+ const STRICTATIME = c::MS_STRICTATIME;
+
+ /// `MS_SYNCHRONOUS`
+ const SYNCHRONOUS = c::MS_SYNCHRONOUS;
+ }
+}
+
+#[cfg(linux_kernel)]
+bitflags! {
+ /// `MNT_*` constants for use with [`unmount`].
+ ///
+ /// [`unmount`]: crate::mount::unmount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct UnmountFlags: u32 {
+ /// `MNT_FORCE`
+ const FORCE = bitcast!(c::MNT_FORCE);
+ /// `MNT_DETACH`
+ const DETACH = bitcast!(c::MNT_DETACH);
+ /// `MNT_EXPIRE`
+ const EXPIRE = bitcast!(c::MNT_EXPIRE);
+ /// `UMOUNT_NOFOLLOW`
+ const NOFOLLOW = bitcast!(c::UMOUNT_NOFOLLOW);
+ }
+}
+
+#[cfg(feature = "mount")]
+#[cfg(linux_kernel)]
+bitflags! {
+ /// `FSOPEN_*` constants for use with [`fsopen`].
+ ///
+ /// [`fsopen`]: crate::mount::fsopen
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct FsOpenFlags: c::c_uint {
+
+ /// `FSOPEN_CLOEXEC`
+ const FSOPEN_CLOEXEC = 0x00000001;
+ }
+}
+
+#[cfg(feature = "mount")]
+#[cfg(linux_kernel)]
+bitflags! {
+ /// `FSMOUNT_*` constants for use with [`fsmount`].
+ ///
+ /// [`fsmount`]: crate::mount::fsmount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct FsMountFlags: c::c_uint {
+ /// `FSMOUNT_CLOEXEC`
+ const FSMOUNT_CLOEXEC = 0x00000001;
+ }
+}
+
+/// `FSCONFIG_*` constants for use with the `fsconfig` syscall.
+#[cfg(feature = "mount")]
+#[cfg(linux_kernel)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
+#[repr(u32)]
+pub(crate) enum FsConfigCmd {
+ /// `FSCONFIG_SET_FLAG`
+ SetFlag = 0,
+
+ /// `FSCONFIG_SET_STRING`
+ SetString = 1,
+
+ /// `FSCONFIG_SET_BINARY`
+ SetBinary = 2,
+
+ /// `FSCONFIG_SET_PATH`
+ SetPath = 3,
+
+ /// `FSCONFIG_SET_PATH_EMPTY`
+ SetPathEmpty = 4,
+
+ /// `FSCONFIG_SET_FD`
+ SetFd = 5,
+
+ /// `FSCONFIG_CMD_CREATE`
+ Create = 6,
+
+ /// `FSCONFIG_CMD_RECONFIGURE`
+ Reconfigure = 7,
+}
+
+#[cfg(feature = "mount")]
+#[cfg(linux_kernel)]
+bitflags! {
+ /// `MOUNT_ATTR_*` constants for use with [`fsmount`].
+ ///
+ /// [`fsmount`]: crate::mount::fsmount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct MountAttrFlags: c::c_uint {
+ /// `MOUNT_ATTR_RDONLY`
+ const MOUNT_ATTR_RDONLY = 0x00000001;
+
+ /// `MOUNT_ATTR_NOSUID`
+ const MOUNT_ATTR_NOSUID = 0x00000002;
+
+ /// `MOUNT_ATTR_NODEV`
+ const MOUNT_ATTR_NODEV = 0x00000004;
+
+ /// `MOUNT_ATTR_NOEXEC`
+ const MOUNT_ATTR_NOEXEC = 0x00000008;
+
+ /// `MOUNT_ATTR__ATIME`
+ const MOUNT_ATTR__ATIME = 0x00000070;
+
+ /// `MOUNT_ATTR_RELATIME`
+ const MOUNT_ATTR_RELATIME = 0x00000000;
+
+ /// `MOUNT_ATTR_NOATIME`
+ const MOUNT_ATTR_NOATIME = 0x00000010;
+
+ /// `MOUNT_ATTR_STRICTATIME`
+ const MOUNT_ATTR_STRICTATIME = 0x00000020;
+
+ /// `MOUNT_ATTR_NODIRATIME`
+ const MOUNT_ATTR_NODIRATIME = 0x00000080;
+
+ /// `MOUNT_ATTR_NOUSER`
+ const MOUNT_ATTR_IDMAP = 0x00100000;
+
+ /// `MOUNT_ATTR__ATIME_FLAGS`
+ const MOUNT_ATTR_NOSYMFOLLOW = 0x00200000;
+
+ /// `MOUNT_ATTR__ATIME_FLAGS`
+ const MOUNT_ATTR_SIZE_VER0 = 32;
+ }
+}
+
+#[cfg(feature = "mount")]
+#[cfg(linux_kernel)]
+bitflags! {
+ /// `MOVE_MOUNT_*` constants for use with [`move_mount`].
+ ///
+ /// [`move_mount`]: crate::mount::move_mount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct MoveMountFlags: c::c_uint {
+ /// `MOVE_MOUNT_F_EMPTY_PATH`
+ const MOVE_MOUNT_F_SYMLINKS = 0x00000001;
+
+ /// `MOVE_MOUNT_F_AUTOMOUNTS`
+ const MOVE_MOUNT_F_AUTOMOUNTS = 0x00000002;
+
+ /// `MOVE_MOUNT_F_EMPTY_PATH`
+ const MOVE_MOUNT_F_EMPTY_PATH = 0x00000004;
+
+ /// `MOVE_MOUNT_T_SYMLINKS`
+ const MOVE_MOUNT_T_SYMLINKS = 0x00000010;
+
+ /// `MOVE_MOUNT_T_AUTOMOUNTS`
+ const MOVE_MOUNT_T_AUTOMOUNTS = 0x00000020;
+
+ /// `MOVE_MOUNT_T_EMPTY_PATH`
+ const MOVE_MOUNT_T_EMPTY_PATH = 0x00000040;
+
+ /// `MOVE_MOUNT__MASK`
+ const MOVE_MOUNT_SET_GROUP = 0x00000100;
+
+ // TODO: add when linux 6.5 is released
+ // /// `MOVE_MOUNT_BENEATH`
+ // const MOVE_MOUNT_BENEATH = 0x00000200;
+
+ /// `MOVE_MOUNT__MASK`
+ const MOVE_MOUNT__MASK = 0x00000377;
+ }
+}
+
+#[cfg(feature = "mount")]
+#[cfg(linux_kernel)]
+bitflags! {
+ /// `OPENTREE_*` constants for use with [`open_tree`].
+ ///
+ /// [`open_tree`]: crate::mount::open_tree
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct OpenTreeFlags: c::c_uint {
+ /// `OPENTREE_CLONE`
+ const OPEN_TREE_CLONE = 1;
+
+ /// `OPENTREE_CLOEXEC`
+ const OPEN_TREE_CLOEXEC = c::O_CLOEXEC as c::c_uint;
+
+ /// `AT_EMPTY_PATH`
+ const AT_EMPTY_PATH = c::AT_EMPTY_PATH as c::c_uint;
+
+ /// `AT_NO_AUTOMOUNT`
+ const AT_NO_AUTOMOUNT = c::AT_NO_AUTOMOUNT as c::c_uint;
+
+ /// `AT_RECURSIVE`
+ const AT_RECURSIVE = c::AT_RECURSIVE as c::c_uint;
+
+ /// `AT_SYMLINK_NOFOLLOW`
+ const AT_SYMLINK_NOFOLLOW = c::AT_SYMLINK_NOFOLLOW as c::c_uint;
+ }
+}
+
+#[cfg(feature = "mount")]
+#[cfg(linux_kernel)]
+bitflags! {
+ /// `FSPICK_*` constants for use with [`fspick`].
+ ///
+ /// [`fspick`]: crate::mount::fspick
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct FsPickFlags: c::c_uint {
+ /// `FSPICK_CLOEXEC`
+ const FSPICK_CLOEXEC = 0x00000001;
+
+ /// `FSPICK_SYMLINK_NOFOLLOW`
+ const FSPICK_SYMLINK_NOFOLLOW = 0x00000002;
+
+ /// `FSPICK_NO_AUTOMOUNT`
+ const FSPICK_NO_AUTOMOUNT = 0x00000004;
+
+ /// `FSPICK_EMPTY_PATH`
+ const FSPICK_EMPTY_PATH = 0x00000008;
+ }
+}
+
+#[cfg(linux_kernel)]
+bitflags! {
+ /// `MS_*` constants for use with [`change_mount`].
+ ///
+ /// [`change_mount`]: crate::mount::change_mount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct MountPropagationFlags: c::c_ulong {
+ /// `MS_SILENT`
+ const SILENT = c::MS_SILENT;
+ /// `MS_SHARED`
+ const SHARED = c::MS_SHARED;
+ /// `MS_PRIVATE`
+ const PRIVATE = c::MS_PRIVATE;
+ /// `MS_SLAVE`
+ const SLAVE = c::MS_SLAVE;
+ /// `MS_UNBINDABLE`
+ const UNBINDABLE = c::MS_UNBINDABLE;
+ /// `MS_REC`
+ const REC = c::MS_REC;
+ }
+}
+
+#[cfg(linux_kernel)]
+bitflags! {
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub(crate) struct InternalMountFlags: c::c_ulong {
+ const REMOUNT = c::MS_REMOUNT;
+ const MOVE = c::MS_MOVE;
+ }
+}
+
+#[cfg(linux_kernel)]
+pub(crate) struct MountFlagsArg(pub(crate) c::c_ulong);
diff --git a/vendor/rustix/src/backend/libc/net/addr.rs b/vendor/rustix/src/backend/libc/net/addr.rs
index bf7d239de..bd2e7dafe 100644
--- a/vendor/rustix/src/backend/libc/net/addr.rs
+++ b/vendor/rustix/src/backend/libc/net/addr.rs
@@ -76,12 +76,12 @@ impl SocketAddrUnix {
fn init() -> c::sockaddr_un {
c::sockaddr_un {
- #[cfg(any(bsd, target_os = "haiku"))]
+ #[cfg(any(bsd, target_os = "haiku", target_os = "nto"))]
sun_len: 0,
sun_family: c::AF_UNIX as _,
- #[cfg(bsd)]
+ #[cfg(any(bsd, target_os = "nto"))]
sun_path: [0; 104],
- #[cfg(not(any(bsd, target_os = "haiku")))]
+ #[cfg(not(any(bsd, target_os = "haiku", target_os = "nto")))]
sun_path: [0; 108],
#[cfg(target_os = "haiku")]
sun_path: [0; 126],
@@ -208,15 +208,15 @@ pub type SocketAddrStorage = c::sockaddr_storage;
#[inline]
pub(crate) fn offsetof_sun_path() -> usize {
let z = c::sockaddr_un {
- #[cfg(any(bsd, target_os = "haiku"))]
+ #[cfg(any(bsd, target_os = "haiku", target_os = "nto"))]
sun_len: 0_u8,
- #[cfg(any(bsd, target_os = "haiku"))]
+ #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
sun_family: 0_u8,
- #[cfg(not(any(bsd, target_os = "haiku")))]
+ #[cfg(not(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
sun_family: 0_u16,
- #[cfg(bsd)]
+ #[cfg(any(bsd, target_os = "nto"))]
sun_path: [0; 104],
- #[cfg(not(any(bsd, target_os = "haiku")))]
+ #[cfg(not(any(bsd, target_os = "haiku", target_os = "nto")))]
sun_path: [0; 108],
#[cfg(target_os = "haiku")]
sun_path: [0; 126],
diff --git a/vendor/rustix/src/backend/libc/net/ext.rs b/vendor/rustix/src/backend/libc/net/ext.rs
index 4b2d10756..50bd89db6 100644
--- a/vendor/rustix/src/backend/libc/net/ext.rs
+++ b/vendor/rustix/src/backend/libc/net/ext.rs
@@ -78,7 +78,7 @@ pub(crate) const fn sockaddr_in6_sin6_scope_id(addr: &c::sockaddr_in6) -> u32 {
#[cfg(not(windows))]
#[inline]
pub(crate) const fn sockaddr_in6_new(
- #[cfg(any(bsd, target_os = "haiku"))] sin6_len: u8,
+ #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))] sin6_len: u8,
sin6_family: c::sa_family_t,
sin6_port: u16,
sin6_flowinfo: u32,
@@ -86,7 +86,7 @@ pub(crate) const fn sockaddr_in6_new(
sin6_scope_id: u32,
) -> c::sockaddr_in6 {
c::sockaddr_in6 {
- #[cfg(any(bsd, target_os = "haiku"))]
+ #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
sin6_len,
sin6_family,
sin6_port,
diff --git a/vendor/rustix/src/backend/libc/net/mod.rs b/vendor/rustix/src/backend/libc/net/mod.rs
index 1b68f1b26..65c7d0654 100644
--- a/vendor/rustix/src/backend/libc/net/mod.rs
+++ b/vendor/rustix/src/backend/libc/net/mod.rs
@@ -1,6 +1,6 @@
pub(crate) mod addr;
pub(crate) mod ext;
-#[cfg(not(any(target_os = "redox", target_os = "wasi", windows)))]
+#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))]
pub(crate) mod msghdr;
pub(crate) mod read_sockaddr;
pub(crate) mod send_recv;
diff --git a/vendor/rustix/src/backend/libc/net/read_sockaddr.rs b/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
index c3b23e8c2..cde851af6 100644
--- a/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
+++ b/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
@@ -26,11 +26,11 @@ struct sockaddr_header {
unsafe fn read_ss_family(storage: *const c::sockaddr_storage) -> u16 {
// Assert that we know the layout of `sockaddr`.
let _ = c::sockaddr {
- #[cfg(any(bsd, target_os = "haiku"))]
+ #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
sa_len: 0_u8,
- #[cfg(any(bsd, target_os = "haiku"))]
+ #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
sa_family: 0_u8,
- #[cfg(not(any(bsd, target_os = "haiku")))]
+ #[cfg(not(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
sa_family: 0_u16,
#[cfg(not(target_os = "haiku"))]
sa_data: [0; 14],
diff --git a/vendor/rustix/src/backend/libc/net/send_recv.rs b/vendor/rustix/src/backend/libc/net/send_recv.rs
index e91017e97..26543a1fd 100644
--- a/vendor/rustix/src/backend/libc/net/send_recv.rs
+++ b/vendor/rustix/src/backend/libc/net/send_recv.rs
@@ -14,6 +14,8 @@ bitflags! {
bsd,
solarish,
windows,
+ target_os = "espidf",
+ target_os = "nto",
target_os = "haiku",
)))]
const CONFIRM = bitcast!(c::MSG_CONFIRM);
@@ -31,6 +33,7 @@ bitflags! {
solarish,
windows,
target_os = "haiku",
+ target_os = "nto",
)))]
const MORE = bitcast!(c::MSG_MORE);
#[cfg(not(any(apple, windows)))]
@@ -49,7 +52,7 @@ bitflags! {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct RecvFlags: u32 {
- #[cfg(not(any(apple, solarish, windows, target_os = "haiku")))]
+ #[cfg(not(any(apple, solarish, windows, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
/// `MSG_CMSG_CLOEXEC`
const CMSG_CLOEXEC = bitcast!(c::MSG_CMSG_CLOEXEC);
/// `MSG_DONTWAIT`
@@ -60,7 +63,9 @@ bitflags! {
bsd,
solarish,
windows,
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "nto",
)))]
const ERRQUEUE = bitcast!(c::MSG_ERRQUEUE);
/// `MSG_OOB`
diff --git a/vendor/rustix/src/backend/libc/net/syscalls.rs b/vendor/rustix/src/backend/libc/net/syscalls.rs
index 63067ff38..b4550583c 100644
--- a/vendor/rustix/src/backend/libc/net/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/net/syscalls.rs
@@ -10,7 +10,7 @@ use crate::io;
use crate::net::{SocketAddrAny, SocketAddrV4, SocketAddrV6};
use crate::utils::as_ptr;
use core::mem::{size_of, MaybeUninit};
-#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))]
use {
super::msghdr::{with_noaddr_msghdr, with_recv_msghdr, with_v4_msghdr, with_v6_msghdr},
crate::io::{IoSlice, IoSliceMut},
@@ -256,7 +256,7 @@ pub(crate) fn accept(sockfd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
}
}
-#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))]
pub(crate) fn recvmsg(
sockfd: BorrowedFd<'_>,
iov: &mut [IoSliceMut<'_>],
@@ -288,7 +288,7 @@ pub(crate) fn recvmsg(
})
}
-#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))]
pub(crate) fn sendmsg(
sockfd: BorrowedFd<'_>,
iov: &[IoSlice<'_>],
@@ -304,7 +304,7 @@ pub(crate) fn sendmsg(
})
}
-#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))]
pub(crate) fn sendmsg_v4(
sockfd: BorrowedFd<'_>,
addr: &SocketAddrV4,
@@ -321,7 +321,7 @@ pub(crate) fn sendmsg_v4(
})
}
-#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))]
pub(crate) fn sendmsg_v6(
sockfd: BorrowedFd<'_>,
addr: &SocketAddrV6,
@@ -338,7 +338,7 @@ pub(crate) fn sendmsg_v6(
})
}
-#[cfg(all(unix, not(target_os = "redox")))]
+#[cfg(all(unix, not(any(target_os = "espidf", target_os = "redox"))))]
pub(crate) fn sendmsg_unix(
sockfd: BorrowedFd<'_>,
addr: &SocketAddrUnix,
@@ -358,8 +358,10 @@ pub(crate) fn sendmsg_unix(
#[cfg(not(any(
apple,
windows,
+ target_os = "espidf",
target_os = "haiku",
target_os = "redox",
+ target_os = "nto",
target_os = "wasi",
)))]
pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, flags: SocketFlags) -> io::Result<OwnedFd> {
@@ -394,7 +396,9 @@ pub(crate) fn acceptfrom(sockfd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option<
#[cfg(not(any(
apple,
windows,
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "nto",
target_os = "redox",
target_os = "wasi",
)))]
@@ -420,14 +424,26 @@ pub(crate) fn acceptfrom_with(
/// Darwin lacks `accept4`, but does have `accept`. We define
/// `SocketFlags` to have no flags, so we can discard it here.
-#[cfg(any(apple, windows, target_os = "haiku"))]
+#[cfg(any(
+ apple,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+))]
pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: SocketFlags) -> io::Result<OwnedFd> {
accept(sockfd)
}
/// Darwin lacks `accept4`, but does have `accept`. We define
/// `SocketFlags` to have no flags, so we can discard it here.
-#[cfg(any(apple, windows, target_os = "haiku"))]
+#[cfg(any(
+ apple,
+ windows,
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+))]
pub(crate) fn acceptfrom_with(
sockfd: BorrowedFd<'_>,
_flags: SocketFlags,
@@ -893,9 +909,21 @@ pub(crate) mod sockopt {
multiaddr: &Ipv6Addr,
interface: u32,
) -> io::Result<()> {
- #[cfg(not(any(bsd, solarish, target_os = "haiku", target_os = "l4re")))]
+ #[cfg(not(any(
+ bsd,
+ solarish,
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto"
+ )))]
use c::IPV6_ADD_MEMBERSHIP;
- #[cfg(any(bsd, solarish, target_os = "haiku", target_os = "l4re"))]
+ #[cfg(any(
+ bsd,
+ solarish,
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto"
+ ))]
use c::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP;
let mreq = to_ipv6mr(multiaddr, interface);
@@ -918,9 +946,21 @@ pub(crate) mod sockopt {
multiaddr: &Ipv6Addr,
interface: u32,
) -> io::Result<()> {
- #[cfg(not(any(bsd, solarish, target_os = "haiku", target_os = "l4re")))]
+ #[cfg(not(any(
+ bsd,
+ solarish,
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto"
+ )))]
use c::IPV6_DROP_MEMBERSHIP;
- #[cfg(any(bsd, solarish, target_os = "haiku", target_os = "l4re"))]
+ #[cfg(any(
+ bsd,
+ solarish,
+ target_os = "haiku",
+ target_os = "l4re",
+ target_os = "nto"
+ ))]
use c::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP;
let mreq = to_ipv6mr(multiaddr, interface);
diff --git a/vendor/rustix/src/backend/libc/net/write_sockaddr.rs b/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
index efb5a4e14..46f0ef40a 100644
--- a/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
+++ b/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
@@ -23,7 +23,7 @@ pub(crate) unsafe fn write_sockaddr(
pub(crate) unsafe fn encode_sockaddr_v4(v4: &SocketAddrV4) -> c::sockaddr_in {
c::sockaddr_in {
- #[cfg(any(bsd, target_os = "haiku"))]
+ #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
sin_len: size_of::<c::sockaddr_in>() as _,
sin_family: c::AF_INET as _,
sin_port: u16::to_be(v4.port()),
@@ -42,7 +42,7 @@ unsafe fn write_sockaddr_v4(v4: &SocketAddrV4, storage: *mut SocketAddrStorage)
}
pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 {
- #[cfg(any(bsd, target_os = "haiku"))]
+ #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
{
sockaddr_in6_new(
size_of::<c::sockaddr_in6>() as _,
@@ -53,7 +53,7 @@ pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 {
v6.scope_id(),
)
}
- #[cfg(not(any(bsd, target_os = "haiku")))]
+ #[cfg(not(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
{
sockaddr_in6_new(
c::AF_INET6 as _,
diff --git a/vendor/rustix/src/backend/libc/pipe/syscalls.rs b/vendor/rustix/src/backend/libc/pipe/syscalls.rs
index c5ded9174..24262cc9a 100644
--- a/vendor/rustix/src/backend/libc/pipe/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/pipe/syscalls.rs
@@ -2,7 +2,14 @@ use crate::backend::c;
use crate::backend::conv::ret;
use crate::fd::OwnedFd;
use crate::io;
-#[cfg(not(any(apple, target_os = "aix", target_os = "haiku", target_os = "wasi")))]
+#[cfg(not(any(
+ apple,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto",
+ target_os = "wasi"
+)))]
use crate::pipe::PipeFlags;
use core::mem::MaybeUninit;
#[cfg(linux_kernel)]
@@ -11,7 +18,7 @@ use {
crate::backend::MAX_IOV,
crate::fd::BorrowedFd,
crate::pipe::{IoSliceRaw, SpliceFlags},
- crate::utils::optional_as_mut_ptr,
+ crate::utils::option_as_mut_ptr,
core::cmp::min,
};
@@ -25,7 +32,14 @@ pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
}
}
-#[cfg(not(any(apple, target_os = "aix", target_os = "haiku", target_os = "wasi")))]
+#[cfg(not(any(
+ apple,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto",
+ target_os = "wasi"
+)))]
pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {
unsafe {
let mut result = MaybeUninit::<[OwnedFd; 2]>::uninit();
@@ -48,8 +62,8 @@ pub fn splice(
len: usize,
flags: SpliceFlags,
) -> io::Result<usize> {
- let off_in = optional_as_mut_ptr(off_in).cast();
- let off_out = optional_as_mut_ptr(off_out).cast();
+ let off_in = option_as_mut_ptr(off_in).cast();
+ let off_out = option_as_mut_ptr(off_out).cast();
unsafe {
ret_usize(c::splice(
diff --git a/vendor/rustix/src/backend/libc/pipe/types.rs b/vendor/rustix/src/backend/libc/pipe/types.rs
index f48d8041b..3fa0464e0 100644
--- a/vendor/rustix/src/backend/libc/pipe/types.rs
+++ b/vendor/rustix/src/backend/libc/pipe/types.rs
@@ -16,7 +16,9 @@ bitflags! {
/// `O_DIRECT`
#[cfg(not(any(
solarish,
+ target_os = "espidf",
target_os = "haiku",
+ target_os = "nto",
target_os = "openbsd",
target_os = "redox",
)))]
@@ -85,9 +87,8 @@ impl<'a> IoSliceRaw<'a> {
#[cfg(not(any(apple, target_os = "wasi")))]
#[test]
fn test_types() {
- use core::mem::size_of;
- assert_eq!(size_of::<PipeFlags>(), size_of::<c::c_int>());
+ assert_eq_size!(PipeFlags, c::c_int);
#[cfg(linux_kernel)]
- assert_eq!(size_of::<SpliceFlags>(), size_of::<c::c_int>());
+ assert_eq_size!(SpliceFlags, c::c_int);
}
diff --git a/vendor/rustix/src/backend/libc/process/mod.rs b/vendor/rustix/src/backend/libc/process/mod.rs
index 24f43d443..4d9a9f0a0 100644
--- a/vendor/rustix/src/backend/libc/process/mod.rs
+++ b/vendor/rustix/src/backend/libc/process/mod.rs
@@ -3,5 +3,5 @@ pub(crate) mod cpu_set;
#[cfg(not(windows))]
pub(crate) mod syscalls;
pub(crate) mod types;
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub(crate) mod wait;
diff --git a/vendor/rustix/src/backend/libc/process/syscalls.rs b/vendor/rustix/src/backend/libc/process/syscalls.rs
index 0aa29b0b1..a84385cf1 100644
--- a/vendor/rustix/src/backend/libc/process/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/process/syscalls.rs
@@ -3,14 +3,21 @@
#[cfg(any(linux_kernel, target_os = "dragonfly", target_os = "fuchsia"))]
use super::types::RawCpuSet;
use crate::backend::c;
-#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
+#[cfg(feature = "fs")]
+use crate::backend::conv::c_str;
+#[cfg(all(feature = "fs", not(target_os = "wasi")))]
+use crate::backend::conv::ret_discarded_char_ptr;
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "fuchsia",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
use crate::backend::conv::ret_infallible;
#[cfg(linux_kernel)]
use crate::backend::conv::ret_u32;
#[cfg(not(target_os = "wasi"))]
use crate::backend::conv::{borrowed_fd, ret_pid_t, ret_usize};
-#[cfg(feature = "fs")]
-use crate::backend::conv::{c_str, ret_discarded_char_ptr};
use crate::backend::conv::{ret, ret_c_int};
#[cfg(not(target_os = "wasi"))]
use crate::fd::BorrowedFd;
@@ -21,15 +28,27 @@ use crate::ffi::CStr;
#[cfg(feature = "fs")]
use crate::fs::Mode;
use crate::io;
-#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
+#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))]
use crate::process::Uid;
#[cfg(linux_kernel)]
use crate::process::{Cpuid, MembarrierCommand, MembarrierQuery};
#[cfg(not(target_os = "wasi"))]
-use crate::process::{Gid, Pid, RawPid, Signal, WaitOptions, WaitStatus};
-#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
+use crate::process::{Gid, Pid};
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
+use crate::process::{RawPid, Signal, WaitOptions, WaitStatus};
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "fuchsia",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
use crate::process::{Resource, Rlimit};
-#[cfg(not(any(target_os = "redox", target_os = "openbsd", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "redox",
+ target_os = "openbsd",
+ target_os = "wasi"
+)))]
use crate::process::{WaitId, WaitidOptions, WaitidStatus};
use core::mem::MaybeUninit;
#[cfg(target_os = "linux")]
@@ -43,7 +62,7 @@ pub(crate) fn chdir(path: &CStr) -> io::Result<()> {
unsafe { ret(c::chdir(c_str(path))) }
}
-#[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))]
+#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
pub(crate) fn fchdir(dirfd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::fchdir(borrowed_fd(dirfd))) }
}
@@ -196,7 +215,7 @@ pub(crate) fn nice(inc: i32) -> io::Result<i32> {
}
}
-#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
+#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))]
#[inline]
pub(crate) fn getpriority_user(uid: Uid) -> io::Result<i32> {
libc_errno::set_errno(libc_errno::Errno(0));
@@ -208,7 +227,7 @@ pub(crate) fn getpriority_user(uid: Uid) -> io::Result<i32> {
}
}
-#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
+#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))]
#[inline]
pub(crate) fn getpriority_pgrp(pgid: Option<Pid>) -> io::Result<i32> {
libc_errno::set_errno(libc_errno::Errno(0));
@@ -220,7 +239,7 @@ pub(crate) fn getpriority_pgrp(pgid: Option<Pid>) -> io::Result<i32> {
}
}
-#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
+#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))]
#[inline]
pub(crate) fn getpriority_process(pid: Option<Pid>) -> io::Result<i32> {
libc_errno::set_errno(libc_errno::Errno(0));
@@ -232,13 +251,13 @@ pub(crate) fn getpriority_process(pid: Option<Pid>) -> io::Result<i32> {
}
}
-#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
+#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))]
#[inline]
pub(crate) fn setpriority_user(uid: Uid, priority: i32) -> io::Result<()> {
unsafe { ret(c::setpriority(c::PRIO_USER, uid.as_raw() as _, priority)) }
}
-#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
+#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))]
#[inline]
pub(crate) fn setpriority_pgrp(pgid: Option<Pid>, priority: i32) -> io::Result<()> {
unsafe {
@@ -250,7 +269,7 @@ pub(crate) fn setpriority_pgrp(pgid: Option<Pid>, priority: i32) -> io::Result<(
}
}
-#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
+#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))]
#[inline]
pub(crate) fn setpriority_process(pid: Option<Pid>, priority: i32) -> io::Result<()> {
unsafe {
@@ -262,7 +281,12 @@ pub(crate) fn setpriority_process(pid: Option<Pid>, priority: i32) -> io::Result
}
}
-#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "fuchsia",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
#[inline]
pub(crate) fn getrlimit(limit: Resource) -> Rlimit {
let mut result = MaybeUninit::<c::rlimit>::uninit();
@@ -272,7 +296,12 @@ pub(crate) fn getrlimit(limit: Resource) -> Rlimit {
}
}
-#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "fuchsia",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
#[inline]
pub(crate) fn setrlimit(limit: Resource, new: Rlimit) -> io::Result<()> {
let lim = rlimit_to_libc(new)?;
@@ -296,7 +325,12 @@ pub(crate) fn prlimit(pid: Option<Pid>, limit: Resource, new: Rlimit) -> io::Res
}
/// Convert a Rust [`Rlimit`] to a C `c::rlimit`.
-#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "fuchsia",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
fn rlimit_from_libc(lim: c::rlimit) -> Rlimit {
let current = if lim.rlim_cur == c::RLIM_INFINITY {
None
@@ -312,7 +346,12 @@ fn rlimit_from_libc(lim: c::rlimit) -> Rlimit {
}
/// Convert a C `c::rlimit` to a Rust `Rlimit`.
-#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "fuchsia",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
fn rlimit_to_libc(lim: Rlimit) -> io::Result<c::rlimit> {
let Rlimit { current, maximum } = lim;
let rlim_cur = match current {
@@ -326,13 +365,13 @@ fn rlimit_to_libc(lim: Rlimit) -> io::Result<c::rlimit> {
Ok(c::rlimit { rlim_cur, rlim_max })
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
#[inline]
pub(crate) fn wait(waitopts: WaitOptions) -> io::Result<Option<(Pid, WaitStatus)>> {
_waitpid(!0, waitopts)
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
#[inline]
pub(crate) fn waitpid(
pid: Option<Pid>,
@@ -341,7 +380,7 @@ pub(crate) fn waitpid(
_waitpid(Pid::as_raw(pid), waitopts)
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
#[inline]
pub(crate) fn _waitpid(
pid: RawPid,
@@ -354,7 +393,12 @@ pub(crate) fn _waitpid(
}
}
-#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "redox",
+ target_os = "openbsd",
+ target_os = "wasi"
+)))]
#[inline]
pub(crate) fn waitid(id: WaitId<'_>, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
// Get the id to wait on.
@@ -368,7 +412,12 @@ pub(crate) fn waitid(id: WaitId<'_>, options: WaitidOptions) -> io::Result<Optio
}
}
-#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "redox",
+ target_os = "openbsd",
+ target_os = "wasi"
+)))]
#[inline]
fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
// `waitid` can return successfully without initializing the struct (no
@@ -386,7 +435,12 @@ fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
Ok(unsafe { cvt_waitid_status(status) })
}
-#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "redox",
+ target_os = "openbsd",
+ target_os = "wasi"
+)))]
#[inline]
fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
// `waitid` can return successfully without initializing the struct (no
@@ -428,7 +482,12 @@ fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Optio
///
/// The caller must ensure that `status` is initialized and that `waitid`
/// returned successfully.
-#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "openbsd",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
#[inline]
unsafe fn cvt_waitid_status(status: MaybeUninit<c::siginfo_t>) -> Option<WaitidStatus> {
let status = status.assume_init();
@@ -464,13 +523,13 @@ pub(crate) fn setsid() -> io::Result<Pid> {
}
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
#[inline]
pub(crate) fn kill_process(pid: Pid, sig: Signal) -> io::Result<()> {
unsafe { ret(c::kill(pid.as_raw_nonzero().get(), sig as i32)) }
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
#[inline]
pub(crate) fn kill_process_group(pid: Pid, sig: Signal) -> io::Result<()> {
unsafe {
@@ -481,25 +540,24 @@ pub(crate) fn kill_process_group(pid: Pid, sig: Signal) -> io::Result<()> {
}
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
#[inline]
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]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
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"))]
+#[cfg(not(any(target_os = "espidf", 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"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
#[inline]
pub(crate) fn test_kill_current_process_group() -> io::Result<()> {
unsafe { ret(c::kill(0, 0)) }
@@ -561,7 +619,12 @@ pub(crate) fn getgroups(buf: &mut [Gid]) -> io::Result<usize> {
unsafe { ret_usize(c::getgroups(len, buf.as_mut_ptr().cast()) as isize) }
}
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
#[inline]
pub(crate) fn ioctl_tiocsctty(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCSCTTY as _, &0_u32)) }
diff --git a/vendor/rustix/src/backend/libc/process/types.rs b/vendor/rustix/src/backend/libc/process/types.rs
index 980c0effe..9c543acd0 100644
--- a/vendor/rustix/src/backend/libc/process/types.rs
+++ b/vendor/rustix/src/backend/libc/process/types.rs
@@ -40,9 +40,15 @@ pub enum MembarrierCommand {
/// [`getrlimit`]: crate::process::getrlimit
/// [`setrlimit`]: crate::process::setrlimit
/// [`prlimit`]: crate::process::prlimit
-#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "fuchsia",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
-#[repr(u32)]
+#[cfg_attr(not(target_os = "l4re"), repr(u32))]
+#[cfg_attr(target_os = "l4re", repr(u64))]
pub enum Resource {
/// `RLIMIT_CPU`
Cpu = bitcast!(c::RLIMIT_CPU),
@@ -56,7 +62,8 @@ pub enum Resource {
#[cfg(not(target_os = "haiku"))]
Core = bitcast!(c::RLIMIT_CORE),
/// `RLIMIT_RSS`
- #[cfg(not(any(apple, solarish, target_os = "haiku")))]
+ // "nto" has `RLIMIT_RSS`, but it has the same value as `RLIMIT_AS`.
+ #[cfg(not(any(apple, solarish, target_os = "nto", target_os = "haiku")))]
Rss = bitcast!(c::RLIMIT_RSS),
/// `RLIMIT_NPROC`
#[cfg(not(any(solarish, target_os = "haiku")))]
@@ -70,19 +77,49 @@ pub enum Resource {
#[cfg(not(target_os = "openbsd"))]
As = bitcast!(c::RLIMIT_AS),
/// `RLIMIT_LOCKS`
- #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
+ #[cfg(not(any(
+ bsd,
+ solarish,
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "nto"
+ )))]
Locks = bitcast!(c::RLIMIT_LOCKS),
/// `RLIMIT_SIGPENDING`
- #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
+ #[cfg(not(any(
+ bsd,
+ solarish,
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "nto"
+ )))]
Sigpending = bitcast!(c::RLIMIT_SIGPENDING),
/// `RLIMIT_MSGQUEUE`
- #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
+ #[cfg(not(any(
+ bsd,
+ solarish,
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "nto"
+ )))]
Msgqueue = bitcast!(c::RLIMIT_MSGQUEUE),
/// `RLIMIT_NICE`
- #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
+ #[cfg(not(any(
+ bsd,
+ solarish,
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "nto"
+ )))]
Nice = bitcast!(c::RLIMIT_NICE),
/// `RLIMIT_RTPRIO`
- #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
+ #[cfg(not(any(
+ bsd,
+ solarish,
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "nto"
+ )))]
Rtprio = bitcast!(c::RLIMIT_RTPRIO),
/// `RLIMIT_RTTIME`
#[cfg(not(any(
@@ -92,6 +129,7 @@ pub enum Resource {
target_os = "android",
target_os = "emscripten",
target_os = "haiku",
+ target_os = "nto",
)))]
Rttime = bitcast!(c::RLIMIT_RTTIME),
}
@@ -105,7 +143,7 @@ impl Resource {
pub const EXIT_SUCCESS: c::c_int = c::EXIT_SUCCESS;
pub const EXIT_FAILURE: c::c_int = c::EXIT_FAILURE;
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub const EXIT_SIGNALED_SIGABRT: c::c_int = 128 + c::SIGABRT;
/// A CPU identifier as a raw integer.
diff --git a/vendor/rustix/src/backend/libc/pty/syscalls.rs b/vendor/rustix/src/backend/libc/pty/syscalls.rs
index 178201ead..6688ddb26 100644
--- a/vendor/rustix/src/backend/libc/pty/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/pty/syscalls.rs
@@ -31,9 +31,26 @@ pub(crate) fn ptsname(fd: BorrowedFd, mut buffer: Vec<u8>) -> io::Result<CString
loop {
// On platforms with `ptsname_r`, use it.
- #[cfg(any(target_os = "freebsd", linux_like, target_os = "fuchsia"))]
+ #[cfg(any(linux_like, target_os = "fuchsia"))]
let r = unsafe { c::ptsname_r(borrowed_fd(fd), buffer.as_mut_ptr().cast(), buffer.len()) };
+ // FreeBSD 12 doesn't have `ptsname_r`.
+ #[cfg(target_os = "freebsd")]
+ let r = unsafe {
+ weak! {
+ fn ptsname_r(
+ c::c_int,
+ *mut c::c_char,
+ c::size_t
+ ) -> c::c_int
+ }
+ if let Some(func) = ptsname_r.get() {
+ func(borrowed_fd(fd), buffer.as_mut_ptr().cast(), buffer.len())
+ } else {
+ libc::ENOSYS
+ }
+ };
+
// MacOS 10.13.4 has `ptsname_r`; use it if we have it, otherwise fall
// back to calling the underlying ioctl directly.
#[cfg(apple)]
@@ -45,7 +62,7 @@ pub(crate) fn ptsname(fd: BorrowedFd, mut buffer: Vec<u8>) -> io::Result<CString
} else {
// The size declared in the `TIOCPTYGNAME` macro in sys/ttycom.h is 128.
let mut name: [u8; 128] = [0_u8; 128];
- match c::ioctl(borrowed_fd(fd), c::TIOCPTYGNAME as u64, &mut name) {
+ match c::ioctl(borrowed_fd(fd), c::TIOCPTYGNAME as _, &mut name) {
0 => {
let len = CStr::from_ptr(name.as_ptr().cast()).to_bytes().len();
std::ptr::copy_nonoverlapping(name.as_ptr(), buffer.as_mut_ptr(), len + 1);
diff --git a/vendor/rustix/src/backend/libc/system/syscalls.rs b/vendor/rustix/src/backend/libc/system/syscalls.rs
index a731e9302..27efd2653 100644
--- a/vendor/rustix/src/backend/libc/system/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/system/syscalls.rs
@@ -7,7 +7,12 @@ use crate::backend::conv::ret_infallible;
#[cfg(linux_kernel)]
use crate::system::Sysinfo;
use core::mem::MaybeUninit;
-#[cfg(not(any(target_os = "emscripten", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "emscripten",
+ target_os = "espidf",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
use {crate::backend::conv::ret, crate::io};
#[cfg(not(target_os = "wasi"))]
@@ -15,7 +20,15 @@ use {crate::backend::conv::ret, crate::io};
pub(crate) fn uname() -> RawUname {
let mut uname = MaybeUninit::<RawUname>::uninit();
unsafe {
- ret_infallible(c::uname(uname.as_mut_ptr()));
+ let r = c::uname(uname.as_mut_ptr());
+
+ // On POSIX, `uname` is documented to return non-negative on success
+ // instead of the usual 0, though some specific systems do document
+ // that they always use zero allowing us to skip this check.
+ #[cfg(not(any(apple, freebsdlike, linux_like, target_os = "netbsd")))]
+ let r = core::cmp::min(r, 0);
+
+ ret_infallible(r);
uname.assume_init()
}
}
@@ -29,7 +42,12 @@ pub(crate) fn sysinfo() -> Sysinfo {
}
}
-#[cfg(not(any(target_os = "emscripten", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "emscripten",
+ target_os = "espidf",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub(crate) fn sethostname(name: &[u8]) -> io::Result<()> {
unsafe {
ret(c::sethostname(
diff --git a/vendor/rustix/src/backend/libc/termios/syscalls.rs b/vendor/rustix/src/backend/libc/termios/syscalls.rs
index d4182f4fe..ea284927f 100644
--- a/vendor/rustix/src/backend/libc/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/termios/syscalls.rs
@@ -5,21 +5,30 @@
//! See the `rustix::backend::syscalls` module documentation for details.
use crate::backend::c;
-use crate::backend::conv::{borrowed_fd, ret, ret_pid_t};
+#[cfg(not(target_os = "wasi"))]
+use crate::backend::conv::ret_pid_t;
+use crate::backend::conv::{borrowed_fd, ret};
use crate::fd::BorrowedFd;
#[cfg(feature = "procfs")]
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
use crate::ffi::CStr;
+#[cfg(any(
+ not(target_os = "espidf"),
+ all(
+ feature = "procfs",
+ not(any(target_os = "fuchsia", target_os = "wasi"))
+ )
+))]
use core::mem::MaybeUninit;
#[cfg(not(target_os = "wasi"))]
+use {crate::io, crate::pid::Pid};
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
use {
- crate::io,
- crate::pid::Pid,
crate::termios::{Action, OptionalActions, QueueSelector, Termios, Winsize},
crate::utils::as_mut_ptr,
};
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
// If we have `TCGETS2`, use it, so that we fill in the `c_ispeed` and
// `c_ospeed` fields.
@@ -32,7 +41,7 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
ret(c::ioctl(
borrowed_fd(fd),
- c::TCGETS2.into(),
+ c::TCGETS2 as _,
termios2.as_mut_ptr(),
))?;
@@ -58,6 +67,8 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
unsafe {
let mut result = MaybeUninit::<Termios>::uninit();
+ // `result` is a `Termios` which starts with the same layout as
+ // `libc::termios`, so we can cast the pointer.
ret(c::tcgetattr(borrowed_fd(fd), result.as_mut_ptr().cast()))?;
Ok(result.assume_init())
@@ -77,7 +88,7 @@ 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"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub(crate) fn tcsetattr(
fd: BorrowedFd,
optional_actions: OptionalActions,
@@ -104,7 +115,12 @@ pub(crate) fn tcsetattr(
// Translate from `optional_actions` into an ioctl request code. On MIPS,
// `optional_actions` already has `TCGETS` added to it.
let request = TCSETS2
- + if cfg!(any(target_arch = "mips", target_arch = "mips64")) {
+ + if cfg!(any(
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )) {
optional_actions as u32 - TCSETS
} else {
optional_actions as u32
@@ -151,17 +167,17 @@ pub(crate) fn tcsendbreak(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::tcsendbreak(borrowed_fd(fd), 0)) }
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub(crate) fn tcdrain(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::tcdrain(borrowed_fd(fd))) }
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", 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"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub(crate) fn tcflow(fd: BorrowedFd, action: Action) -> io::Result<()> {
unsafe { ret(c::tcflow(borrowed_fd(fd), action as _)) }
}
@@ -174,12 +190,12 @@ pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result<Pid> {
}
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", 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"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub(crate) fn tcgetwinsize(fd: BorrowedFd) -> io::Result<Winsize> {
unsafe {
let mut buf = MaybeUninit::<Winsize>::uninit();
@@ -192,17 +208,27 @@ pub(crate) fn tcgetwinsize(fd: BorrowedFd) -> io::Result<Winsize> {
}
}
-#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub(crate) fn ioctl_tiocexcl(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCEXCL as _)) }
}
-#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
pub(crate) fn ioctl_tiocnxcl(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCNXCL as _)) }
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "nto", target_os = "wasi")))]
#[inline]
pub(crate) fn set_speed(termios: &mut Termios, arbitrary_speed: u32) -> io::Result<()> {
#[cfg(bsd)]
@@ -244,7 +270,7 @@ pub(crate) fn set_speed(termios: &mut Termios, arbitrary_speed: u32) -> io::Resu
}
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
#[inline]
pub(crate) fn set_output_speed(termios: &mut Termios, arbitrary_speed: u32) -> io::Result<()> {
#[cfg(bsd)]
@@ -284,7 +310,7 @@ pub(crate) fn set_output_speed(termios: &mut Termios, arbitrary_speed: u32) -> i
}
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
#[inline]
pub(crate) fn set_input_speed(termios: &mut Termios, arbitrary_speed: u32) -> io::Result<()> {
#[cfg(bsd)]
@@ -324,7 +350,7 @@ pub(crate) fn set_input_speed(termios: &mut Termios, arbitrary_speed: u32) -> io
}
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "espidf", target_os = "nto", target_os = "wasi")))]
#[inline]
pub(crate) fn cfmakeraw(termios: &mut Termios) {
unsafe { c::cfmakeraw(as_mut_ptr(termios).cast()) }
diff --git a/vendor/rustix/src/backend/libc/thread/syscalls.rs b/vendor/rustix/src/backend/libc/thread/syscalls.rs
index 6066fd0d4..5260c39f4 100644
--- a/vendor/rustix/src/backend/libc/thread/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/thread/syscalls.rs
@@ -5,10 +5,7 @@ use crate::backend::conv::ret;
use crate::io;
#[cfg(not(target_os = "redox"))]
use crate::thread::{NanosleepRelativeResult, Timespec};
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
use crate::timespec::LibcTimespec;
use core::mem::MaybeUninit;
#[cfg(linux_kernel)]
@@ -22,6 +19,7 @@ use {
apple,
freebsdlike,
target_os = "emscripten",
+ target_os = "espidf",
target_os = "haiku",
target_os = "openbsd",
target_os = "redox",
@@ -29,21 +27,16 @@ use {
)))]
use {crate::thread::ClockId, core::ptr::null_mut};
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
weak!(fn __clock_nanosleep_time64(c::clockid_t, c::c_int, *const LibcTimespec, *mut LibcTimespec) -> c::c_int);
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
weak!(fn __nanosleep64(*const LibcTimespec, *mut LibcTimespec) -> c::c_int);
#[cfg(not(any(
apple,
target_os = "dragonfly",
target_os = "emscripten",
+ target_os = "espidf",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
target_os = "openbsd",
@@ -52,41 +45,38 @@ weak!(fn __nanosleep64(*const LibcTimespec, *mut LibcTimespec) -> c::c_int);
)))]
#[inline]
pub(crate) fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> NanosleepRelativeResult {
- let flags = 0;
-
- // 32-bit gnu version: libc has `clock_nanosleep` but it is not y2038 safe
- // by default.
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
- unsafe {
- let mut remain = MaybeUninit::<LibcTimespec>::uninit();
-
+ // Old 32-bit version: libc has `clock_nanosleep` but it is not y2038 safe
+ // by default. But there may be a `__clock_nanosleep_time64` we can use.
+ #[cfg(fix_y2038)]
+ {
+ #[cfg(target_env = "gnu")]
if let Some(libc_clock_nanosleep) = __clock_nanosleep_time64.get() {
- match libc_clock_nanosleep(
- id as c::clockid_t,
- flags,
- &request.clone().into(),
- remain.as_mut_ptr(),
- ) {
- 0 => NanosleepRelativeResult::Ok,
- err if err == io::Errno::INTR.0 => {
- NanosleepRelativeResult::Interrupted(remain.assume_init().into())
- }
- err => NanosleepRelativeResult::Err(io::Errno(err)),
+ let flags = 0;
+ let mut remain = MaybeUninit::<LibcTimespec>::uninit();
+
+ unsafe {
+ return match libc_clock_nanosleep(
+ id as c::clockid_t,
+ flags,
+ &request.clone().into(),
+ remain.as_mut_ptr(),
+ ) {
+ 0 => NanosleepRelativeResult::Ok,
+ err if err == io::Errno::INTR.0 => {
+ NanosleepRelativeResult::Interrupted(remain.assume_init().into())
+ }
+ err => NanosleepRelativeResult::Err(io::Errno(err)),
+ };
}
- } else {
- clock_nanosleep_relative_old(id, request)
}
+
+ clock_nanosleep_relative_old(id, request)
}
// Main version: libc is y2038 safe and has `clock_nanosleep`.
- #[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )))]
+ #[cfg(not(fix_y2038))]
unsafe {
+ let flags = 0;
let mut remain = MaybeUninit::<Timespec>::uninit();
match c::clock_nanosleep(id as c::clockid_t, flags, request, remain.as_mut_ptr()) {
@@ -100,10 +90,10 @@ pub(crate) fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> Nanos
}
#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
+ fix_y2038,
+ not(any(apple, target_os = "emscripten", target_os = "haiku"))
))]
-unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> NanosleepRelativeResult {
+fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> NanosleepRelativeResult {
let tv_sec = match request.tv_sec.try_into() {
Ok(tv_sec) => tv_sec,
Err(_) => return NanosleepRelativeResult::Err(io::Errno::OVERFLOW),
@@ -116,22 +106,24 @@ unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> Nanos
let mut old_remain = MaybeUninit::<c::timespec>::uninit();
let flags = 0;
- match c::clock_nanosleep(
- id as c::clockid_t,
- flags,
- &old_request,
- old_remain.as_mut_ptr(),
- ) {
- 0 => NanosleepRelativeResult::Ok,
- err if err == io::Errno::INTR.0 => {
- let old_remain = old_remain.assume_init();
- let remain = Timespec {
- tv_sec: old_remain.tv_sec.into(),
- tv_nsec: old_remain.tv_nsec.into(),
- };
- NanosleepRelativeResult::Interrupted(remain)
+ unsafe {
+ match c::clock_nanosleep(
+ id as c::clockid_t,
+ flags,
+ &old_request,
+ old_remain.as_mut_ptr(),
+ ) {
+ 0 => NanosleepRelativeResult::Ok,
+ err if err == io::Errno::INTR.0 => {
+ let old_remain = old_remain.assume_init();
+ let remain = Timespec {
+ tv_sec: old_remain.tv_sec.into(),
+ tv_nsec: old_remain.tv_nsec.into(),
+ };
+ NanosleepRelativeResult::Interrupted(remain)
+ }
+ err => NanosleepRelativeResult::Err(io::Errno(err)),
}
- err => NanosleepRelativeResult::Err(io::Errno(err)),
}
}
@@ -139,6 +131,7 @@ unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> Nanos
apple,
target_os = "dragonfly",
target_os = "emscripten",
+ target_os = "espidf",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
target_os = "openbsd",
@@ -147,46 +140,46 @@ unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> Nanos
)))]
#[inline]
pub(crate) fn clock_nanosleep_absolute(id: ClockId, request: &Timespec) -> io::Result<()> {
- let flags = c::TIMER_ABSTIME;
-
- // 32-bit gnu version: libc has `clock_nanosleep` but it is not y2038 safe
- // by default.
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
+ // Old 32-bit version: libc has `clock_nanosleep` but it is not y2038 safe
+ // by default. But there may be a `__clock_nanosleep_time64` we can use.
+ #[cfg(fix_y2038)]
{
+ #[cfg(target_env = "gnu")]
if let Some(libc_clock_nanosleep) = __clock_nanosleep_time64.get() {
- match unsafe {
- libc_clock_nanosleep(
- id as c::clockid_t,
- flags,
- &request.clone().into(),
- null_mut(),
- )
- } {
- 0 => Ok(()),
- err => Err(io::Errno(err)),
+ let flags = c::TIMER_ABSTIME;
+ unsafe {
+ return match {
+ libc_clock_nanosleep(
+ id as c::clockid_t,
+ flags,
+ &request.clone().into(),
+ null_mut(),
+ )
+ } {
+ 0 => Ok(()),
+ err => Err(io::Errno(err)),
+ };
}
- } else {
- clock_nanosleep_absolute_old(id, request)
}
+
+ clock_nanosleep_absolute_old(id, request)
}
// Main version: libc is y2038 safe and has `clock_nanosleep`.
- #[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )))]
- match unsafe { c::clock_nanosleep(id as c::clockid_t, flags, request, null_mut()) } {
- 0 => Ok(()),
- err => Err(io::Errno(err)),
+ #[cfg(not(fix_y2038))]
+ {
+ let flags = c::TIMER_ABSTIME;
+
+ match unsafe { c::clock_nanosleep(id as c::clockid_t, flags as _, request, null_mut()) } {
+ 0 => Ok(()),
+ err => Err(io::Errno(err)),
+ }
}
}
#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
+ fix_y2038,
+ not(any(apple, target_os = "emscripten", target_os = "haiku"))
))]
fn clock_nanosleep_absolute_old(id: ClockId, request: &Timespec) -> io::Result<()> {
let flags = c::TIMER_ABSTIME;
@@ -204,33 +197,29 @@ fn clock_nanosleep_absolute_old(id: ClockId, request: &Timespec) -> io::Result<(
#[cfg(not(target_os = "redox"))]
#[inline]
pub(crate) fn nanosleep(request: &Timespec) -> NanosleepRelativeResult {
- // 32-bit gnu version: libc has `nanosleep` but it is not y2038 safe by
- // default.
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
- unsafe {
- let mut remain = MaybeUninit::<LibcTimespec>::uninit();
-
+ // Old 32-bit version: libc has `nanosleep` but it is not y2038 safe by
+ // default. But there may be a `__nanosleep64` we can use.
+ #[cfg(fix_y2038)]
+ {
+ #[cfg(target_env = "gnu")]
if let Some(libc_nanosleep) = __nanosleep64.get() {
- match ret(libc_nanosleep(&request.clone().into(), remain.as_mut_ptr())) {
- Ok(()) => NanosleepRelativeResult::Ok,
- Err(io::Errno::INTR) => {
- NanosleepRelativeResult::Interrupted(remain.assume_init().into())
- }
- Err(err) => NanosleepRelativeResult::Err(err),
+ let mut remain = MaybeUninit::<LibcTimespec>::uninit();
+ unsafe {
+ return match ret(libc_nanosleep(&request.clone().into(), remain.as_mut_ptr())) {
+ Ok(()) => NanosleepRelativeResult::Ok,
+ Err(io::Errno::INTR) => {
+ NanosleepRelativeResult::Interrupted(remain.assume_init().into())
+ }
+ Err(err) => NanosleepRelativeResult::Err(err),
+ };
}
- } else {
- nanosleep_old(request)
}
+
+ nanosleep_old(request)
}
// Main version: libc is y2038 safe and has `nanosleep`.
- #[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )))]
+ #[cfg(not(fix_y2038))]
unsafe {
let mut remain = MaybeUninit::<Timespec>::uninit();
@@ -242,11 +231,8 @@ pub(crate) fn nanosleep(request: &Timespec) -> NanosleepRelativeResult {
}
}
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
-unsafe fn nanosleep_old(request: &Timespec) -> NanosleepRelativeResult {
+#[cfg(fix_y2038)]
+fn nanosleep_old(request: &Timespec) -> NanosleepRelativeResult {
let tv_sec = match request.tv_sec.try_into() {
Ok(tv_sec) => tv_sec,
Err(_) => return NanosleepRelativeResult::Err(io::Errno::OVERFLOW),
@@ -258,17 +244,19 @@ unsafe fn nanosleep_old(request: &Timespec) -> NanosleepRelativeResult {
let old_request = c::timespec { tv_sec, tv_nsec };
let mut old_remain = MaybeUninit::<c::timespec>::uninit();
- match ret(c::nanosleep(&old_request, old_remain.as_mut_ptr())) {
- Ok(()) => NanosleepRelativeResult::Ok,
- Err(io::Errno::INTR) => {
- let old_remain = old_remain.assume_init();
- let remain = Timespec {
- tv_sec: old_remain.tv_sec.into(),
- tv_nsec: old_remain.tv_nsec.into(),
- };
- NanosleepRelativeResult::Interrupted(remain)
+ unsafe {
+ match ret(c::nanosleep(&old_request, old_remain.as_mut_ptr())) {
+ Ok(()) => NanosleepRelativeResult::Ok,
+ Err(io::Errno::INTR) => {
+ let old_remain = old_remain.assume_init();
+ let remain = Timespec {
+ tv_sec: old_remain.tv_sec.into(),
+ tv_nsec: old_remain.tv_nsec.into(),
+ };
+ NanosleepRelativeResult::Interrupted(remain)
+ }
+ Err(err) => NanosleepRelativeResult::Err(err),
}
- Err(err) => NanosleepRelativeResult::Err(err),
}
}
diff --git a/vendor/rustix/src/backend/libc/time/syscalls.rs b/vendor/rustix/src/backend/libc/time/syscalls.rs
index 14ca22b2d..603a3b108 100644
--- a/vendor/rustix/src/backend/libc/time/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/time/syscalls.rs
@@ -2,13 +2,14 @@
use crate::backend::c;
use crate::backend::conv::ret;
+#[cfg(any(linux_kernel, target_os = "fuchsia"))]
+#[cfg(feature = "time")]
+#[cfg(any(all(target_env = "gnu", fix_y2038), not(fix_y2038)))]
+use crate::backend::time::types::LibcItimerspec;
#[cfg(not(target_os = "wasi"))]
use crate::clockid::{ClockId, DynamicClockId};
use crate::io;
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
use crate::timespec::LibcTimespec;
use crate::timespec::Timespec;
use core::mem::MaybeUninit;
@@ -16,36 +17,22 @@ use core::mem::MaybeUninit;
#[cfg(feature = "time")]
use {
crate::backend::conv::{borrowed_fd, ret_owned_fd},
- crate::backend::time::types::LibcItimerspec,
crate::fd::{BorrowedFd, OwnedFd},
crate::time::{Itimerspec, TimerfdClockId, TimerfdFlags, TimerfdTimerFlags},
};
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
weak!(fn __clock_gettime64(c::clockid_t, *mut LibcTimespec) -> c::c_int);
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
weak!(fn __clock_settime64(c::clockid_t, *const LibcTimespec) -> c::c_int);
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
weak!(fn __clock_getres64(c::clockid_t, *mut LibcTimespec) -> c::c_int);
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(any(linux_kernel, target_os = "fuchsia"))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
#[cfg(feature = "time")]
weak!(fn __timerfd_gettime64(c::c_int, *mut LibcItimerspec) -> c::c_int);
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(any(linux_kernel, target_os = "fuchsia"))]
+#[cfg(all(target_env = "gnu", fix_y2038))]
#[cfg(feature = "time")]
weak!(fn __timerfd_settime64(c::c_int, c::c_int, *const LibcItimerspec, *mut LibcItimerspec) -> c::c_int);
@@ -53,28 +40,24 @@ weak!(fn __timerfd_settime64(c::c_int, c::c_int, *const LibcItimerspec, *mut Lib
#[inline]
#[must_use]
pub(crate) fn clock_getres(id: ClockId) -> Timespec {
- // 32-bit gnu version: libc has `clock_getres` but it is not y2038 safe by
- // default.
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
- unsafe {
- let mut timespec = MaybeUninit::<LibcTimespec>::uninit();
-
+ // Old 32-bit version: libc has `clock_getres` but it is not y2038 safe by
+ // default. But there may be a `__clock_getres64` we can use.
+ #[cfg(fix_y2038)]
+ {
+ #[cfg(target_env = "gnu")]
if let Some(libc_clock_getres) = __clock_getres64.get() {
- ret(libc_clock_getres(id as c::clockid_t, timespec.as_mut_ptr())).unwrap();
- timespec.assume_init().into()
- } else {
- clock_getres_old(id)
+ let mut timespec = MaybeUninit::<LibcTimespec>::uninit();
+ unsafe {
+ ret(libc_clock_getres(id as c::clockid_t, timespec.as_mut_ptr())).unwrap();
+ return timespec.assume_init().into();
+ }
}
+
+ clock_getres_old(id)
}
// Main version: libc is y2038 safe and has `clock_getres`.
- #[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )))]
+ #[cfg(not(fix_y2038))]
unsafe {
let mut timespec = MaybeUninit::<Timespec>::uninit();
let _ = c::clock_getres(id as c::clockid_t, timespec.as_mut_ptr());
@@ -82,19 +65,20 @@ pub(crate) fn clock_getres(id: ClockId) -> Timespec {
}
}
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(fix_y2038)]
#[must_use]
-unsafe fn clock_getres_old(id: ClockId) -> Timespec {
+fn clock_getres_old(id: ClockId) -> Timespec {
let mut old_timespec = MaybeUninit::<c::timespec>::uninit();
- ret(c::clock_getres(
- id as c::clockid_t,
- old_timespec.as_mut_ptr(),
- ))
- .unwrap();
- let old_timespec = old_timespec.assume_init();
+
+ let old_timespec = unsafe {
+ ret(c::clock_getres(
+ id as c::clockid_t,
+ old_timespec.as_mut_ptr(),
+ ))
+ .unwrap();
+ old_timespec.assume_init()
+ };
+
Timespec {
tv_sec: old_timespec.tv_sec.into(),
tv_nsec: old_timespec.tv_nsec.into(),
@@ -105,33 +89,31 @@ unsafe fn clock_getres_old(id: ClockId) -> Timespec {
#[inline]
#[must_use]
pub(crate) fn clock_gettime(id: ClockId) -> Timespec {
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
- unsafe {
- let mut timespec = MaybeUninit::<LibcTimespec>::uninit();
-
+ // Old 32-bit version: libc has `clock_gettime` but it is not y2038 safe by
+ // default. But there may be a `__clock_gettime64` we can use.
+ #[cfg(fix_y2038)]
+ {
+ #[cfg(target_env = "gnu")]
if let Some(libc_clock_gettime) = __clock_gettime64.get() {
- ret(libc_clock_gettime(
- id as c::clockid_t,
- timespec.as_mut_ptr(),
- ))
- .unwrap();
- timespec.assume_init().into()
- } else {
- clock_gettime_old(id)
+ let mut timespec = MaybeUninit::<LibcTimespec>::uninit();
+ unsafe {
+ ret(libc_clock_gettime(
+ id as c::clockid_t,
+ timespec.as_mut_ptr(),
+ ))
+ .unwrap();
+ return timespec.assume_init().into();
+ }
}
+
+ clock_gettime_old(id)
}
// Use `unwrap()` here because `clock_getres` can fail if the clock itself
// overflows a number of seconds, but if that happens, the monotonic clocks
// can't maintain their invariants, or the realtime clocks aren't properly
// configured.
- #[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )))]
+ #[cfg(not(fix_y2038))]
unsafe {
let mut timespec = MaybeUninit::<Timespec>::uninit();
ret(c::clock_gettime(id as c::clockid_t, timespec.as_mut_ptr())).unwrap();
@@ -139,19 +121,20 @@ pub(crate) fn clock_gettime(id: ClockId) -> Timespec {
}
}
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(fix_y2038)]
#[must_use]
-unsafe fn clock_gettime_old(id: ClockId) -> Timespec {
+fn clock_gettime_old(id: ClockId) -> Timespec {
let mut old_timespec = MaybeUninit::<c::timespec>::uninit();
- ret(c::clock_gettime(
- id as c::clockid_t,
- old_timespec.as_mut_ptr(),
- ))
- .unwrap();
- let old_timespec = old_timespec.assume_init();
+
+ let old_timespec = unsafe {
+ ret(c::clock_gettime(
+ id as c::clockid_t,
+ old_timespec.as_mut_ptr(),
+ ))
+ .unwrap();
+ old_timespec.assume_init()
+ };
+
Timespec {
tv_sec: old_timespec.tv_sec.into(),
tv_nsec: old_timespec.tv_nsec.into(),
@@ -161,83 +144,85 @@ unsafe fn clock_gettime_old(id: ClockId) -> Timespec {
#[cfg(not(target_os = "wasi"))]
#[inline]
pub(crate) fn clock_gettime_dynamic(id: DynamicClockId<'_>) -> io::Result<Timespec> {
- unsafe {
- let id: c::clockid_t = match id {
- DynamicClockId::Known(id) => id as c::clockid_t,
-
- #[cfg(linux_kernel)]
- DynamicClockId::Dynamic(fd) => {
- use crate::fd::AsRawFd;
- const CLOCKFD: i32 = 3;
- (!fd.as_raw_fd() << 3) | CLOCKFD
- }
+ let id: c::clockid_t = match id {
+ DynamicClockId::Known(id) => id as c::clockid_t,
+
+ #[cfg(linux_kernel)]
+ DynamicClockId::Dynamic(fd) => {
+ use crate::fd::AsRawFd;
+ const CLOCKFD: i32 = 3;
+ (!fd.as_raw_fd() << 3) | CLOCKFD
+ }
- #[cfg(not(linux_kernel))]
- DynamicClockId::Dynamic(_fd) => {
- // Dynamic clocks are not supported on this platform.
- return Err(io::Errno::INVAL);
- }
+ #[cfg(not(linux_kernel))]
+ DynamicClockId::Dynamic(_fd) => {
+ // Dynamic clocks are not supported on this platform.
+ return Err(io::Errno::INVAL);
+ }
- #[cfg(linux_kernel)]
- DynamicClockId::RealtimeAlarm => c::CLOCK_REALTIME_ALARM,
+ #[cfg(linux_kernel)]
+ DynamicClockId::RealtimeAlarm => c::CLOCK_REALTIME_ALARM,
- #[cfg(linux_kernel)]
- DynamicClockId::Tai => c::CLOCK_TAI,
+ #[cfg(linux_kernel)]
+ DynamicClockId::Tai => c::CLOCK_TAI,
- #[cfg(any(linux_kernel, target_os = "openbsd"))]
- DynamicClockId::Boottime => c::CLOCK_BOOTTIME,
+ #[cfg(any(
+ freebsdlike,
+ linux_kernel,
+ target_os = "fuchsia",
+ target_os = "openbsd"
+ ))]
+ DynamicClockId::Boottime => c::CLOCK_BOOTTIME,
- #[cfg(linux_kernel)]
- DynamicClockId::BoottimeAlarm => c::CLOCK_BOOTTIME_ALARM,
- };
+ #[cfg(any(linux_kernel, target_os = "fuchsia"))]
+ DynamicClockId::BoottimeAlarm => c::CLOCK_BOOTTIME_ALARM,
+ };
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
- {
+ // Old 32-bit version: libc has `clock_gettime` but it is not y2038
+ // safe by default. But there may be a `__clock_gettime64` we can use.
+ #[cfg(fix_y2038)]
+ {
+ #[cfg(target_env = "gnu")]
+ if let Some(libc_clock_gettime) = __clock_gettime64.get() {
let mut timespec = MaybeUninit::<LibcTimespec>::uninit();
-
- if let Some(libc_clock_gettime) = __clock_gettime64.get() {
+ unsafe {
ret(libc_clock_gettime(
id as c::clockid_t,
timespec.as_mut_ptr(),
))?;
- Ok(timespec.assume_init().into())
- } else {
- clock_gettime_dynamic_old(id)
+ return Ok(timespec.assume_init().into());
}
}
- #[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )))]
- {
- let mut timespec = MaybeUninit::<Timespec>::uninit();
+ clock_gettime_dynamic_old(id)
+ }
+
+ // Main version: libc is y2038 safe and has `clock_gettime`.
+ #[cfg(not(fix_y2038))]
+ unsafe {
+ let mut timespec = MaybeUninit::<Timespec>::uninit();
- ret(c::clock_gettime(id as c::clockid_t, timespec.as_mut_ptr()))?;
+ ret(c::clock_gettime(id as c::clockid_t, timespec.as_mut_ptr()))?;
- Ok(timespec.assume_init())
- }
+ Ok(timespec.assume_init())
}
}
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(fix_y2038)]
#[inline]
-unsafe fn clock_gettime_dynamic_old(id: c::clockid_t) -> io::Result<Timespec> {
+fn clock_gettime_dynamic_old(id: c::clockid_t) -> io::Result<Timespec> {
let mut old_timespec = MaybeUninit::<c::timespec>::uninit();
- ret(c::clock_gettime(
- id as c::clockid_t,
- old_timespec.as_mut_ptr(),
- ))?;
+ let old_timespec = unsafe {
+ ret(c::clock_gettime(
+ id as c::clockid_t,
+ old_timespec.as_mut_ptr(),
+ ))?;
+
+ old_timespec.assume_init()
+ };
- let old_timespec = old_timespec.assume_init();
Ok(Timespec {
tv_sec: old_timespec.tv_sec.into(),
tv_nsec: old_timespec.tv_nsec.into(),
@@ -251,25 +236,25 @@ unsafe fn clock_gettime_dynamic_old(id: c::clockid_t) -> io::Result<Timespec> {
)))]
#[inline]
pub(crate) fn clock_settime(id: ClockId, timespec: Timespec) -> io::Result<()> {
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
- unsafe {
+ // Old 32-bit version: libc has `clock_gettime` but it is not y2038 safe by
+ // default. But there may be a `__clock_settime64` we can use.
+ #[cfg(fix_y2038)]
+ {
+ #[cfg(target_env = "gnu")]
if let Some(libc_clock_settime) = __clock_settime64.get() {
- let mut new_timespec = core::mem::zeroed::<LibcTimespec>();
- new_timespec.tv_sec = timespec.tv_sec;
- new_timespec.tv_nsec = timespec.tv_nsec as _;
- ret(libc_clock_settime(id as c::clockid_t, &new_timespec))
- } else {
- clock_settime_old(id, timespec)
+ unsafe {
+ let mut new_timespec = core::mem::zeroed::<LibcTimespec>();
+ new_timespec.tv_sec = timespec.tv_sec;
+ new_timespec.tv_nsec = timespec.tv_nsec as _;
+ return ret(libc_clock_settime(id as c::clockid_t, &new_timespec));
+ }
}
+
+ clock_settime_old(id, timespec)
}
- #[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )))]
+ // Main version: libc is y2038 safe and has `clock_settime`.
+ #[cfg(not(fix_y2038))]
unsafe {
ret(c::clock_settime(id as c::clockid_t, &timespec))
}
@@ -280,11 +265,8 @@ pub(crate) fn clock_settime(id: ClockId, timespec: Timespec) -> io::Result<()> {
target_os = "wasi",
all(apple, not(target_os = "macos"))
)))]
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
-unsafe fn clock_settime_old(id: ClockId, timespec: Timespec) -> io::Result<()> {
+#[cfg(fix_y2038)]
+fn clock_settime_old(id: ClockId, timespec: Timespec) -> io::Result<()> {
let old_timespec = c::timespec {
tv_sec: timespec
.tv_sec
@@ -292,7 +274,8 @@ unsafe fn clock_settime_old(id: ClockId, timespec: Timespec) -> io::Result<()> {
.map_err(|_| io::Errno::OVERFLOW)?,
tv_nsec: timespec.tv_nsec as _,
};
- ret(c::clock_settime(id as c::clockid_t, &old_timespec))
+
+ unsafe { ret(c::clock_settime(id as c::clockid_t, &old_timespec)) }
}
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
@@ -308,31 +291,30 @@ pub(crate) fn timerfd_settime(
flags: TimerfdTimerFlags,
new_value: &Itimerspec,
) -> io::Result<Itimerspec> {
- let mut result = MaybeUninit::<LibcItimerspec>::uninit();
-
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
- unsafe {
+ // Old 32-bit version: libc has `timerfd_settime` but it is not y2038 safe
+ // by default. But there may be a `__timerfd_settime64` we can use.
+ #[cfg(fix_y2038)]
+ {
+ #[cfg(target_env = "gnu")]
if let Some(libc_timerfd_settime) = __timerfd_settime64.get() {
- ret(libc_timerfd_settime(
- borrowed_fd(fd),
- bitflags_bits!(flags),
- &new_value.clone().into(),
- result.as_mut_ptr(),
- ))?;
- Ok(result.assume_init().into())
- } else {
- timerfd_settime_old(fd, flags, new_value)
+ let mut result = MaybeUninit::<LibcItimerspec>::uninit();
+ unsafe {
+ ret(libc_timerfd_settime(
+ borrowed_fd(fd),
+ bitflags_bits!(flags),
+ &new_value.clone().into(),
+ result.as_mut_ptr(),
+ ))?;
+ return Ok(result.assume_init().into());
+ }
}
+
+ timerfd_settime_old(fd, flags, new_value)
}
- #[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )))]
+ #[cfg(not(fix_y2038))]
unsafe {
+ let mut result = MaybeUninit::<LibcItimerspec>::uninit();
ret(c::timerfd_settime(
borrowed_fd(fd),
bitflags_bits!(flags),
@@ -344,12 +326,9 @@ pub(crate) fn timerfd_settime(
}
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(fix_y2038)]
#[cfg(feature = "time")]
-unsafe fn timerfd_settime_old(
+fn timerfd_settime_old(
fd: BorrowedFd<'_>,
flags: TimerfdTimerFlags,
new_value: &Itimerspec,
@@ -384,14 +363,16 @@ unsafe fn timerfd_settime_old(
},
};
- ret(c::timerfd_settime(
- borrowed_fd(fd),
- bitflags_bits!(flags),
- &old_new_value,
- old_result.as_mut_ptr(),
- ))?;
+ let old_result = unsafe {
+ ret(c::timerfd_settime(
+ borrowed_fd(fd),
+ bitflags_bits!(flags),
+ &old_new_value,
+ old_result.as_mut_ptr(),
+ ))?;
+ old_result.assume_init()
+ };
- let old_result = old_result.assume_init();
Ok(Itimerspec {
it_interval: Timespec {
tv_sec: old_result
@@ -415,43 +396,41 @@ unsafe fn timerfd_settime_old(
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
#[cfg(feature = "time")]
pub(crate) fn timerfd_gettime(fd: BorrowedFd<'_>) -> io::Result<Itimerspec> {
- let mut result = MaybeUninit::<LibcItimerspec>::uninit();
-
- #[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- ))]
- unsafe {
+ // Old 32-bit version: libc has `timerfd_gettime` but it is not y2038 safe
+ // by default. But there may be a `__timerfd_gettime64` we can use.
+ #[cfg(fix_y2038)]
+ {
+ #[cfg(target_env = "gnu")]
if let Some(libc_timerfd_gettime) = __timerfd_gettime64.get() {
- ret(libc_timerfd_gettime(borrowed_fd(fd), result.as_mut_ptr()))?;
- Ok(result.assume_init().into())
- } else {
- timerfd_gettime_old(fd)
+ let mut result = MaybeUninit::<LibcItimerspec>::uninit();
+ unsafe {
+ ret(libc_timerfd_gettime(borrowed_fd(fd), result.as_mut_ptr()))?;
+ return Ok(result.assume_init().into());
+ }
}
+
+ timerfd_gettime_old(fd)
}
- #[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
- )))]
+ #[cfg(not(fix_y2038))]
unsafe {
+ let mut result = MaybeUninit::<LibcItimerspec>::uninit();
ret(c::timerfd_gettime(borrowed_fd(fd), result.as_mut_ptr()))?;
Ok(result.assume_init())
}
}
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(fix_y2038)]
#[cfg(feature = "time")]
-unsafe fn timerfd_gettime_old(fd: BorrowedFd<'_>) -> io::Result<Itimerspec> {
+fn timerfd_gettime_old(fd: BorrowedFd<'_>) -> io::Result<Itimerspec> {
let mut old_result = MaybeUninit::<c::itimerspec>::uninit();
- ret(c::timerfd_gettime(borrowed_fd(fd), old_result.as_mut_ptr()))?;
+ let old_result = unsafe {
+ ret(c::timerfd_gettime(borrowed_fd(fd), old_result.as_mut_ptr()))?;
+ old_result.assume_init()
+ };
- let old_result = old_result.assume_init();
Ok(Itimerspec {
it_interval: Timespec {
tv_sec: old_result
diff --git a/vendor/rustix/src/backend/libc/time/types.rs b/vendor/rustix/src/backend/libc/time/types.rs
index e1d4a8736..75cc61217 100644
--- a/vendor/rustix/src/backend/libc/time/types.rs
+++ b/vendor/rustix/src/backend/libc/time/types.rs
@@ -1,15 +1,10 @@
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
use crate::backend::c;
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(any(linux_kernel, target_os = "fuchsia"))]
+#[cfg(fix_y2038)]
use crate::timespec::LibcTimespec;
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(fix_y2038)]
use crate::timespec::Timespec;
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
use bitflags::bitflags;
@@ -20,10 +15,7 @@ use bitflags::bitflags;
/// [`timerfd_gettime`]: crate::time::timerfd_gettime
/// [`timerfd_settime`]: crate::time::timerfd_settime
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
-#[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-)))]
+#[cfg(not(fix_y2038))]
pub type Itimerspec = c::itimerspec;
/// `struct itimerspec` for use with [`timerfd_gettime`] and
@@ -32,10 +24,7 @@ pub type Itimerspec = c::itimerspec;
/// [`timerfd_gettime`]: crate::time::timerfd_gettime
/// [`timerfd_settime`]: crate::time::timerfd_settime
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(fix_y2038)]
#[allow(missing_docs)]
#[repr(C)]
#[derive(Debug, Clone)]
@@ -46,19 +35,13 @@ pub struct Itimerspec {
/// On most platforms, `LibcItimerspec` is just `Itimerspec`.
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
-#[cfg(not(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-)))]
+#[cfg(not(fix_y2038))]
pub(crate) type LibcItimerspec = Itimerspec;
/// On 32-bit glibc platforms, `LibcTimespec` differs from `Timespec`, so we
/// define our own struct, with bidirectional `From` impls.
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(fix_y2038)]
#[repr(C)]
#[derive(Debug, Clone)]
pub(crate) struct LibcItimerspec {
@@ -67,10 +50,7 @@ pub(crate) struct LibcItimerspec {
}
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(fix_y2038)]
impl From<LibcItimerspec> for Itimerspec {
#[inline]
fn from(t: LibcItimerspec) -> Self {
@@ -82,10 +62,7 @@ impl From<LibcItimerspec> for Itimerspec {
}
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
-#[cfg(all(
- any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
- target_env = "gnu",
-))]
+#[cfg(fix_y2038)]
impl From<Itimerspec> for LibcItimerspec {
#[inline]
fn from(t: Itimerspec) -> Self {
@@ -179,7 +156,6 @@ pub enum TimerfdClockId {
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
#[test]
fn test_types() {
- use core::mem::size_of;
- assert_eq!(size_of::<TimerfdFlags>(), size_of::<c::c_int>());
- assert_eq!(size_of::<TimerfdTimerFlags>(), size_of::<c::c_int>());
+ assert_eq_size!(TimerfdFlags, c::c_int);
+ assert_eq_size!(TimerfdTimerFlags, c::c_int);
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/aarch64.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/aarch64.rs
index 0f4465d51..0f4465d51 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/aarch64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/aarch64.rs
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/arm.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/arm.rs
index 9695c6028..9695c6028 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/arm.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/arm.rs
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/mips.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mips.rs
index b39a16847..b39a16847 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/mips.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/mips.rs
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs
new file mode 100644
index 000000000..718e94fa7
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs
@@ -0,0 +1,543 @@
+//! mipsisa32r6el Linux system calls.
+//!
+//! On mipsisa32r6el, Linux indicates success or failure using `$a3` rather
+//! than by returning a negative error code as most other architectures do.
+//!
+//! Mips-family platforms have a special calling convention for `__NR_pipe`,
+//! however we use `__NR_pipe2` instead to avoid having to implement it.
+
+use crate::backend::reg::{
+ ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, A6, R0,
+};
+use core::arch::asm;
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall1_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+ asm!(
+ "syscall",
+ in("$2" /*$v0*/) nr.to_asm(),
+ in("$4" /*$a0*/) a0.to_asm(),
+ options(noreturn)
+ )
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall2(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall2_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall3(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall3_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall4(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall4_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall5(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ ".set noat",
+ "subu $sp, 32",
+ "sw {}, 16($sp)",
+ "syscall",
+ "addu $sp, 32",
+ ".set at",
+ in(reg) a4.to_asm(),
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall5_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ ".set noat",
+ "subu $sp, 32",
+ "sw {}, 16($sp)",
+ "syscall",
+ "addu $sp, 32",
+ ".set at",
+ in(reg) a4.to_asm(),
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall6(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+ a5: ArgReg<'_, A5>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ ".set noat",
+ "subu $sp, 32",
+ "sw {}, 16($sp)",
+ "sw {}, 20($sp)",
+ "syscall",
+ "addu $sp, 32",
+ ".set at",
+ in(reg) a4.to_asm(),
+ in(reg) a5.to_asm(),
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall6_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+ a5: ArgReg<'_, A5>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ ".set noat",
+ "subu $sp, 32",
+ "sw {}, 16($sp)",
+ "sw {}, 20($sp)",
+ "syscall",
+ "addu $sp, 32",
+ ".set at",
+ in(reg) a4.to_asm(),
+ in(reg) a5.to_asm(),
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall7_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+ a5: ArgReg<'_, A5>,
+ a6: ArgReg<'_, A6>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ ".set noat",
+ "subu $sp, 32",
+ "sw {}, 16($sp)",
+ "sw {}, 20($sp)",
+ "sw {}, 24($sp)",
+ "syscall",
+ "addu $sp, 32",
+ ".set at",
+ in(reg) a4.to_asm(),
+ in(reg) a5.to_asm(),
+ in(reg) a6.to_asm(),
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ lateout("$8" /*$t0*/) _,
+ lateout("$9" /*$t1*/) _,
+ lateout("$10" /*$t2*/) _,
+ lateout("$11" /*$t3*/) _,
+ lateout("$12" /*$t4*/) _,
+ lateout("$13" /*$t5*/) _,
+ lateout("$14" /*$t6*/) _,
+ lateout("$15" /*$t7*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/mips64.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mips64.rs
index d3c7d341f..d3c7d341f 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/mips64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/mips64.rs
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs
new file mode 100644
index 000000000..0a2ebebce
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs
@@ -0,0 +1,470 @@
+//! mipsisa64r6el Linux system calls.
+//!
+//! On mipsisa64r6el, Linux indicates success or failure using `$a3` (`$7`)
+//! rather than by returning a negative error code as most other architectures
+//! do.
+//!
+//! Mips-family platforms have a special calling convention for `__NR_pipe`,
+//! however we use `__NR_pipe2` instead to avoid having to implement it.
+//!
+//! Note that MIPS R6 inline assembly currently doesn't differ from MIPS,
+//! because no explicit call of R6-only or R2-only instructions exist here.
+
+use crate::backend::reg::{
+ ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0,
+};
+use core::arch::asm;
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$a4*/) _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$a4*/) _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall1_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$a4*/) _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+ asm!(
+ "syscall",
+ in("$2" /*$v0*/) nr.to_asm(),
+ in("$4" /*$a0*/) a0.to_asm(),
+ options(noreturn)
+ )
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall2(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$a4*/) _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall2_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$a4*/) _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall3(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$a4*/) _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall3_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ lateout("$7" /*$a3*/) err,
+ lateout("$8" /*$a4*/) _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall4(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ lateout("$8" /*$a4*/) _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall4_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ lateout("$8" /*$a4*/) _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall5(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ inlateout("$8" /*$a4*/) a4.to_asm() => _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall5_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ inlateout("$8" /*$a4*/) a4.to_asm() => _,
+ lateout("$9" /*$a5*/) _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall6(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+ a5: ArgReg<'_, A5>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ inlateout("$8" /*$a4*/) a4.to_asm() => _,
+ inlateout("$9" /*$a5*/) a5.to_asm() => _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall6_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+ a5: ArgReg<'_, A5>,
+) -> RetReg<R0> {
+ let x0;
+ let err: usize;
+ asm!(
+ "syscall",
+ inlateout("$2" /*$v0*/) nr.to_asm() => x0,
+ in("$4" /*$a0*/) a0.to_asm(),
+ in("$5" /*$a1*/) a1.to_asm(),
+ in("$6" /*$a2*/) a2.to_asm(),
+ inlateout("$7" /*$a3*/) a3.to_asm() => err,
+ inlateout("$8" /*$a4*/) a4.to_asm() => _,
+ inlateout("$9" /*$a5*/) a5.to_asm() => _,
+ lateout("$10" /*$a6*/) _,
+ lateout("$11" /*$a7*/) _,
+ lateout("$12" /*$t0*/) _,
+ lateout("$13" /*$t1*/) _,
+ lateout("$14" /*$t2*/) _,
+ lateout("$15" /*$t3*/) _,
+ lateout("$24" /*$t8*/) _,
+ lateout("$25" /*$t9*/) _,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(if err != 0 {
+ (x0 as usize).wrapping_neg() as *mut _
+ } else {
+ x0
+ })
+}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs
index 7c26e23a4..3ea8eb74d 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs
@@ -12,7 +12,9 @@
#[cfg_attr(all(target_arch = "arm", not(thumb_mode)), path = "arm.rs")]
#[cfg_attr(all(target_arch = "arm", thumb_mode), path = "thumb.rs")]
#[cfg_attr(target_arch = "mips", path = "mips.rs")]
+#[cfg_attr(target_arch = "mips32r6", path = "mips32r6.rs")]
#[cfg_attr(target_arch = "mips64", path = "mips64.rs")]
+#[cfg_attr(target_arch = "mips64r6", path = "mips64r6.rs")]
#[cfg_attr(target_arch = "powerpc64", path = "powerpc64.rs")]
#[cfg_attr(target_arch = "riscv64", path = "riscv64.rs")]
#[cfg_attr(target_arch = "x86", path = "x86.rs")]
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/powerpc64.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/powerpc64.rs
index 8cca7dca7..8cca7dca7 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/powerpc64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/powerpc64.rs
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/riscv64.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/riscv64.rs
index b1e306266..b1e306266 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/riscv64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/riscv64.rs
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/thumb.rs
index 398a73dfe..398a73dfe 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/thumb.rs
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/x86.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/x86.rs
index 62947cb04..ddef4a854 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/x86.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/x86.rs
@@ -5,7 +5,10 @@
//! instruction.
//!
//! Most `rustix` syscalls use the vsyscall mechanism rather than going using
-//! `int 0x80` sequences.
+//! `int 0x80` sequences, as vsyscall is much faster.
+//!
+//! Syscalls made with `int 0x80` preserve the flags register, while syscalls
+//! made using vsyscall do not.
#![allow(dead_code)]
@@ -25,7 +28,6 @@ pub(in crate::backend) unsafe fn indirect_syscall0(
"call {callee}",
callee = in(reg) callee,
inlateout("eax") nr.to_asm() => r0,
- options(preserves_flags)
);
FromAsm::from_asm(r0)
}
@@ -42,7 +44,6 @@ pub(in crate::backend) unsafe fn indirect_syscall1(
callee = in(reg) callee,
inlateout("eax") nr.to_asm() => r0,
in("ebx") a0.to_asm(),
- options(preserves_flags)
);
FromAsm::from_asm(r0)
}
@@ -76,7 +77,6 @@ pub(in crate::backend) unsafe fn indirect_syscall2(
inlateout("eax") nr.to_asm() => r0,
in("ebx") a0.to_asm(),
in("ecx") a1.to_asm(),
- options(preserves_flags)
);
FromAsm::from_asm(r0)
}
@@ -97,7 +97,6 @@ pub(in crate::backend) unsafe fn indirect_syscall3(
in("ebx") a0.to_asm(),
in("ecx") a1.to_asm(),
in("edx") a2.to_asm(),
- options(preserves_flags)
);
FromAsm::from_asm(r0)
}
@@ -128,7 +127,6 @@ pub(in crate::backend) unsafe fn indirect_syscall4(
in("ebx") a0.to_asm(),
in("ecx") a1.to_asm(),
in("edx") a2.to_asm(),
- options(preserves_flags)
);
FromAsm::from_asm(r0)
}
@@ -161,7 +159,6 @@ pub(in crate::backend) unsafe fn indirect_syscall5(
in("ecx") a1.to_asm(),
in("edx") a2.to_asm(),
in("edi") a4.to_asm(),
- options(preserves_flags)
);
FromAsm::from_asm(r0)
}
@@ -203,7 +200,6 @@ pub(in crate::backend) unsafe fn indirect_syscall6(
in("ecx") a1.to_asm(),
in("edx") a2.to_asm(),
in("edi") a4.to_asm(),
- options(preserves_flags)
);
FromAsm::from_asm(r0)
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/x86_64.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/x86_64.rs
index 084f5fee4..084f5fee4 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/inline/x86_64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/asm/x86_64.rs
diff --git a/vendor/rustix/src/backend/linux_raw/arch/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/mod.rs
index cc93fc2c4..31a8c11f9 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/mod.rs
@@ -1,28 +1,20 @@
//! Architecture-specific syscall code.
//!
-//! `rustix` has inline assembly sequences using `asm!`, but that requires
-//! Rust 1.59, so it also has out-of-line ("outline") assembly sequences in .s
-//! files. And 32-bit x86 is special (see comments below).
-//!
//! This module also has a `choose` submodule which chooses a scheme and is
//! what most of the `rustix` syscalls use.
//!
//! # Safety
//!
//! This contains the inline `asm` statements performing the syscall
-//! instructions and FFI declarations declaring the out-of-line ("outline")
-//! syscall instructions.
+//! instructions.
#![allow(unsafe_code)]
#![cfg_attr(not(feature = "all-apis"), allow(unused_imports))]
// We'll use as many arguments as syscalls need.
#![allow(clippy::too_many_arguments)]
-// When inline asm is available, use it. Otherwise, use out-of-line asm. These
-// functions always use the machine's syscall instruction, even when it isn't
-// the fastest option available.
-#[cfg_attr(asm, path = "inline/mod.rs")]
-#[cfg_attr(not(asm), path = "outline/mod.rs")]
+// These functions always use the machine's syscall instruction, even when it
+// isn't the fastest option available.
pub(in crate::backend) mod asm;
// On most architectures, the architecture syscall instruction is fast, so use
@@ -31,7 +23,9 @@ pub(in crate::backend) mod asm;
target_arch = "arm",
target_arch = "aarch64",
target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "powerpc64",
target_arch = "riscv64",
target_arch = "x86_64",
diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/mips.s b/vendor/rustix/src/backend/linux_raw/arch/outline/mips.s
deleted file mode 100644
index b016ae124..000000000
--- a/vendor/rustix/src/backend/linux_raw/arch/outline/mips.s
+++ /dev/null
@@ -1,211 +0,0 @@
-# Assembly code for making mips64 syscalls.
-#
-# mips64 syscall argument register ordering is the same as the mips64
-# userspace argument register ordering except that the syscall number
-# (nr) is passed in v0.
-#
-# outline.rs takes care of reordering the nr argument to the end for us,
-# so we only need to move nr into v0.
-
- .file "mips.s"
- .section .mdebug.abi32
- .previous
- .abicalls
-
- .section .text.rustix_syscall0_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall0_nr_last
- .hidden rustix_syscall0_nr_last
- .type rustix_syscall0_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall0_nr_last
-rustix_syscall0_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $4
- syscall
- negu $8, $2
- jr $31
- movn $2, $8, $7
- .end rustix_syscall0_nr_last
- .size rustix_syscall0_nr_last, .-rustix_syscall0_nr_last
-
- .section .text.rustix_syscall1_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall1_nr_last
- .hidden rustix_syscall1_nr_last
- .type rustix_syscall1_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall1_nr_last
-rustix_syscall1_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $5
- syscall
- negu $8, $2
- jr $31
- movn $2, $8, $7
- .end rustix_syscall1_nr_last
- .size rustix_syscall1_nr_last, .-rustix_syscall1_nr_last
-
- .section .text.rustix_syscall1_noreturn_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall1_noreturn_nr_last
- .hidden rustix_syscall1_noreturn_nr_last
- .type rustix_syscall1_noreturn_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall1_noreturn_nr_last
-rustix_syscall1_noreturn_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $5
- syscall
- teq $zero, $zero
- .end rustix_syscall1_noreturn_nr_last
- .size rustix_syscall1_noreturn_nr_last, .-rustix_syscall1_noreturn_nr_last
-
- .section .text.rustix_syscall2_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall2_nr_last
- .hidden rustix_syscall2_nr_last
- .type rustix_syscall2_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall2_nr_last
-rustix_syscall2_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $6
- syscall
- negu $8, $2
- jr $31
- movn $2, $8, $7
- .end rustix_syscall2_nr_last
- .size rustix_syscall2_nr_last, .-rustix_syscall2_nr_last
-
- .section .text.rustix_syscall3_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall3_nr_last
- .hidden rustix_syscall3_nr_last
- .type rustix_syscall3_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall3_nr_last
-rustix_syscall3_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $7
- syscall
- negu $8, $2
- jr $31
- movn $2, $8, $7
- .end rustix_syscall3_nr_last
- .size rustix_syscall3_nr_last, .-rustix_syscall3_nr_last
-
- .section .text.rustix_syscall4_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall4_nr_last
- .hidden rustix_syscall4_nr_last
- .type rustix_syscall4_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall4_nr_last
-rustix_syscall4_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- lw $2, 16($sp)
- syscall
- negu $8, $2
- jr $31
- movn $2, $8, $7
- .end rustix_syscall4_nr_last
- .size rustix_syscall4_nr_last, .-rustix_syscall4_nr_last
-
- .section .text.rustix_syscall5_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall5_nr_last
- .hidden rustix_syscall5_nr_last
- .type rustix_syscall5_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall5_nr_last
-rustix_syscall5_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- lw $2, 20($sp)
- syscall
- negu $8, $2
- jr $31
- movn $2, $8, $7
- .end rustix_syscall5_nr_last
- .size rustix_syscall5_nr_last, .-rustix_syscall5_nr_last
-
- .section .text.rustix_syscall6_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall6_nr_last
- .hidden rustix_syscall6_nr_last
- .type rustix_syscall6_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall6_nr_last
-rustix_syscall6_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- lw $2, 24($sp)
- syscall
- negu $8, $2
- jr $31
- movn $2, $8, $7
- .end rustix_syscall6_nr_last
- .size rustix_syscall6_nr_last, .-rustix_syscall6_nr_last
-
- .section .text.rustix_syscall7_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall7_nr_last
- .hidden rustix_syscall7_nr_last
- .type rustix_syscall7_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall7_nr_last
-rustix_syscall7_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- lw $2, 28($sp)
- syscall
- negu $8, $2
- jr $31
- movn $2, $8, $7
- .end rustix_syscall7_nr_last
- .size rustix_syscall7_nr_last, .-rustix_syscall7_nr_last
-
- .section .note.GNU-stack,"",@progbits
diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s b/vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s
deleted file mode 100644
index a6473990e..000000000
--- a/vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s
+++ /dev/null
@@ -1,189 +0,0 @@
-# Assembly code for making mips64 syscalls.
-#
-# mips64 syscall argument register ordering is the same as the mips64
-# userspace argument register ordering except that the syscall number
-# (nr) is passed in v0.
-#
-# outline.rs takes care of reordering the nr argument to the end for us,
-# so we only need to move nr into v0.
-
- .file "mips64.s"
- .section .mdebug.abi64
- .previous
- .abicalls
-
- .section .text.rustix_syscall0_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall0_nr_last
- .hidden rustix_syscall0_nr_last
- .type rustix_syscall0_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall0_nr_last
-rustix_syscall0_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $4
- syscall
- dnegu $12, $2
- jr $31
- movn $2, $12, $7
- .end rustix_syscall0_nr_last
- .size rustix_syscall0_nr_last, .-rustix_syscall0_nr_last
-
- .section .text.rustix_syscall1_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall1_nr_last
- .hidden rustix_syscall1_nr_last
- .type rustix_syscall1_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall1_nr_last
-rustix_syscall1_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $5
- syscall
- dnegu $12, $2
- jr $31
- movn $2, $12, $7
- .end rustix_syscall1_nr_last
- .size rustix_syscall1_nr_last, .-rustix_syscall1_nr_last
-
- .section .text.rustix_syscall1_noreturn_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall1_noreturn_nr_last
- .hidden rustix_syscall1_noreturn_nr_last
- .type rustix_syscall1_noreturn_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall1_noreturn_nr_last
-rustix_syscall1_noreturn_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $5
- syscall
- teq $0, $0
- .end rustix_syscall1_noreturn_nr_last
- .size rustix_syscall1_noreturn_nr_last, .-rustix_syscall1_noreturn_nr_last
-
- .section .text.rustix_syscall2_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall2_nr_last
- .hidden rustix_syscall2_nr_last
- .type rustix_syscall2_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall2_nr_last
-rustix_syscall2_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $6
- syscall
- dnegu $12, $2
- jr $31
- movn $2, $12, $7
- .end rustix_syscall2_nr_last
- .size rustix_syscall2_nr_last, .-rustix_syscall2_nr_last
-
- .section .text.rustix_syscall3_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall3_nr_last
- .hidden rustix_syscall3_nr_last
- .type rustix_syscall3_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall3_nr_last
-rustix_syscall3_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $7
- syscall
- dnegu $12, $2
- jr $31
- movn $2, $12, $7
- .end rustix_syscall3_nr_last
- .size rustix_syscall3_nr_last, .-rustix_syscall3_nr_last
-
- .section .text.rustix_syscall4_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall4_nr_last
- .hidden rustix_syscall4_nr_last
- .type rustix_syscall4_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall4_nr_last
-rustix_syscall4_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $8
- syscall
- dnegu $12, $2
- jr $31
- movn $2, $12, $7
- .end rustix_syscall4_nr_last
- .size rustix_syscall4_nr_last, .-rustix_syscall4_nr_last
-
- .section .text.rustix_syscall5_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall5_nr_last
- .hidden rustix_syscall5_nr_last
- .type rustix_syscall5_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall5_nr_last
-rustix_syscall5_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $9
- syscall
- dnegu $12, $2
- jr $31
- movn $2, $12, $7
- .end rustix_syscall5_nr_last
- .size rustix_syscall5_nr_last, .-rustix_syscall5_nr_last
-
- .section .text.rustix_syscall6_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall6_nr_last
- .hidden rustix_syscall6_nr_last
- .type rustix_syscall6_nr_last, @function
- .set nomips16
- .set nomicromips
- .ent rustix_syscall6_nr_last
-rustix_syscall6_nr_last:
- .frame $sp,0,$31
- .mask 0x00000000,0
- .fmask 0x00000000,0
- .set noreorder
- .set nomacro
- move $2, $10
- syscall
- dnegu $12, $2
- jr $31
- movn $2, $12, $7
- .end rustix_syscall6_nr_last
- .size rustix_syscall6_nr_last, .-rustix_syscall6_nr_last
-
- .section .note.GNU-stack,"",@progbits
diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs
deleted file mode 100644
index 202a2cce9..000000000
--- a/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-//! 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.
-//!
-//! This is needed because as of our MSRV of 1.63, inline asm and naked
-//! functions are experimental.
-
-#[cfg(target_arch = "x86")]
-mod x86;
-// For these architectures, pass the `nr` argument last.
-#[cfg(any(
- target_arch = "mips",
- target_arch = "mips64",
- target_arch = "powerpc64",
-))]
-mod nr_last;
-
-#[cfg(any(
- target_arch = "mips",
- target_arch = "mips64",
- target_arch = "powerpc64",
-))]
-pub(in crate::backend) use nr_last::*;
-#[cfg(target_arch = "x86")]
-pub(in crate::backend) use x86::*;
diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs
deleted file mode 100644
index 4af64d6c4..000000000
--- a/vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs
+++ /dev/null
@@ -1,166 +0,0 @@
-//! Syscall wrappers for platforms which pass the syscall number specially.
-//!
-//! Rustix aims to minimize the amount of assembly code it needs. To that end,
-//! this code reorders syscall arguments as close as feasible to the actual
-//! syscall convention before calling the assembly functions.
-//!
-//! Many architectures use a convention where the syscall number is passed in a
-//! special register, with the regular syscall arguments passed in either the
-//! same or similar registers as the platform C convention. This code
-//! approximates that order by passing the regular syscall arguments first, and
-//! the syscall number last. That way, the outline assembly code typically just
-//! needs to move the syscall number to its special register, and leave the
-//! other arguments mostly as they are.
-
-#[cfg(target_arch = "mips")]
-use crate::backend::reg::A6;
-use crate::backend::reg::{ArgReg, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0};
-
-// First we declare the actual assembly routines with `*_nr_last` names and
-// reordered arguments. If the signatures or calling conventions are ever
-// changed, the symbol names should also be updated accordingly, to avoid
-// collisions with other versions of this crate.
-//
-// We don't define `_readonly` versions of these because we have no way to tell
-// Rust that calls to our outline assembly are readonly.
-extern "C" {
- fn rustix_syscall0_nr_last(nr: SyscallNumber<'_>) -> RetReg<R0>;
- fn rustix_syscall1_nr_last(a0: ArgReg<'_, A0>, nr: SyscallNumber<'_>) -> RetReg<R0>;
- fn rustix_syscall1_noreturn_nr_last(a0: ArgReg<'_, A0>, nr: SyscallNumber<'_>) -> !;
- fn rustix_syscall2_nr_last(
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
- fn rustix_syscall3_nr_last(
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
- fn rustix_syscall4_nr_last(
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
- fn rustix_syscall5_nr_last(
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
- fn rustix_syscall6_nr_last(
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- a5: ArgReg<'_, A5>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
- #[cfg(target_arch = "mips")]
- fn rustix_syscall7_nr_last(
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- a5: ArgReg<'_, A5>,
- a6: ArgReg<'_, A6>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
-}
-
-// Then we define inline wrapper functions that do the reordering.
-
-#[inline]
-pub(in crate::backend) unsafe fn syscall0(nr: SyscallNumber<'_>) -> RetReg<R0> {
- rustix_syscall0_nr_last(nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
- rustix_syscall1_nr_last(a0, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
- rustix_syscall1_noreturn_nr_last(a0, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall2(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
-) -> RetReg<R0> {
- rustix_syscall2_nr_last(a0, a1, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall3(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
-) -> RetReg<R0> {
- rustix_syscall3_nr_last(a0, a1, a2, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall4(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
-) -> RetReg<R0> {
- rustix_syscall4_nr_last(a0, a1, a2, a3, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall5(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
-) -> RetReg<R0> {
- rustix_syscall5_nr_last(a0, a1, a2, a3, a4, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall6(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- a5: ArgReg<'_, A5>,
-) -> RetReg<R0> {
- rustix_syscall6_nr_last(a0, a1, a2, a3, a4, a5, nr)
-}
-#[cfg(target_arch = "mips")]
-#[inline]
-pub(in crate::backend) unsafe fn syscall7(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- a5: ArgReg<'_, A5>,
- a6: ArgReg<'_, A6>,
-) -> RetReg<R0> {
- rustix_syscall7_nr_last(a0, a1, a2, a3, a4, a5, a6, nr)
-}
-
-// Then we define the `_readonly` versions of the wrappers. We don't have
-// separate `_readonly` implementations, so these can just be aliases to
-// their non-`_readonly` counterparts.
-#[cfg(target_arch = "mips")]
-pub(in crate::backend) use syscall7 as syscall7_readonly;
-pub(in crate::backend) use {
- syscall0 as syscall0_readonly, syscall1 as syscall1_readonly, syscall2 as syscall2_readonly,
- syscall3 as syscall3_readonly, syscall4 as syscall4_readonly, syscall5 as syscall5_readonly,
- syscall6 as syscall6_readonly,
-};
diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s b/vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s
deleted file mode 100644
index 29d4c0a95..000000000
--- a/vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s
+++ /dev/null
@@ -1,132 +0,0 @@
-# Assembly code for making powerpc64le syscalls.
-#
-# powerpc64le syscall argument register ordering is the same as the
-# powerpc64le userspace argument register ordering except that the syscall
-# number (nr) is passed in r0.
-#
-# outline.rs takes care of reordering the nr argument to the end for us,
-# so we only need to move nr into r0.
-
- .file "powerpc64le.s"
- .machine power8
- .abiversion 2
-
- .section .text.rustix_syscall0_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall0_nr_last
- .hidden rustix_syscall0_nr_last
- .type rustix_syscall0_nr_last, @function
-rustix_syscall0_nr_last:
- .cfi_startproc
- mr 0, 3
- sc
- bnslr
- neg 3, 3
- blr
- .cfi_endproc
- .size rustix_syscall0_nr_last, .-rustix_syscall0_nr_last
-
- .section .text.rustix_syscall1_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall1_nr_last
- .hidden rustix_syscall1_nr_last
- .type rustix_syscall1_nr_last, @function
-rustix_syscall1_nr_last:
- .cfi_startproc
- mr 0, 4
- sc
- bnslr
- neg 3, 3
- blr
- .cfi_endproc
- .size rustix_syscall1_nr_last, .-rustix_syscall1_nr_last
-
- .section .text.rustix_syscall1_noreturn_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall1_noreturn_nr_last
- .hidden rustix_syscall1_noreturn_nr_last
- .type rustix_syscall1_noreturn_nr_last, @function
-rustix_syscall1_noreturn_nr_last:
- .cfi_startproc
- mr 0, 4
- sc
- trap
- .cfi_endproc
- .size rustix_syscall1_noreturn_nr_last, .-rustix_syscall1_noreturn_nr_last
-
- .section .text.rustix_syscall2_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall2_nr_last
- .hidden rustix_syscall2_nr_last
- .type rustix_syscall2_nr_last, @function
-rustix_syscall2_nr_last:
- .cfi_startproc
- mr 0, 5
- sc
- bnslr
- neg 3, 3
- blr
- .cfi_endproc
- .size rustix_syscall2_nr_last, .-rustix_syscall2_nr_last
-
- .section .text.rustix_syscall3_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall3_nr_last
- .hidden rustix_syscall3_nr_last
- .type rustix_syscall3_nr_last, @function
-rustix_syscall3_nr_last:
- .cfi_startproc
- mr 0, 6
- sc
- bnslr
- neg 3, 3
- blr
- .cfi_endproc
- .size rustix_syscall3_nr_last, .-rustix_syscall3_nr_last
-
- .section .text.rustix_syscall4_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall4_nr_last
- .hidden rustix_syscall4_nr_last
- .type rustix_syscall4_nr_last, @function
-rustix_syscall4_nr_last:
- .cfi_startproc
- mr 0, 7
- sc
- bnslr
- neg 3, 3
- blr
- .cfi_endproc
- .size rustix_syscall4_nr_last, .-rustix_syscall4_nr_last
-
- .section .text.rustix_syscall5_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall5_nr_last
- .hidden rustix_syscall5_nr_last
- .type rustix_syscall5_nr_last, @function
-rustix_syscall5_nr_last:
- .cfi_startproc
- mr 0, 8
- sc
- bnslr
- neg 3, 3
- blr
- .cfi_endproc
- .size rustix_syscall5_nr_last, .-rustix_syscall5_nr_last
-
- .section .text.rustix_syscall6_nr_last,"ax",@progbits
- .p2align 2
- .weak rustix_syscall6_nr_last
- .hidden rustix_syscall6_nr_last
- .type rustix_syscall6_nr_last, @function
-rustix_syscall6_nr_last:
- .cfi_startproc
- mr 0, 9
- sc
- bnslr
- neg 3, 3
- blr
- .cfi_endproc
- .size rustix_syscall6_nr_last, .-rustix_syscall6_nr_last
-
- .section .note.GNU-stack,"",@progbits
diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs
deleted file mode 100644
index e74b8d2aa..000000000
--- a/vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs
+++ /dev/null
@@ -1,285 +0,0 @@
-//! Syscall wrappers for 32-bit x86.
-//!
-//! This module is similar to the `nr_last` module, except specialized for
-//! 32-bit x86.
-//!
-//! The syscall convention passes all arguments in registers. The closest we
-//! can easily get to that from Rust is to use the fastcall convention which
-//! passes the first two arguments in `ecx` and `edx`, which are the second
-//! and third Linux syscall arguments. To line them up, this function passes
-//! the second and third syscall argument as the first and second argument to
-//! the outline assembly, followed by the first syscall argument, and then the
-//! rest of the syscall arguments. The assembly code still has to do some work,
-//! but at least we can get up to two arguments into the right place for it.
-
-#![allow(dead_code, unused_imports)]
-
-use crate::backend::reg::{ArgReg, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0};
-use crate::backend::vdso_wrappers::SyscallType;
-
-// First we declare the actual assembly routines with `*_nr_last_fastcall`
-// names and reordered arguments. If the signatures or calling conventions are
-// ever changed, the symbol names should also be updated accordingly, to avoid
-// collisions with other versions of this crate.
-//
-// We don't define `_readonly` versions of these because we have no way to tell
-// Rust that calls to our outline assembly are readonly.
-extern "fastcall" {
- fn rustix_syscall0_nr_last_fastcall(nr: SyscallNumber<'_>) -> RetReg<R0>;
- fn rustix_syscall1_nr_last_fastcall(a0: ArgReg<'_, A0>, nr: SyscallNumber<'_>) -> RetReg<R0>;
- fn rustix_syscall1_noreturn_nr_last_fastcall(a0: ArgReg<'_, A0>, nr: SyscallNumber<'_>) -> !;
- fn rustix_syscall2_nr_last_fastcall(
- a1: ArgReg<'_, A1>,
- a0: ArgReg<'_, A0>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
- fn rustix_syscall3_nr_last_fastcall(
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a0: ArgReg<'_, A0>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
- fn rustix_syscall4_nr_last_fastcall(
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a0: ArgReg<'_, A0>,
- a3: ArgReg<'_, A3>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
- fn rustix_syscall5_nr_last_fastcall(
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a0: ArgReg<'_, A0>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
- fn rustix_syscall6_nr_last_fastcall(
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a0: ArgReg<'_, A0>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- a5: ArgReg<'_, A5>,
- nr: SyscallNumber<'_>,
- ) -> RetReg<R0>;
-}
-
-// Then we define inline wrapper functions that do the reordering.
-
-#[inline]
-pub(in crate::backend) unsafe fn syscall0(nr: SyscallNumber<'_>) -> RetReg<R0> {
- rustix_syscall0_nr_last_fastcall(nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
- rustix_syscall1_nr_last_fastcall(a0, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
- rustix_syscall1_noreturn_nr_last_fastcall(a0, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall2(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
-) -> RetReg<R0> {
- rustix_syscall2_nr_last_fastcall(a1, a0, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall3(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
-) -> RetReg<R0> {
- rustix_syscall3_nr_last_fastcall(a1, a2, a0, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall4(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
-) -> RetReg<R0> {
- rustix_syscall4_nr_last_fastcall(a1, a2, a0, a3, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall5(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
-) -> RetReg<R0> {
- rustix_syscall5_nr_last_fastcall(a1, a2, a0, a3, a4, nr)
-}
-#[inline]
-pub(in crate::backend) unsafe fn syscall6(
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- a5: ArgReg<'_, A5>,
-) -> RetReg<R0> {
- rustix_syscall6_nr_last_fastcall(a1, a2, a0, a3, a4, a5, nr)
-}
-
-// Then we define the `_readonly` versions of the wrappers. We don't have
-// separate `_readonly` implementations, so these can just be aliases to
-// their non-`_readonly` counterparts.
-pub(in crate::backend) use {
- syscall0 as syscall0_readonly, syscall1 as syscall1_readonly, syscall2 as syscall2_readonly,
- syscall3 as syscall3_readonly, syscall4 as syscall4_readonly, syscall5 as syscall5_readonly,
- syscall6 as syscall6_readonly,
-};
-
-// x86 prefers to route all syscalls through the vDSO, though this isn't
-// always possible, so it also has a special form for doing the dispatch.
-//
-// First we declare the actual assembly routines with `*_nr_last_fastcall`
-// names and reordered arguments. If the signatures or calling conventions are
-// ever changed, the symbol names should also be updated accordingly, to avoid
-// collisions with other versions of this crate.
-extern "fastcall" {
- fn rustix_indirect_syscall0_nr_last_fastcall(
- nr: SyscallNumber<'_>,
- callee: SyscallType,
- ) -> RetReg<R0>;
- fn rustix_indirect_syscall1_nr_last_fastcall(
- a0: ArgReg<'_, A0>,
- nr: SyscallNumber<'_>,
- callee: SyscallType,
- ) -> RetReg<R0>;
- fn rustix_indirect_syscall1_noreturn_nr_last_fastcall(
- a0: ArgReg<'_, A0>,
- nr: SyscallNumber<'_>,
- callee: SyscallType,
- ) -> !;
- fn rustix_indirect_syscall2_nr_last_fastcall(
- a1: ArgReg<'_, A1>,
- a0: ArgReg<'_, A0>,
- nr: SyscallNumber<'_>,
- callee: SyscallType,
- ) -> RetReg<R0>;
- fn rustix_indirect_syscall3_nr_last_fastcall(
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a0: ArgReg<'_, A0>,
- nr: SyscallNumber<'_>,
- callee: SyscallType,
- ) -> RetReg<R0>;
- fn rustix_indirect_syscall4_nr_last_fastcall(
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a0: ArgReg<'_, A0>,
- a3: ArgReg<'_, A3>,
- nr: SyscallNumber<'_>,
- callee: SyscallType,
- ) -> RetReg<R0>;
- fn rustix_indirect_syscall5_nr_last_fastcall(
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a0: ArgReg<'_, A0>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- nr: SyscallNumber<'_>,
- callee: SyscallType,
- ) -> RetReg<R0>;
- fn rustix_indirect_syscall6_nr_last_fastcall(
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a0: ArgReg<'_, A0>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- a5: ArgReg<'_, A5>,
- nr: SyscallNumber<'_>,
- callee: SyscallType,
- ) -> RetReg<R0>;
-}
-
-// Then we define inline wrapper functions that do the reordering.
-
-#[inline]
-pub(in crate::backend) unsafe fn indirect_syscall0(
- callee: SyscallType,
- nr: SyscallNumber<'_>,
-) -> RetReg<R0> {
- rustix_indirect_syscall0_nr_last_fastcall(nr, callee)
-}
-#[inline]
-pub(in crate::backend) unsafe fn indirect_syscall1(
- callee: SyscallType,
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
-) -> RetReg<R0> {
- rustix_indirect_syscall1_nr_last_fastcall(a0, nr, callee)
-}
-#[inline]
-pub(in crate::backend) unsafe fn indirect_syscall1_noreturn(
- callee: SyscallType,
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
-) -> ! {
- rustix_indirect_syscall1_noreturn_nr_last_fastcall(a0, nr, callee)
-}
-#[inline]
-pub(in crate::backend) unsafe fn indirect_syscall2(
- callee: SyscallType,
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
-) -> RetReg<R0> {
- rustix_indirect_syscall2_nr_last_fastcall(a1, a0, nr, callee)
-}
-#[inline]
-pub(in crate::backend) unsafe fn indirect_syscall3(
- callee: SyscallType,
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
-) -> RetReg<R0> {
- rustix_indirect_syscall3_nr_last_fastcall(a1, a2, a0, nr, callee)
-}
-#[inline]
-pub(in crate::backend) unsafe fn indirect_syscall4(
- callee: SyscallType,
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
-) -> RetReg<R0> {
- rustix_indirect_syscall4_nr_last_fastcall(a1, a2, a0, a3, nr, callee)
-}
-#[inline]
-pub(in crate::backend) unsafe fn indirect_syscall5(
- callee: SyscallType,
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
-) -> RetReg<R0> {
- rustix_indirect_syscall5_nr_last_fastcall(a1, a2, a0, a3, a4, nr, callee)
-}
-#[inline]
-pub(in crate::backend) unsafe fn indirect_syscall6(
- callee: SyscallType,
- nr: SyscallNumber<'_>,
- a0: ArgReg<'_, A0>,
- a1: ArgReg<'_, A1>,
- a2: ArgReg<'_, A2>,
- a3: ArgReg<'_, A3>,
- a4: ArgReg<'_, A4>,
- a5: ArgReg<'_, A5>,
-) -> RetReg<R0> {
- rustix_indirect_syscall6_nr_last_fastcall(a1, a2, a0, a3, a4, a5, nr, callee)
-}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/x86.s b/vendor/rustix/src/backend/linux_raw/arch/outline/x86.s
deleted file mode 100644
index bda234e1a..000000000
--- a/vendor/rustix/src/backend/linux_raw/arch/outline/x86.s
+++ /dev/null
@@ -1,381 +0,0 @@
-// Assembly code for making x86 syscalls.
-//
-// On x86 we use the "fastcall" convention which passes the first two
-// arguments in ecx and edx. Outline.rs reorders the arguments to put
-// a1 and a2 in those registers so they we don't have to move them to
-// set up the kernel convention.
-//
-// "fastcall" expects callee to pop argument stack space, so we use
-// `ret imm` instructions to clean up the stack. We don't need callee
-// cleanup per se, it just comes along with using "fastcall".
-
- .file "x86.s"
- .intel_syntax noprefix
-
- .section .text.rustix_indirect_syscall0_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_indirect_syscall0_nr_last_fastcall
- .hidden rustix_indirect_syscall0_nr_last_fastcall
- .type rustix_indirect_syscall0_nr_last_fastcall, @function
-rustix_indirect_syscall0_nr_last_fastcall:
- .cfi_startproc
- mov eax,ecx
- call edx
- ret
- .cfi_endproc
- .size rustix_indirect_syscall0_nr_last_fastcall, .-rustix_indirect_syscall0_nr_last_fastcall
-
- .section .text.rustix_indirect_syscall1_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_indirect_syscall1_nr_last_fastcall
- .hidden rustix_indirect_syscall1_nr_last_fastcall
- .type rustix_indirect_syscall1_nr_last_fastcall, @function
-rustix_indirect_syscall1_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- .cfi_offset ebx, -8
- mov ebx,ecx
- mov eax,edx
- call DWORD PTR [esp+0x8]
- pop ebx
- .cfi_def_cfa_offset 4
- ret 0x4
- .cfi_endproc
- .size rustix_indirect_syscall1_nr_last_fastcall, .-rustix_indirect_syscall1_nr_last_fastcall
-
- .section .text.rustix_indirect_syscall1_noreturn_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_indirect_syscall1_noreturn_nr_last_fastcall
- .hidden rustix_indirect_syscall1_noreturn_nr_last_fastcall
- .type rustix_indirect_syscall1_noreturn_nr_last_fastcall, @function
-rustix_indirect_syscall1_noreturn_nr_last_fastcall:
- .cfi_startproc
- mov ebx,ecx
- mov eax,edx
- call DWORD PTR [esp+0x4]
- ud2
- .cfi_endproc
- .size rustix_indirect_syscall1_noreturn_nr_last_fastcall, .-rustix_indirect_syscall1_noreturn_nr_last_fastcall
-
- .section .text.rustix_indirect_syscall2_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_indirect_syscall2_nr_last_fastcall
- .hidden rustix_indirect_syscall2_nr_last_fastcall
- .type rustix_indirect_syscall2_nr_last_fastcall, @function
-rustix_indirect_syscall2_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- .cfi_offset ebx, -8
- mov ebx,edx
- mov eax,DWORD PTR [esp+0x8]
- call DWORD PTR [esp+0xc]
- pop ebx
- .cfi_def_cfa_offset 4
- ret 0x8
- .cfi_endproc
- .size rustix_indirect_syscall2_nr_last_fastcall, .-rustix_indirect_syscall2_nr_last_fastcall
-
- .section .text.rustix_indirect_syscall3_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_indirect_syscall3_nr_last_fastcall
- .hidden rustix_indirect_syscall3_nr_last_fastcall
- .type rustix_indirect_syscall3_nr_last_fastcall, @function
-rustix_indirect_syscall3_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- .cfi_offset ebx, -8
- mov ebx,DWORD PTR [esp+0x8]
- mov eax,DWORD PTR [esp+0xc]
- call DWORD PTR [esp+0x10]
- pop ebx
- .cfi_def_cfa_offset 4
- ret 0xc
- .cfi_endproc
- .size rustix_indirect_syscall3_nr_last_fastcall, .-rustix_indirect_syscall3_nr_last_fastcall
-
- .section .text.rustix_indirect_syscall4_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_indirect_syscall4_nr_last_fastcall
- .hidden rustix_indirect_syscall4_nr_last_fastcall
- .type rustix_indirect_syscall4_nr_last_fastcall, @function
-rustix_indirect_syscall4_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- push esi
- .cfi_def_cfa_offset 12
- .cfi_offset esi, -12
- .cfi_offset ebx, -8
- mov ebx,DWORD PTR [esp+0xc]
- mov esi,DWORD PTR [esp+0x10]
- mov eax,DWORD PTR [esp+0x14]
- call DWORD PTR [esp+0x18]
- pop esi
- .cfi_def_cfa_offset 8
- pop ebx
- .cfi_def_cfa_offset 4
- ret 0x10
- .cfi_endproc
- .size rustix_indirect_syscall4_nr_last_fastcall, .-rustix_indirect_syscall4_nr_last_fastcall
-
- .section .text.rustix_indirect_syscall5_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_indirect_syscall5_nr_last_fastcall
- .hidden rustix_indirect_syscall5_nr_last_fastcall
- .type rustix_indirect_syscall5_nr_last_fastcall, @function
-rustix_indirect_syscall5_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- push esi
- .cfi_def_cfa_offset 12
- push edi
- .cfi_def_cfa_offset 16
- .cfi_offset edi, -16
- .cfi_offset esi, -12
- .cfi_offset ebx, -8
- mov ebx,DWORD PTR [esp+0x10]
- mov esi,DWORD PTR [esp+0x14]
- mov edi,DWORD PTR [esp+0x18]
- mov eax,DWORD PTR [esp+0x1c]
- call DWORD PTR [esp+0x20]
- pop edi
- .cfi_def_cfa_offset 12
- pop esi
- .cfi_def_cfa_offset 8
- pop ebx
- .cfi_def_cfa_offset 4
- ret 0x14
- .cfi_endproc
- .size rustix_indirect_syscall5_nr_last_fastcall, .-rustix_indirect_syscall5_nr_last_fastcall
-
- .section .text.rustix_indirect_syscall6_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_indirect_syscall6_nr_last_fastcall
- .hidden rustix_indirect_syscall6_nr_last_fastcall
- .type rustix_indirect_syscall6_nr_last_fastcall, @function
-rustix_indirect_syscall6_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- push esi
- .cfi_def_cfa_offset 12
- push edi
- .cfi_def_cfa_offset 16
- push ebp
- .cfi_def_cfa_offset 20
- .cfi_offset ebp, -20
- .cfi_offset edi, -16
- .cfi_offset esi, -12
- .cfi_offset ebx, -8
- mov ebx,DWORD PTR [esp+0x14]
- mov esi,DWORD PTR [esp+0x18]
- mov edi,DWORD PTR [esp+0x1c]
- mov ebp,DWORD PTR [esp+0x20]
- mov eax,DWORD PTR [esp+0x24]
- call DWORD PTR [esp+0x28]
- pop ebp
- .cfi_def_cfa_offset 16
- pop edi
- .cfi_def_cfa_offset 12
- pop esi
- .cfi_def_cfa_offset 8
- pop ebx
- .cfi_def_cfa_offset 4
- ret 0x18
- .cfi_endproc
- .size rustix_indirect_syscall6_nr_last_fastcall, .-rustix_indirect_syscall6_nr_last_fastcall
-
- .section .text.rustix_syscall0_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_syscall0_nr_last_fastcall
- .hidden rustix_syscall0_nr_last_fastcall
- .type rustix_syscall0_nr_last_fastcall, @function
-rustix_syscall0_nr_last_fastcall:
- .cfi_startproc
- mov eax,ecx
- int 0x80
- ret
- .cfi_endproc
- .size rustix_syscall0_nr_last_fastcall, .-rustix_syscall0_nr_last_fastcall
-
- .section .text.rustix_syscall1_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_syscall1_nr_last_fastcall
- .hidden rustix_syscall1_nr_last_fastcall
- .type rustix_syscall1_nr_last_fastcall, @function
-rustix_syscall1_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- .cfi_offset ebx, -8
- mov eax,edx
- mov ebx,ecx
- int 0x80
- pop ebx
- .cfi_def_cfa_offset 4
- ret
- .cfi_endproc
- .size rustix_syscall1_nr_last_fastcall, .-rustix_syscall1_nr_last_fastcall
-
- .section .text.rustix_syscall1_noreturn_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_syscall1_noreturn_nr_last_fastcall
- .hidden rustix_syscall1_noreturn_nr_last_fastcall
- .type rustix_syscall1_noreturn_nr_last_fastcall, @function
-rustix_syscall1_noreturn_nr_last_fastcall:
- .cfi_startproc
- mov eax,edx
- mov ebx,ecx
- int 0x80
- ud2
- .cfi_endproc
- .size rustix_syscall1_noreturn_nr_last_fastcall, .-rustix_syscall1_noreturn_nr_last_fastcall
-
- .section .text.rustix_syscall2_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_syscall2_nr_last_fastcall
- .hidden rustix_syscall2_nr_last_fastcall
- .type rustix_syscall2_nr_last_fastcall, @function
-rustix_syscall2_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- .cfi_offset ebx, -8
- mov ebx,edx
- mov eax,DWORD PTR [esp+0x8]
- int 0x80
- pop ebx
- .cfi_def_cfa_offset 4
- ret 0x4
- .cfi_endproc
- .size rustix_syscall2_nr_last_fastcall, .-rustix_syscall2_nr_last_fastcall
-
- .section .text.rustix_syscall3_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_syscall3_nr_last_fastcall
- .hidden rustix_syscall3_nr_last_fastcall
- .type rustix_syscall3_nr_last_fastcall, @function
-rustix_syscall3_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- .cfi_offset ebx, -8
- mov ebx,DWORD PTR [esp+0x8]
- mov eax,DWORD PTR [esp+0xc]
- int 0x80
- pop ebx
- .cfi_def_cfa_offset 4
- ret 0x8
- .cfi_endproc
- .size rustix_syscall3_nr_last_fastcall, .-rustix_syscall3_nr_last_fastcall
-
- .section .text.rustix_syscall4_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_syscall4_nr_last_fastcall
- .hidden rustix_syscall4_nr_last_fastcall
- .type rustix_syscall4_nr_last_fastcall, @function
-rustix_syscall4_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- push esi
- .cfi_def_cfa_offset 12
- .cfi_offset esi, -12
- .cfi_offset ebx, -8
- mov ebx,DWORD PTR [esp+0xc]
- mov esi,DWORD PTR [esp+0x10]
- mov eax,DWORD PTR [esp+0x14]
- int 0x80
- pop esi
- .cfi_def_cfa_offset 8
- pop ebx
- .cfi_def_cfa_offset 4
- ret 0xc
- .cfi_endproc
- .size rustix_syscall4_nr_last_fastcall, .-rustix_syscall4_nr_last_fastcall
-
- .section .text.rustix_syscall5_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_syscall5_nr_last_fastcall
- .hidden rustix_syscall5_nr_last_fastcall
- .type rustix_syscall5_nr_last_fastcall, @function
-rustix_syscall5_nr_last_fastcall:
- .cfi_startproc
- push ebx
- .cfi_def_cfa_offset 8
- push edi
- .cfi_def_cfa_offset 12
- push esi
- .cfi_def_cfa_offset 16
- .cfi_offset esi, -16
- .cfi_offset edi, -12
- .cfi_offset ebx, -8
- mov ebx,DWORD PTR [esp+0x10]
- mov esi,DWORD PTR [esp+0x14]
- mov edi,DWORD PTR [esp+0x18]
- mov eax,DWORD PTR [esp+0x1c]
- int 0x80
- pop esi
- .cfi_def_cfa_offset 12
- pop edi
- .cfi_def_cfa_offset 8
- pop ebx
- .cfi_def_cfa_offset 4
- ret 0x10
- .cfi_endproc
- .size rustix_syscall5_nr_last_fastcall, .-rustix_syscall5_nr_last_fastcall
-
- .section .text.rustix_syscall6_nr_last_fastcall,"ax",@progbits
- .p2align 4
- .weak rustix_syscall6_nr_last_fastcall
- .hidden rustix_syscall6_nr_last_fastcall
- .type rustix_syscall6_nr_last_fastcall, @function
-rustix_syscall6_nr_last_fastcall:
- .cfi_startproc
- push ebp
- .cfi_def_cfa_offset 8
- push ebx
- .cfi_def_cfa_offset 12
- push edi
- .cfi_def_cfa_offset 16
- push esi
- .cfi_def_cfa_offset 20
- .cfi_offset esi, -20
- .cfi_offset edi, -16
- .cfi_offset ebx, -12
- .cfi_offset ebp, -8
- mov ebx,DWORD PTR [esp+0x14]
- mov esi,DWORD PTR [esp+0x18]
- mov edi,DWORD PTR [esp+0x1c]
- mov ebp,DWORD PTR [esp+0x20]
- mov eax,DWORD PTR [esp+0x24]
- int 0x80
- pop esi
- .cfi_def_cfa_offset 16
- pop edi
- .cfi_def_cfa_offset 12
- pop ebx
- .cfi_def_cfa_offset 8
- pop ebp
- .cfi_def_cfa_offset 4
- ret 0x14
- .cfi_endproc
- .size rustix_syscall6_nr_last_fastcall, .-rustix_syscall6_nr_last_fastcall
-
- .section .text.rustix_int_0x80,"ax",@progbits
- .p2align 4
- .weak rustix_int_0x80
- .hidden rustix_int_0x80
- .type rustix_int_0x80, @function
-rustix_int_0x80:
- .cfi_startproc
- int 0x80
- ret
- .cfi_endproc
- .size rustix_int_0x80, .-rustix_int_0x80
-
- .section .note.GNU-stack,"",@progbits
diff --git a/vendor/rustix/src/backend/linux_raw/c.rs b/vendor/rustix/src/backend/linux_raw/c.rs
index 8e77c82d7..f336392bb 100644
--- a/vendor/rustix/src/backend/linux_raw/c.rs
+++ b/vendor/rustix/src/backend/linux_raw/c.rs
@@ -104,7 +104,15 @@ pub(crate) use linux_raw_sys::{
// On MIPS, `TCSANOW` et al have `TCSETS` added to them, so we need it to
// subtract it out.
-#[cfg(all(feature = "termios", any(target_arch = "mips", target_arch = "mips64")))]
+#[cfg(all(
+ feature = "termios",
+ any(
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )
+))]
pub(crate) use linux_raw_sys::ioctl::TCSETS;
// Define our own `uid_t` and `gid_t` if the kernel's versions are not 32-bit.
@@ -134,7 +142,9 @@ pub(crate) const SIGALRM: c_int = linux_raw_sys::general::SIGALRM as _;
pub(crate) const SIGTERM: c_int = linux_raw_sys::general::SIGTERM as _;
#[cfg(not(any(
target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "sparc",
target_arch = "sparc64"
)))]
@@ -156,7 +166,9 @@ pub(crate) const SIGPWR: c_int = linux_raw_sys::general::SIGPWR as _;
pub(crate) const SIGSYS: c_int = linux_raw_sys::general::SIGSYS as _;
#[cfg(any(
target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "sparc",
target_arch = "sparc64"
))]
diff --git a/vendor/rustix/src/backend/linux_raw/conv.rs b/vendor/rustix/src/backend/linux_raw/conv.rs
index 05d040204..c87136f8f 100644
--- a/vendor/rustix/src/backend/linux_raw/conv.rs
+++ b/vendor/rustix/src/backend/linux_raw/conv.rs
@@ -436,19 +436,79 @@ pub(crate) mod fs {
c_uint(access.bits())
}
}
+}
- impl<'a, Num: ArgNumber> From<crate::backend::fs::types::MountFlagsArg> for ArgReg<'a, Num> {
- #[inline]
- fn from(flags: crate::backend::fs::types::MountFlagsArg) -> Self {
- c_uint(flags.0)
- }
+#[cfg(any(feature = "fs", feature = "mount"))]
+impl<'a, Num: ArgNumber> From<crate::backend::mount::types::MountFlagsArg> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::backend::mount::types::MountFlagsArg) -> Self {
+ c_uint(flags.0)
}
+}
- impl<'a, Num: ArgNumber> From<crate::backend::fs::types::UnmountFlags> for ArgReg<'a, Num> {
- #[inline]
- fn from(flags: crate::backend::fs::types::UnmountFlags) -> Self {
- c_uint(flags.bits())
- }
+// When the deprecated "fs" aliases are removed, we can remove the "fs"
+// here too.
+#[cfg(any(feature = "fs", feature = "mount"))]
+impl<'a, Num: ArgNumber> From<crate::backend::mount::types::UnmountFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::backend::mount::types::UnmountFlags) -> Self {
+ c_uint(flags.bits())
+ }
+}
+
+#[cfg(feature = "mount")]
+impl<'a, Num: ArgNumber> From<crate::mount::FsConfigCmd> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(cmd: crate::mount::FsConfigCmd) -> Self {
+ c_uint(cmd as c::c_uint)
+ }
+}
+
+#[cfg(feature = "mount")]
+impl<'a, Num: ArgNumber> From<crate::backend::mount::types::FsOpenFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::backend::mount::types::FsOpenFlags) -> Self {
+ c_uint(flags.bits())
+ }
+}
+
+#[cfg(feature = "mount")]
+impl<'a, Num: ArgNumber> From<crate::backend::mount::types::FsMountFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::backend::mount::types::FsMountFlags) -> Self {
+ c_uint(flags.bits())
+ }
+}
+
+#[cfg(feature = "mount")]
+impl<'a, Num: ArgNumber> From<crate::backend::mount::types::MountAttrFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::backend::mount::types::MountAttrFlags) -> Self {
+ c_uint(flags.bits())
+ }
+}
+
+#[cfg(feature = "mount")]
+impl<'a, Num: ArgNumber> From<crate::backend::mount::types::OpenTreeFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::backend::mount::types::OpenTreeFlags) -> Self {
+ c_uint(flags.bits())
+ }
+}
+
+#[cfg(feature = "mount")]
+impl<'a, Num: ArgNumber> From<crate::backend::mount::types::FsPickFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::backend::mount::types::FsPickFlags) -> Self {
+ c_uint(flags.bits())
+ }
+}
+
+#[cfg(feature = "mount")]
+impl<'a, Num: ArgNumber> From<crate::backend::mount::types::MoveMountFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::backend::mount::types::MoveMountFlags) -> Self {
+ c_uint(flags.bits())
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/elf.rs b/vendor/rustix/src/backend/linux_raw/elf.rs
index 7797f4e21..415f79f88 100644
--- a/vendor/rustix/src/backend/linux_raw/elf.rs
+++ b/vendor/rustix/src/backend/linux_raw/elf.rs
@@ -62,7 +62,12 @@ pub(super) const EM_CURRENT: u16 = 40; // EM_ARM
pub(super) const EM_CURRENT: u16 = 3; // EM_386
#[cfg(target_arch = "powerpc64")]
pub(super) const EM_CURRENT: u16 = 21; // EM_PPC64
-#[cfg(any(target_arch = "mips", target_arch = "mips64"))]
+#[cfg(any(
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+))]
pub(super) const EM_CURRENT: u16 = 8; // EM_MIPS
#[cfg(target_arch = "x86_64")]
pub(super) const EM_CURRENT: u16 = 62; // EM_X86_64
diff --git a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
index 78a2088b2..b3d4cd66c 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
@@ -18,6 +18,7 @@ use crate::backend::conv::{loff_t, loff_t_from_u64, ret_u64};
target_arch = "aarch64",
target_arch = "riscv64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_pointer_width = "32",
))]
use crate::fd::AsFd;
@@ -32,7 +33,7 @@ use crate::fs::{
};
use crate::io;
use core::mem::{transmute, zeroed, MaybeUninit};
-#[cfg(target_arch = "mips64")]
+#[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]
use linux_raw_sys::general::stat as linux_stat64;
use linux_raw_sys::general::{
__kernel_fsid_t, __kernel_timespec, open_how, statx, AT_EACCESS, AT_FDCWD, AT_REMOVEDIR,
@@ -206,9 +207,9 @@ pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result<u64> {
}
SeekFrom::End(offset) => (SEEK_END, offset),
SeekFrom::Current(offset) => (SEEK_CUR, offset),
- #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ #[cfg(target_os = "linux")]
SeekFrom::Data(offset) => (SEEK_DATA, offset),
- #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ #[cfg(target_os = "linux")]
SeekFrom::Hole(offset) => (SEEK_HOLE, offset),
};
_seek(fd, offset, whence)
@@ -252,7 +253,12 @@ pub(crate) fn ftruncate(fd: BorrowedFd<'_>, length: u64) -> io::Result<()> {
// <https://github.com/torvalds/linux/blob/fcadab740480e0e0e9fa9bd272acd409884d431a/arch/arm64/kernel/sys32.c#L81-L83>
#[cfg(all(
target_pointer_width = "32",
- any(target_arch = "arm", target_arch = "mips", target_arch = "powerpc"),
+ any(
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "powerpc"
+ ),
))]
unsafe {
ret(syscall_readonly!(
@@ -265,7 +271,12 @@ pub(crate) fn ftruncate(fd: BorrowedFd<'_>, length: u64) -> io::Result<()> {
}
#[cfg(all(
target_pointer_width = "32",
- not(any(target_arch = "arm", target_arch = "mips", target_arch = "powerpc")),
+ not(any(
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "powerpc"
+ )),
))]
unsafe {
ret(syscall_readonly!(
@@ -348,7 +359,7 @@ pub(crate) fn fadvise(fd: BorrowedFd<'_>, pos: u64, len: u64, advice: Advice) ->
}
// On mips, the arguments are not reordered, and padding is inserted
// instead to ensure alignment.
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
unsafe {
ret(syscall_readonly!(
__NR_fadvise64,
@@ -363,7 +374,12 @@ pub(crate) fn fadvise(fd: BorrowedFd<'_>, pos: u64, len: u64, advice: Advice) ->
}
#[cfg(all(
target_pointer_width = "32",
- not(any(target_arch = "arm", target_arch = "mips", target_arch = "powerpc")),
+ not(any(
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "powerpc"
+ )),
))]
unsafe {
ret(syscall_readonly!(
@@ -427,7 +443,11 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result<Stat> {
// And, some old platforms don't support `statx`, and some fail with a
// confusing error code, so we call `crate::fs::statx` to handle that. If
// `statx` isn't available, fall back to the buggy system call.
- #[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
+ #[cfg(any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ ))]
{
match crate::fs::statx(fd, cstr!(""), AtFlags::EMPTY_PATH, StatxFlags::BASIC_STATS) {
Ok(x) => statx_to_stat(x),
@@ -436,7 +456,11 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result<Stat> {
}
}
- #[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))]
+ #[cfg(all(
+ target_pointer_width = "64",
+ not(target_arch = "mips64"),
+ not(target_arch = "mips64r6")
+ ))]
unsafe {
let mut result = MaybeUninit::<Stat>::uninit();
ret(syscall!(__NR_fstat, fd, &mut result))?;
@@ -444,11 +468,15 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result<Stat> {
}
}
-#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
+#[cfg(any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6",
+))]
fn fstat_old(fd: BorrowedFd<'_>) -> io::Result<Stat> {
let mut result = MaybeUninit::<linux_stat64>::uninit();
- #[cfg(target_arch = "mips64")]
+ #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]
unsafe {
ret(syscall!(__NR_fstat, fd, &mut result))?;
stat_to_stat(result.assume_init())
@@ -464,7 +492,11 @@ fn fstat_old(fd: BorrowedFd<'_>) -> io::Result<Stat> {
#[inline]
pub(crate) fn stat(path: &CStr) -> io::Result<Stat> {
// See the comments in `fstat` about using `crate::fs::statx` here.
- #[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
+ #[cfg(any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ ))]
{
match crate::fs::statx(
crate::fs::CWD.as_fd(),
@@ -478,7 +510,11 @@ pub(crate) fn stat(path: &CStr) -> io::Result<Stat> {
}
}
- #[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))]
+ #[cfg(all(
+ target_pointer_width = "64",
+ not(target_arch = "mips64"),
+ not(target_arch = "mips64r6"),
+ ))]
unsafe {
let mut result = MaybeUninit::<Stat>::uninit();
ret(syscall!(
@@ -492,11 +528,15 @@ pub(crate) fn stat(path: &CStr) -> io::Result<Stat> {
}
}
-#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
+#[cfg(any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+))]
fn stat_old(path: &CStr) -> io::Result<Stat> {
let mut result = MaybeUninit::<linux_stat64>::uninit();
- #[cfg(target_arch = "mips64")]
+ #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]
unsafe {
ret(syscall!(
__NR_newfstatat,
@@ -524,7 +564,11 @@ fn stat_old(path: &CStr) -> io::Result<Stat> {
#[inline]
pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<Stat> {
// See the comments in `fstat` about using `crate::fs::statx` here.
- #[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
+ #[cfg(any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ ))]
{
match crate::fs::statx(dirfd, path, flags, StatxFlags::BASIC_STATS) {
Ok(x) => statx_to_stat(x),
@@ -533,7 +577,11 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::
}
}
- #[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))]
+ #[cfg(all(
+ target_pointer_width = "64",
+ not(target_arch = "mips64"),
+ not(target_arch = "mips64r6"),
+ ))]
unsafe {
let mut result = MaybeUninit::<Stat>::uninit();
ret(syscall!(__NR_newfstatat, dirfd, path, &mut result, flags))?;
@@ -541,11 +589,15 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::
}
}
-#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
+#[cfg(any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+))]
fn statat_old(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<Stat> {
let mut result = MaybeUninit::<linux_stat64>::uninit();
- #[cfg(target_arch = "mips64")]
+ #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]
unsafe {
ret(syscall!(__NR_newfstatat, dirfd, path, &mut result, flags))?;
stat_to_stat(result.assume_init())
@@ -593,7 +645,7 @@ pub(crate) fn lstat(path: &CStr) -> io::Result<Stat> {
fn lstat_old(path: &CStr) -> io::Result<Stat> {
let mut result = MaybeUninit::<linux_stat64>::uninit();
- #[cfg(target_arch = "mips64")]
+ #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]
unsafe {
ret(syscall!(
__NR_newfstatat,
@@ -619,7 +671,11 @@ fn lstat_old(path: &CStr) -> io::Result<Stat> {
}
/// Convert from a Linux `statx` value to rustix's `Stat`.
-#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
+#[cfg(any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+))]
fn statx_to_stat(x: crate::fs::Statx) -> io::Result<Stat> {
Ok(Stat {
st_dev: crate::fs::makedev(x.stx_dev_major, x.stx_dev_minor),
@@ -686,7 +742,7 @@ fn stat_to_stat(s64: linux_raw_sys::general::stat64) -> io::Result<Stat> {
}
/// Convert from a Linux `stat` value to rustix's `Stat`.
-#[cfg(target_arch = "mips64")]
+#[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]
fn stat_to_stat(s: linux_raw_sys::general::stat) -> io::Result<Stat> {
Ok(Stat {
st_dev: s.st_dev.try_into().map_err(|_| io::Errno::OVERFLOW)?,
@@ -1417,31 +1473,6 @@ pub(crate) fn sendfile(
}
#[inline]
-pub(crate) fn mount(
- source: Option<&CStr>,
- target: &CStr,
- file_system_type: Option<&CStr>,
- flags: super::types::MountFlagsArg,
- data: Option<&CStr>,
-) -> io::Result<()> {
- unsafe {
- ret(syscall_readonly!(
- __NR_mount,
- source,
- target,
- file_system_type,
- flags,
- data
- ))
- }
-}
-
-#[inline]
-pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> {
- unsafe { ret(syscall_readonly!(__NR_umount2, target, flags)) }
-}
-
-#[inline]
pub(crate) fn inotify_init1(flags: inotify::CreateFlags) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(syscall_readonly!(__NR_inotify_init1, flags)) }
}
diff --git a/vendor/rustix/src/backend/linux_raw/fs/types.rs b/vendor/rustix/src/backend/linux_raw/fs/types.rs
index df61cf721..e18dc0b4d 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/types.rs
@@ -600,7 +600,11 @@ pub enum FlockOperation {
// On 32-bit, and mips64, Linux's `struct stat64` has a 32-bit `st_mtime` and
// friends, so we use our own struct, populated from `statx` where possible, to
// avoid the y2038 bug.
-#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
+#[cfg(any(
+ target_pointer_width = "32",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[allow(missing_docs)]
@@ -627,7 +631,11 @@ pub struct Stat {
///
/// [`statat`]: crate::fs::statat
/// [`fstat`]: crate::fs::fstat
-#[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))]
+#[cfg(all(
+ target_pointer_width = "64",
+ not(target_arch = "mips64"),
+ not(target_arch = "mips64r6")
+))]
pub type Stat = linux_raw_sys::general::stat;
/// `struct statfs` for use with [`statfs`] and [`fstatfs`].
@@ -688,117 +696,9 @@ pub type RawMode = c::c_uint;
pub type Dev = u64;
/// `__fsword_t`
-#[cfg(not(target_arch = "mips64"))]
+#[cfg(not(any(target_arch = "mips64", target_arch = "mips64r6")))]
pub type FsWord = linux_raw_sys::general::__fsword_t;
/// `__fsword_t`
-#[cfg(target_arch = "mips64")]
+#[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]
pub type FsWord = i64;
-
-bitflags! {
- /// `MS_*` constants for use with [`mount`].
- ///
- /// [`mount`]: crate::fs::mount
- #[repr(transparent)]
- #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub struct MountFlags: c::c_uint {
- /// `MS_BIND`
- const BIND = linux_raw_sys::general::MS_BIND;
-
- /// `MS_DIRSYNC`
- const DIRSYNC = linux_raw_sys::general::MS_DIRSYNC;
-
- /// `MS_LAZYTIME`
- const LAZYTIME = linux_raw_sys::general::MS_LAZYTIME;
-
- /// `MS_MANDLOCK`
- #[doc(alias = "MANDLOCK")]
- const PERMIT_MANDATORY_FILE_LOCKING = linux_raw_sys::general::MS_MANDLOCK;
-
- /// `MS_NOATIME`
- const NOATIME = linux_raw_sys::general::MS_NOATIME;
-
- /// `MS_NODEV`
- const NODEV = linux_raw_sys::general::MS_NODEV;
-
- /// `MS_NODIRATIME`
- const NODIRATIME = linux_raw_sys::general::MS_NODIRATIME;
-
- /// `MS_NOEXEC`
- const NOEXEC = linux_raw_sys::general::MS_NOEXEC;
-
- /// `MS_NOSUID`
- const NOSUID = linux_raw_sys::general::MS_NOSUID;
-
- /// `MS_RDONLY`
- const RDONLY = linux_raw_sys::general::MS_RDONLY;
-
- /// `MS_REC`
- const REC = linux_raw_sys::general::MS_REC;
-
- /// `MS_RELATIME`
- const RELATIME = linux_raw_sys::general::MS_RELATIME;
-
- /// `MS_SILENT`
- const SILENT = linux_raw_sys::general::MS_SILENT;
-
- /// `MS_STRICTATIME`
- const STRICTATIME = linux_raw_sys::general::MS_STRICTATIME;
-
- /// `MS_SYNCHRONOUS`
- const SYNCHRONOUS = linux_raw_sys::general::MS_SYNCHRONOUS;
-
- /// `MS_NOSYMFOLLOW`
- const NOSYMFOLLOW = linux_raw_sys::general::MS_NOSYMFOLLOW;
- }
-}
-
-bitflags! {
- /// `MS_*` constants for use with [`change_mount`].
- ///
- /// [`change_mount`]: crate::fs::mount::change_mount
- #[repr(transparent)]
- #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub struct MountPropagationFlags: c::c_uint {
- /// `MS_SHARED`
- const SHARED = linux_raw_sys::general::MS_SHARED;
- /// `MS_PRIVATE`
- const PRIVATE = linux_raw_sys::general::MS_PRIVATE;
- /// `MS_SLAVE`
- const SLAVE = linux_raw_sys::general::MS_SLAVE;
- /// `MS_UNBINDABLE`
- const UNBINDABLE = linux_raw_sys::general::MS_UNBINDABLE;
- /// `MS_REC`
- const REC = linux_raw_sys::general::MS_REC;
- }
-}
-
-bitflags! {
- #[repr(transparent)]
- #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub(crate) struct InternalMountFlags: c::c_uint {
- const REMOUNT = linux_raw_sys::general::MS_REMOUNT;
- const MOVE = linux_raw_sys::general::MS_MOVE;
- }
-}
-
-#[repr(transparent)]
-pub(crate) struct MountFlagsArg(pub(crate) c::c_uint);
-
-bitflags! {
- /// `MNT_*` constants for use with [`unmount`].
- ///
- /// [`unmount`]: crate::fs::mount::unmount
- #[repr(transparent)]
- #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub struct UnmountFlags: c::c_uint {
- /// `MNT_FORCE`
- const FORCE = linux_raw_sys::general::MNT_FORCE;
- /// `MNT_DETACH`
- const DETACH = linux_raw_sys::general::MNT_DETACH;
- /// `MNT_EXPIRE`
- const EXPIRE = linux_raw_sys::general::MNT_EXPIRE;
- /// `UMOUNT_NOFOLLOW`
- const NOFOLLOW = linux_raw_sys::general::UMOUNT_NOFOLLOW;
- }
-}
diff --git a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
index 45e0dd647..88eed3d72 100644
--- a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
@@ -10,7 +10,12 @@
use crate::backend::conv::loff_t_from_u64;
#[cfg(all(
target_pointer_width = "32",
- any(target_arch = "arm", target_arch = "mips", target_arch = "power"),
+ any(
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "power"
+ ),
))]
use crate::backend::conv::zero;
use crate::backend::conv::{
@@ -26,8 +31,6 @@ use crate::io::{self, DupFlags, FdFlags, IoSlice, IoSliceMut, ReadWriteFlags};
use crate::net::{RecvFlags, SendFlags};
use core::cmp;
use core::mem::MaybeUninit;
-#[cfg(target_os = "espidf")]
-use linux_raw_sys::general::F_DUPFD;
use linux_raw_sys::general::{F_DUPFD_CLOEXEC, F_GETFD, F_SETFD};
use linux_raw_sys::ioctl::{FIONBIO, FIONREAD};
@@ -45,7 +48,12 @@ pub(crate) fn pread(fd: BorrowedFd<'_>, buf: &mut [u8], pos: u64) -> io::Result<
// <https://github.com/torvalds/linux/blob/fcadab740480e0e0e9fa9bd272acd409884d431a/arch/arm64/kernel/sys32.c#L75>
#[cfg(all(
target_pointer_width = "32",
- any(target_arch = "arm", target_arch = "mips", target_arch = "power"),
+ any(
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "power"
+ ),
))]
unsafe {
ret_usize(syscall!(
@@ -60,7 +68,12 @@ pub(crate) fn pread(fd: BorrowedFd<'_>, buf: &mut [u8], pos: u64) -> io::Result<
}
#[cfg(all(
target_pointer_width = "32",
- not(any(target_arch = "arm", target_arch = "mips", target_arch = "power")),
+ not(any(
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "power"
+ )),
))]
unsafe {
ret_usize(syscall!(
@@ -170,7 +183,12 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], pos: u64) -> io::Result<usi
// <https://github.com/torvalds/linux/blob/fcadab740480e0e0e9fa9bd272acd409884d431a/arch/arm64/kernel/sys32.c#L81-L83>
#[cfg(all(
target_pointer_width = "32",
- any(target_arch = "arm", target_arch = "mips", target_arch = "power"),
+ any(
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "power"
+ ),
))]
unsafe {
ret_usize(syscall_readonly!(
@@ -185,7 +203,12 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], pos: u64) -> io::Result<usi
}
#[cfg(all(
target_pointer_width = "32",
- not(any(target_arch = "arm", target_arch = "mips", target_arch = "power")),
+ not(any(
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "power"
+ )),
))]
unsafe {
ret_usize(syscall_readonly!(
@@ -339,10 +362,7 @@ pub(crate) fn is_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)> {
// the write side is shut down.
#[allow(unreachable_patterns)] // `EAGAIN` equals `EWOULDBLOCK`
match crate::backend::net::syscalls::send(fd, &[], SendFlags::DONTWAIT) {
- // TODO or-patterns when we don't need 1.51
- Err(io::Errno::AGAIN) => (),
- Err(io::Errno::WOULDBLOCK) => (),
- Err(io::Errno::NOTSOCK) => (),
+ Err(io::Errno::AGAIN | io::Errno::WOULDBLOCK | io::Errno::NOTSOCK) => (),
Err(io::Errno::PIPE) => write = false,
Err(err) => return Err(err),
Ok(_) => (),
@@ -403,29 +423,6 @@ pub(crate) fn fcntl_setfd(fd: BorrowedFd<'_>, flags: FdFlags) -> io::Result<()>
}
}
-#[cfg(target_os = "espidf")]
-#[inline]
-pub(crate) fn fcntl_dupfd(fd: BorrowedFd<'_>, min: RawFd) -> io::Result<OwnedFd> {
- #[cfg(target_pointer_width = "32")]
- unsafe {
- ret_owned_fd(syscall_readonly!(
- __NR_fcntl64,
- fd,
- c_uint(F_DUPFD),
- raw_fd(min)
- ))
- }
- #[cfg(target_pointer_width = "64")]
- unsafe {
- ret_owned_fd(syscall_readonly!(
- __NR_fcntl,
- fd,
- c_uint(F_DUPFD),
- raw_fd(min)
- ))
- }
-}
-
#[inline]
pub(crate) fn fcntl_dupfd_cloexec(fd: BorrowedFd<'_>, min: RawFd) -> io::Result<OwnedFd> {
#[cfg(target_pointer_width = "32")]
diff --git a/vendor/rustix/src/backend/linux_raw/mm/types.rs b/vendor/rustix/src/backend/linux_raw/mm/types.rs
index 576f08a3d..2d5eebc58 100644
--- a/vendor/rustix/src/backend/linux_raw/mm/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/mm/types.rs
@@ -38,6 +38,20 @@ bitflags! {
const GROWSUP = linux_raw_sys::general::PROT_GROWSUP;
/// `PROT_GROWSDOWN`
const GROWSDOWN = linux_raw_sys::general::PROT_GROWSDOWN;
+ /// `PROT_SEM`
+ const SEM = linux_raw_sys::general::PROT_SEM;
+ /// `PROT_BTI`
+ #[cfg(target_arch = "aarch64")]
+ const BTI = linux_raw_sys::general::PROT_BTI;
+ /// `PROT_MTE`
+ #[cfg(target_arch = "aarch64")]
+ const MTE = linux_raw_sys::general::PROT_MTE;
+ /// `PROT_SAO`
+ #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
+ const SAO = linux_raw_sys::general::PROT_SAO;
+ /// `PROT_ADI`
+ #[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
+ const ADI = linux_raw_sys::general::PROT_ADI;
}
}
@@ -80,10 +94,10 @@ bitflags! {
/// `MAP_STACK`
const STACK = linux_raw_sys::general::MAP_STACK;
/// `MAP_SYNC` (since Linux 4.15)
- #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6")))]
const SYNC = linux_raw_sys::general::MAP_SYNC;
/// `MAP_UNINITIALIZED`
- #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6")))]
const UNINITIALIZED = linux_raw_sys::general::MAP_UNINITIALIZED;
}
}
@@ -106,18 +120,6 @@ bitflags! {
}
bitflags! {
- /// `MLOCK_*` flags for use with [`mlock_with`].
- ///
- /// [`mlock_with`]: crate::io::mlock_with
- #[repr(transparent)]
- #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub struct MlockFlags: u32 {
- /// `MLOCK_ONFAULT`
- const ONFAULT = linux_raw_sys::general::MLOCK_ONFAULT;
- }
-}
-
-bitflags! {
/// `MS_*` flags for use with [`msync`].
///
/// [`msync`]: crate::io::msync
@@ -137,16 +139,14 @@ bitflags! {
}
bitflags! {
- /// `O_*` flags for use with [`userfaultfd`].
+ /// `MLOCK_*` flags for use with [`mlock_with`].
///
- /// [`userfaultfd`]: crate::io::userfaultfd
+ /// [`mlock_with`]: crate::io::mlock_with
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub struct UserfaultfdFlags: c::c_uint {
- /// `O_CLOEXEC`
- const CLOEXEC = linux_raw_sys::general::O_CLOEXEC;
- /// `O_NONBLOCK`
- const NONBLOCK = linux_raw_sys::general::O_NONBLOCK;
+ pub struct MlockFlags: u32 {
+ /// `MLOCK_ONFAULT`
+ const ONFAULT = linux_raw_sys::general::MLOCK_ONFAULT;
}
}
@@ -183,7 +183,12 @@ pub enum Advice {
/// `MADV_HWPOISON`
LinuxHwPoison = linux_raw_sys::general::MADV_HWPOISON,
/// `MADV_SOFT_OFFLINE`
- #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
+ #[cfg(not(any(
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )))]
LinuxSoftOffline = linux_raw_sys::general::MADV_SOFT_OFFLINE,
/// `MADV_MERGEABLE`
LinuxMergeable = linux_raw_sys::general::MADV_MERGEABLE,
@@ -222,3 +227,17 @@ impl Advice {
/// `LinuxDontNeed` for the Linux behavior.
pub const DontNeed: Self = Self::Normal;
}
+
+bitflags! {
+ /// `O_*` flags for use with [`userfaultfd`].
+ ///
+ /// [`userfaultfd`]: crate::io::userfaultfd
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct UserfaultfdFlags: c::c_uint {
+ /// `O_CLOEXEC`
+ const CLOEXEC = linux_raw_sys::general::O_CLOEXEC;
+ /// `O_NONBLOCK`
+ const NONBLOCK = linux_raw_sys::general::O_NONBLOCK;
+ }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/mod.rs b/vendor/rustix/src/backend/linux_raw/mod.rs
index cd5805f88..c3018930f 100644
--- a/vendor/rustix/src/backend/linux_raw/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/mod.rs
@@ -51,6 +51,10 @@ pub(crate) mod io;
pub(crate) mod io_uring;
#[cfg(feature = "mm")]
pub(crate) mod mm;
+#[cfg(feature = "mount")]
+pub(crate) mod mount;
+#[cfg(all(feature = "fs", not(feature = "mount")))]
+pub(crate) mod mount; // for deprecated mount functions in "fs"
#[cfg(feature = "net")]
pub(crate) mod net;
#[cfg(any(
diff --git a/vendor/rustix/src/backend/linux_raw/mount/mod.rs b/vendor/rustix/src/backend/linux_raw/mount/mod.rs
new file mode 100644
index 000000000..1e0181a99
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/mount/mod.rs
@@ -0,0 +1,2 @@
+pub(crate) mod syscalls;
+pub(crate) mod types;
diff --git a/vendor/rustix/src/backend/linux_raw/mount/syscalls.rs b/vendor/rustix/src/backend/linux_raw/mount/syscalls.rs
new file mode 100644
index 000000000..77c2a181d
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/mount/syscalls.rs
@@ -0,0 +1,239 @@
+//! linux_raw syscalls supporting `rustix::mount`.
+//!
+//! # Safety
+//!
+//! See the `rustix::backend` module documentation for details.
+#![allow(unsafe_code)]
+#![allow(clippy::undocumented_unsafe_blocks)]
+
+use crate::backend::conv::ret;
+#[cfg(feature = "mount")]
+use crate::backend::conv::{ret_owned_fd, slice, zero};
+#[cfg(feature = "mount")]
+use crate::fd::{BorrowedFd, OwnedFd};
+use crate::ffi::CStr;
+use crate::io;
+
+#[inline]
+pub(crate) fn mount(
+ source: Option<&CStr>,
+ target: &CStr,
+ file_system_type: Option<&CStr>,
+ flags: super::types::MountFlagsArg,
+ data: Option<&CStr>,
+) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_mount,
+ source,
+ target,
+ file_system_type,
+ flags,
+ data
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_umount2, target, flags)) }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fsopen(fs_name: &CStr, flags: super::types::FsOpenFlags) -> io::Result<OwnedFd> {
+ unsafe { ret_owned_fd(syscall_readonly!(__NR_fsopen, fs_name, flags)) }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fsmount(
+ fs_fd: BorrowedFd<'_>,
+ flags: super::types::FsMountFlags,
+ attr_flags: super::types::MountAttrFlags,
+) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_fsmount, fs_fd, flags, attr_flags)) }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn move_mount(
+ from_dfd: BorrowedFd<'_>,
+ from_pathname: &CStr,
+ to_dfd: BorrowedFd<'_>,
+ to_pathname: &CStr,
+ flags: super::types::MoveMountFlags,
+) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_move_mount,
+ from_dfd,
+ from_pathname,
+ to_dfd,
+ to_pathname,
+ flags
+ ))
+ }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn open_tree(
+ dfd: BorrowedFd<'_>,
+ filename: &CStr,
+ flags: super::types::OpenTreeFlags,
+) -> io::Result<OwnedFd> {
+ unsafe { ret_owned_fd(syscall_readonly!(__NR_open_tree, dfd, filename, flags)) }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fspick(
+ dfd: BorrowedFd<'_>,
+ path: &CStr,
+ flags: super::types::FsPickFlags,
+) -> io::Result<OwnedFd> {
+ unsafe { ret_owned_fd(syscall_readonly!(__NR_fspick, dfd, path, flags)) }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fsconfig_set_flag(fs_fd: BorrowedFd<'_>, key: &CStr) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fsconfig,
+ fs_fd,
+ super::types::FsConfigCmd::SetFlag,
+ key,
+ zero(),
+ zero()
+ ))
+ }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fsconfig_set_string(
+ fs_fd: BorrowedFd<'_>,
+ key: &CStr,
+ value: &CStr,
+) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fsconfig,
+ fs_fd,
+ super::types::FsConfigCmd::SetString,
+ key,
+ value,
+ zero()
+ ))
+ }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fsconfig_set_binary(
+ fs_fd: BorrowedFd<'_>,
+ key: &CStr,
+ value: &[u8],
+) -> io::Result<()> {
+ let (value_addr, value_len) = slice(value);
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fsconfig,
+ fs_fd,
+ super::types::FsConfigCmd::SetBinary,
+ key,
+ value_addr,
+ value_len
+ ))
+ }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fsconfig_set_fd(
+ fs_fd: BorrowedFd<'_>,
+ key: &CStr,
+ fd: BorrowedFd<'_>,
+) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fsconfig,
+ fs_fd,
+ super::types::FsConfigCmd::SetFd,
+ key,
+ zero(),
+ fd
+ ))
+ }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fsconfig_set_path(
+ fs_fd: BorrowedFd<'_>,
+ key: &CStr,
+ path: &CStr,
+ fd: BorrowedFd<'_>,
+) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fsconfig,
+ fs_fd,
+ super::types::FsConfigCmd::SetPath,
+ key,
+ path,
+ fd
+ ))
+ }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fsconfig_set_path_empty(
+ fs_fd: BorrowedFd<'_>,
+ key: &CStr,
+ fd: BorrowedFd<'_>,
+) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fsconfig,
+ fs_fd,
+ super::types::FsConfigCmd::SetPathEmpty,
+ key,
+ cstr!(""),
+ fd
+ ))
+ }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fsconfig_create(fs_fd: BorrowedFd<'_>) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fsconfig,
+ fs_fd,
+ super::types::FsConfigCmd::Create,
+ zero(),
+ zero(),
+ zero()
+ ))
+ }
+}
+
+#[cfg(feature = "mount")]
+#[inline]
+pub(crate) fn fsconfig_reconfigure(fs_fd: BorrowedFd<'_>) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fsconfig,
+ fs_fd,
+ super::types::FsConfigCmd::Reconfigure,
+ zero(),
+ zero(),
+ zero()
+ ))
+ }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/mount/types.rs b/vendor/rustix/src/backend/linux_raw/mount/types.rs
new file mode 100644
index 000000000..808710c13
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/mount/types.rs
@@ -0,0 +1,303 @@
+use crate::backend::c;
+use bitflags::bitflags;
+
+bitflags! {
+ /// `MS_*` constants for use with [`mount`].
+ ///
+ /// [`mount`]: crate::mount::mount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct MountFlags: c::c_uint {
+ /// `MS_BIND`
+ const BIND = linux_raw_sys::general::MS_BIND;
+
+ /// `MS_DIRSYNC`
+ const DIRSYNC = linux_raw_sys::general::MS_DIRSYNC;
+
+ /// `MS_LAZYTIME`
+ const LAZYTIME = linux_raw_sys::general::MS_LAZYTIME;
+
+ /// `MS_MANDLOCK`
+ #[doc(alias = "MANDLOCK")]
+ const PERMIT_MANDATORY_FILE_LOCKING = linux_raw_sys::general::MS_MANDLOCK;
+
+ /// `MS_NOATIME`
+ const NOATIME = linux_raw_sys::general::MS_NOATIME;
+
+ /// `MS_NODEV`
+ const NODEV = linux_raw_sys::general::MS_NODEV;
+
+ /// `MS_NODIRATIME`
+ const NODIRATIME = linux_raw_sys::general::MS_NODIRATIME;
+
+ /// `MS_NOEXEC`
+ const NOEXEC = linux_raw_sys::general::MS_NOEXEC;
+
+ /// `MS_NOSUID`
+ const NOSUID = linux_raw_sys::general::MS_NOSUID;
+
+ /// `MS_RDONLY`
+ const RDONLY = linux_raw_sys::general::MS_RDONLY;
+
+ /// `MS_REC`
+ const REC = linux_raw_sys::general::MS_REC;
+
+ /// `MS_RELATIME`
+ const RELATIME = linux_raw_sys::general::MS_RELATIME;
+
+ /// `MS_SILENT`
+ const SILENT = linux_raw_sys::general::MS_SILENT;
+
+ /// `MS_STRICTATIME`
+ const STRICTATIME = linux_raw_sys::general::MS_STRICTATIME;
+
+ /// `MS_SYNCHRONOUS`
+ const SYNCHRONOUS = linux_raw_sys::general::MS_SYNCHRONOUS;
+
+ /// `MS_NOSYMFOLLOW`
+ const NOSYMFOLLOW = linux_raw_sys::general::MS_NOSYMFOLLOW;
+ }
+}
+
+bitflags! {
+ /// `MNT_*` constants for use with [`unmount`].
+ ///
+ /// [`unmount`]: crate::mount::unmount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct UnmountFlags: c::c_uint {
+ /// `MNT_FORCE`
+ const FORCE = linux_raw_sys::general::MNT_FORCE;
+ /// `MNT_DETACH`
+ const DETACH = linux_raw_sys::general::MNT_DETACH;
+ /// `MNT_EXPIRE`
+ const EXPIRE = linux_raw_sys::general::MNT_EXPIRE;
+ /// `UMOUNT_NOFOLLOW`
+ const NOFOLLOW = linux_raw_sys::general::UMOUNT_NOFOLLOW;
+ }
+}
+
+#[cfg(feature = "mount")]
+bitflags! {
+ /// `FSOPEN_*` constants for use with [`fsopen`].
+ ///
+ /// [`fsopen`]: crate::mount::fsopen
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct FsOpenFlags: c::c_uint {
+
+ /// `FSOPEN_CLOEXEC`
+ const FSOPEN_CLOEXEC = linux_raw_sys::general::FSOPEN_CLOEXEC;
+ }
+}
+
+#[cfg(feature = "mount")]
+bitflags! {
+ /// `FSMOUNT_*` constants for use with [`fsmount`].
+ ///
+ /// [`fsmount`]: crate::mount::fsmount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct FsMountFlags: c::c_uint {
+ /// `FSMOUNT_CLOEXEC`
+ const FSMOUNT_CLOEXEC = linux_raw_sys::general::FSMOUNT_CLOEXEC;
+ }
+}
+
+/// `FSCONFIG_*` constants for use with the `fsconfig` syscall.
+#[cfg(feature = "mount")]
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
+#[repr(u32)]
+pub(crate) enum FsConfigCmd {
+ /// `FSCONFIG_SET_FLAG`
+ SetFlag = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_FLAG as u32,
+
+ /// `FSCONFIG_SET_STRING`
+ SetString = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_STRING as u32,
+
+ /// `FSCONFIG_SET_BINARY`
+ SetBinary = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_BINARY as u32,
+
+ /// `FSCONFIG_SET_PATH`
+ SetPath = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_PATH as u32,
+
+ /// `FSCONFIG_SET_PATH_EMPTY`
+ SetPathEmpty = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_PATH_EMPTY as u32,
+
+ /// `FSCONFIG_SET_FD`
+ SetFd = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_FD as u32,
+
+ /// `FSCONFIG_CMD_CREATE`
+ Create = linux_raw_sys::general::fsconfig_command::FSCONFIG_CMD_CREATE as u32,
+
+ /// `FSCONFIG_CMD_RECONFIGURE`
+ Reconfigure = linux_raw_sys::general::fsconfig_command::FSCONFIG_CMD_RECONFIGURE as u32,
+}
+
+#[cfg(feature = "mount")]
+bitflags! {
+ /// `MOUNT_ATTR_*` constants for use with [`fsmount`].
+ ///
+ /// [`fsmount`]: crate::mount::fsmount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct MountAttrFlags: c::c_uint {
+ /// `MOUNT_ATTR_RDONLY`
+ const MOUNT_ATTR_RDONLY = linux_raw_sys::general::MOUNT_ATTR_RDONLY;
+
+ /// `MOUNT_ATTR_NOSUID`
+ const MOUNT_ATTR_NOSUID = linux_raw_sys::general::MOUNT_ATTR_NOSUID;
+
+ /// `MOUNT_ATTR_NODEV`
+ const MOUNT_ATTR_NODEV = linux_raw_sys::general::MOUNT_ATTR_NODEV;
+
+ /// `MOUNT_ATTR_NOEXEC`
+ const MOUNT_ATTR_NOEXEC = linux_raw_sys::general::MOUNT_ATTR_NOEXEC;
+
+ /// `MOUNT_ATTR__ATIME`
+ const MOUNT_ATTR__ATIME = linux_raw_sys::general::MOUNT_ATTR__ATIME;
+
+ /// `MOUNT_ATTR_RELATIME`
+ const MOUNT_ATTR_RELATIME = linux_raw_sys::general::MOUNT_ATTR_RELATIME;
+
+ /// `MOUNT_ATTR_NOATIME`
+ const MOUNT_ATTR_NOATIME = linux_raw_sys::general::MOUNT_ATTR_NOATIME;
+
+ /// `MOUNT_ATTR_STRICTATIME`
+ const MOUNT_ATTR_STRICTATIME = linux_raw_sys::general::MOUNT_ATTR_STRICTATIME;
+
+ /// `MOUNT_ATTR_NODIRATIME`
+ const MOUNT_ATTR_NODIRATIME = linux_raw_sys::general::MOUNT_ATTR_NODIRATIME;
+
+ /// `MOUNT_ATTR_NOUSER`
+ const MOUNT_ATTR_IDMAP = linux_raw_sys::general::MOUNT_ATTR_IDMAP;
+
+ /// `MOUNT_ATTR__ATIME_FLAGS`
+ const MOUNT_ATTR_NOSYMFOLLOW = linux_raw_sys::general::MOUNT_ATTR_NOSYMFOLLOW;
+
+ /// `MOUNT_ATTR__ATIME_FLAGS`
+ const MOUNT_ATTR_SIZE_VER0 = linux_raw_sys::general::MOUNT_ATTR_SIZE_VER0;
+ }
+}
+
+#[cfg(feature = "mount")]
+bitflags! {
+ /// `MOVE_MOUNT_*` constants for use with [`move_mount`].
+ ///
+ /// [`move_mount`]: crate::mount::move_mount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct MoveMountFlags: c::c_uint {
+ /// `MOVE_MOUNT_F_EMPTY_PATH`
+ const MOVE_MOUNT_F_SYMLINKS = linux_raw_sys::general::MOVE_MOUNT_F_SYMLINKS;
+
+ /// `MOVE_MOUNT_F_AUTOMOUNTS`
+ const MOVE_MOUNT_F_AUTOMOUNTS = linux_raw_sys::general::MOVE_MOUNT_F_AUTOMOUNTS;
+
+ /// `MOVE_MOUNT_F_EMPTY_PATH`
+ const MOVE_MOUNT_F_EMPTY_PATH = linux_raw_sys::general::MOVE_MOUNT_F_EMPTY_PATH;
+
+ /// `MOVE_MOUNT_T_SYMLINKS`
+ const MOVE_MOUNT_T_SYMLINKS = linux_raw_sys::general::MOVE_MOUNT_T_SYMLINKS;
+
+ /// `MOVE_MOUNT_T_AUTOMOUNTS`
+ const MOVE_MOUNT_T_AUTOMOUNTS = linux_raw_sys::general::MOVE_MOUNT_T_AUTOMOUNTS;
+
+ /// `MOVE_MOUNT_T_EMPTY_PATH`
+ const MOVE_MOUNT_T_EMPTY_PATH = linux_raw_sys::general::MOVE_MOUNT_T_EMPTY_PATH;
+
+ /// `MOVE_MOUNT__MASK`
+ const MOVE_MOUNT_SET_GROUP = linux_raw_sys::general::MOVE_MOUNT_SET_GROUP;
+
+ // TODO: add when linux 6.5 is released
+ // /// `MOVE_MOUNT_BENEATH`
+ // const MOVE_MOUNT_BENEATH = linux_raw_sys::general::MOVE_MOUNT_BENEATH;
+
+ /// `MOVE_MOUNT__MASK`
+ const MOVE_MOUNT__MASK = linux_raw_sys::general::MOVE_MOUNT__MASK;
+ }
+}
+
+#[cfg(feature = "mount")]
+bitflags! {
+ /// `OPENTREE_*` constants for use with [`open_tree`].
+ ///
+ /// [`open_tree`]: crate::mount::open_tree
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct OpenTreeFlags: c::c_uint {
+ /// `OPENTREE_CLONE`
+ const OPEN_TREE_CLONE = linux_raw_sys::general::OPEN_TREE_CLONE;
+
+ /// `OPENTREE_CLOEXEC`
+ const OPEN_TREE_CLOEXEC = linux_raw_sys::general::OPEN_TREE_CLOEXEC;
+
+ /// `AT_EMPTY_PATH`
+ const AT_EMPTY_PATH = linux_raw_sys::general::AT_EMPTY_PATH;
+
+ /// `AT_NO_AUTOMOUNT`
+ const AT_NO_AUTOMOUNT = linux_raw_sys::general::AT_NO_AUTOMOUNT;
+
+ /// `AT_RECURSIVE`
+ const AT_RECURSIVE = linux_raw_sys::general::AT_RECURSIVE;
+
+ /// `AT_SYMLINK_NOFOLLOW`
+ const AT_SYMLINK_NOFOLLOW = linux_raw_sys::general::AT_SYMLINK_NOFOLLOW;
+ }
+}
+
+#[cfg(feature = "mount")]
+bitflags! {
+ /// `FSPICK_*` constants for use with [`fspick`].
+ ///
+ /// [`fspick`]: crate::mount::fspick
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct FsPickFlags: c::c_uint {
+ /// `FSPICK_CLOEXEC`
+ const FSPICK_CLOEXEC = linux_raw_sys::general::FSPICK_CLOEXEC;
+
+ /// `FSPICK_SYMLINK_NOFOLLOW`
+ const FSPICK_SYMLINK_NOFOLLOW = linux_raw_sys::general::FSPICK_SYMLINK_NOFOLLOW;
+
+ /// `FSPICK_NO_AUTOMOUNT`
+ const FSPICK_NO_AUTOMOUNT = linux_raw_sys::general::FSPICK_NO_AUTOMOUNT;
+
+ /// `FSPICK_EMPTY_PATH`
+ const FSPICK_EMPTY_PATH = linux_raw_sys::general::FSPICK_EMPTY_PATH;
+ }
+}
+
+bitflags! {
+ /// `MS_*` constants for use with [`change_mount`].
+ ///
+ /// [`change_mount`]: crate::mount::change_mount
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct MountPropagationFlags: c::c_uint {
+ /// `MS_SILENT`
+ const SILENT = linux_raw_sys::general::MS_SILENT;
+ /// `MS_SHARED`
+ const SHARED = linux_raw_sys::general::MS_SHARED;
+ /// `MS_PRIVATE`
+ const PRIVATE = linux_raw_sys::general::MS_PRIVATE;
+ /// `MS_SLAVE`
+ const SLAVE = linux_raw_sys::general::MS_SLAVE;
+ /// `MS_UNBINDABLE`
+ const UNBINDABLE = linux_raw_sys::general::MS_UNBINDABLE;
+ /// `MS_REC`
+ const REC = linux_raw_sys::general::MS_REC;
+ }
+}
+
+bitflags! {
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub(crate) struct InternalMountFlags: c::c_uint {
+ const REMOUNT = linux_raw_sys::general::MS_REMOUNT;
+ const MOVE = linux_raw_sys::general::MS_MOVE;
+ }
+}
+
+#[repr(transparent)]
+pub(crate) struct MountFlagsArg(pub(crate) c::c_uint);
diff --git a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
index dca331783..df35e63c8 100644
--- a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
@@ -430,6 +430,7 @@ pub(crate) fn send(fd: BorrowedFd<'_>, buf: &[u8], flags: SendFlags) -> io::Resu
#[cfg(not(any(
target_arch = "aarch64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "riscv64",
target_arch = "x86",
target_arch = "x86_64",
@@ -440,6 +441,7 @@ pub(crate) fn send(fd: BorrowedFd<'_>, buf: &[u8], flags: SendFlags) -> io::Resu
#[cfg(any(
target_arch = "aarch64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "riscv64",
target_arch = "x86_64",
))]
@@ -585,6 +587,7 @@ pub(crate) fn recv(fd: BorrowedFd<'_>, buf: &mut [u8], flags: RecvFlags) -> io::
#[cfg(not(any(
target_arch = "aarch64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "riscv64",
target_arch = "x86",
target_arch = "x86_64",
@@ -595,6 +598,7 @@ pub(crate) fn recv(fd: BorrowedFd<'_>, buf: &mut [u8], flags: RecvFlags) -> io::
#[cfg(any(
target_arch = "aarch64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "riscv64",
target_arch = "x86_64",
))]
diff --git a/vendor/rustix/src/backend/linux_raw/param/auxv.rs b/vendor/rustix/src/backend/linux_raw/param/auxv.rs
index bf8935a0d..144ff10cd 100644
--- a/vendor/rustix/src/backend/linux_raw/param/auxv.rs
+++ b/vendor/rustix/src/backend/linux_raw/param/auxv.rs
@@ -161,6 +161,7 @@ fn pr_get_auxv() -> crate::io::Result<Vec<u8>> {
/// On non-Mustang platforms, we read the aux vector via the `prctl`
/// `PR_GET_AUXV`, with a fallback to /proc/self/auxv for kernels that don't
/// support `PR_GET_AUXV`.
+#[cold]
fn init_auxv() {
match pr_get_auxv() {
Ok(buffer) => {
@@ -185,6 +186,7 @@ fn init_auxv() {
}
/// Process auxv entries from the open file `auxv`.
+#[cold]
fn init_from_auxv_file(auxv: OwnedFd) -> Option<()> {
let mut buffer = Vec::<u8>::with_capacity(512);
loop {
@@ -220,6 +222,7 @@ fn init_from_auxv_file(auxv: OwnedFd) -> Option<()> {
///
/// The buffer contains `Elf_aux_t` elements, though it need not be aligned;
/// function uses `read_unaligned` to read from it.
+#[cold]
unsafe fn init_from_auxp(mut auxp: *const Elf_auxv_t) -> Option<()> {
let mut pagesz = 0;
let mut clktck = 0;
@@ -272,6 +275,7 @@ unsafe fn init_from_auxp(mut auxp: *const Elf_auxv_t) -> Option<()> {
/// `base` is some value we got from a `AT_BASE` aux record somewhere,
/// which hopefully holds the value of the program interpreter in memory. Do a
/// series of checks to be as sure as we can that it's safe to use.
+#[cold]
unsafe fn check_interpreter_base(base: *const Elf_Ehdr) -> Option<()> {
check_elf_base(base)?;
Some(())
@@ -282,6 +286,7 @@ unsafe fn check_interpreter_base(base: *const Elf_Ehdr) -> Option<()> {
/// `base` is some value we got from a `AT_SYSINFO_EHDR` aux record somewhere,
/// which hopefully holds the value of the kernel-provided vDSO in memory. Do a
/// series of checks to be as sure as we can that it's safe to use.
+#[cold]
unsafe fn check_vdso_base(base: *const Elf_Ehdr) -> Option<NonNull<Elf_Ehdr>> {
// In theory, we could check that we're not attempting to parse our own ELF
// image, as an additional check. However, older Linux toolchains don't
@@ -331,6 +336,7 @@ unsafe fn check_vdso_base(base: *const Elf_Ehdr) -> Option<NonNull<Elf_Ehdr>> {
}
/// Check that `base` is a valid pointer to an ELF image.
+#[cold]
unsafe fn check_elf_base(base: *const Elf_Ehdr) -> Option<NonNull<Elf_Ehdr>> {
// If we're reading a 64-bit auxv on a 32-bit platform, we'll see
// a zero `a_val` because `AT_*` values are never greater than
diff --git a/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs b/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs
index d05a87e53..97739fcb5 100644
--- a/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs
+++ b/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs
@@ -41,27 +41,23 @@ extern "C" {
#[cfg(target_os = "android")]
const _SC_PAGESIZE: c::c_int = 39;
-#[cfg(target_os = "emscripten")]
-const _SC_PAGESIZE: c::c_int = 30;
#[cfg(target_os = "linux")]
const _SC_PAGESIZE: c::c_int = 30;
#[cfg(target_os = "android")]
const _SC_CLK_TCK: c::c_int = 6;
-#[cfg(target_os = "emscripten")]
-const _SC_CLK_TCK: c::c_int = 2;
#[cfg(target_os = "linux")]
const _SC_CLK_TCK: c::c_int = 2;
#[test]
fn test_abi() {
- assert_eq!(self::_SC_PAGESIZE, ::libc::_SC_PAGESIZE);
- assert_eq!(self::_SC_CLK_TCK, ::libc::_SC_CLK_TCK);
- assert_eq!(self::AT_PHDR, ::libc::AT_PHDR);
- assert_eq!(self::AT_PHNUM, ::libc::AT_PHNUM);
- assert_eq!(self::AT_HWCAP, ::libc::AT_HWCAP);
- assert_eq!(self::AT_HWCAP2, ::libc::AT_HWCAP2);
- assert_eq!(self::AT_EXECFN, ::libc::AT_EXECFN);
- assert_eq!(self::AT_SYSINFO_EHDR, ::libc::AT_SYSINFO_EHDR);
+ const_assert_eq!(self::_SC_PAGESIZE, ::libc::_SC_PAGESIZE);
+ const_assert_eq!(self::_SC_CLK_TCK, ::libc::_SC_CLK_TCK);
+ const_assert_eq!(self::AT_PHDR, ::libc::AT_PHDR);
+ const_assert_eq!(self::AT_PHNUM, ::libc::AT_PHNUM);
+ const_assert_eq!(self::AT_HWCAP, ::libc::AT_HWCAP);
+ const_assert_eq!(self::AT_HWCAP2, ::libc::AT_HWCAP2);
+ const_assert_eq!(self::AT_EXECFN, ::libc::AT_EXECFN);
+ const_assert_eq!(self::AT_SYSINFO_EHDR, ::libc::AT_SYSINFO_EHDR);
}
#[cfg(feature = "param")]
diff --git a/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs b/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs
index ed121089d..e05094237 100644
--- a/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs
@@ -23,7 +23,9 @@ pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
#[cfg(any(
target_arch = "aarch64",
target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "riscv64",
))]
{
@@ -32,7 +34,9 @@ pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
#[cfg(not(any(
target_arch = "aarch64",
target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "riscv64",
)))]
unsafe {
diff --git a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
index ac6e28901..5ec2755ff 100644
--- a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
@@ -33,7 +33,6 @@ use linux_raw_sys::general::{
RLIM64_INFINITY, RLIM_INFINITY,
};
use linux_raw_sys::ioctl::TIOCSCTTY;
-#[cfg(not(target_os = "wasi"))]
#[cfg(feature = "fs")]
use {crate::backend::conv::ret_c_uint_infallible, crate::fs::Mode};
diff --git a/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs b/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs
index c2d1b07c1..529564c34 100644
--- a/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs
@@ -13,12 +13,10 @@ use crate::ffi::CString;
use crate::io;
use crate::path::DecInt;
use crate::pty::OpenptFlags;
-#[cfg(any(apple, freebsdlike, linux_like, target_os = "fuchsia"))]
use alloc::vec::Vec;
use core::mem::MaybeUninit;
use linux_raw_sys::ioctl::{TIOCGPTN, TIOCGPTPEER, TIOCSPTLCK};
-#[cfg(any(apple, freebsdlike, linux_like, target_os = "fuchsia"))]
#[inline]
pub(crate) fn ptsname(fd: BorrowedFd, mut buffer: Vec<u8>) -> io::Result<CString> {
unsafe {
diff --git a/vendor/rustix/src/backend/linux_raw/reg.rs b/vendor/rustix/src/backend/linux_raw/reg.rs
index 206031dde..c4e495c52 100644
--- a/vendor/rustix/src/backend/linux_raw/reg.rs
+++ b/vendor/rustix/src/backend/linux_raw/reg.rs
@@ -1,9 +1,8 @@
//! Encapsulation for system call arguments and return values.
//!
-//! The inline-asm and outline-asm code paths do some amount of reordering
-//! of arguments; to ensure that we don't accidentally misroute an argument
-//! or return value, we use distinct types for each argument index and
-//! return value.
+//! The inline-asm code paths do some amount of reordering of arguments; to
+//! ensure that we don't accidentally misroute an argument or return value,
+//! we use distinct types for each argument index and return value.
//!
//! # Safety
//!
@@ -55,7 +54,7 @@ pub(super) struct A2(());
pub(super) struct A3(());
pub(super) struct A4(());
pub(super) struct A5(());
-#[cfg(target_arch = "mips")]
+#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
pub(super) struct A6(());
#[cfg(target_arch = "x86")]
pub(super) struct SocketArg;
@@ -67,7 +66,7 @@ impl ArgNumber for A2 {}
impl ArgNumber for A3 {}
impl ArgNumber for A4 {}
impl ArgNumber for A5 {}
-#[cfg(target_arch = "mips")]
+#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
impl ArgNumber for A6 {}
#[cfg(target_arch = "x86")]
impl ArgNumber for SocketArg {}
@@ -251,7 +250,7 @@ mod private {
impl Sealed for super::A3 {}
impl Sealed for super::A4 {}
impl Sealed for super::A5 {}
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
impl Sealed for super::A6 {}
#[cfg(target_arch = "x86")]
impl Sealed for super::SocketArg {}
diff --git a/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
index b9814e731..f82e2187b 100644
--- a/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
@@ -22,7 +22,7 @@ use crate::pid::Pid;
use crate::runtime::{How, Sigaction, Siginfo, Sigset, Stack};
use crate::signal::Signal;
use crate::timespec::Timespec;
-use crate::utils::optional_as_ptr;
+use crate::utils::option_as_ptr;
use core::mem::MaybeUninit;
#[cfg(target_pointer_width = "32")]
use linux_raw_sys::general::__kernel_old_timespec;
@@ -117,7 +117,7 @@ pub(crate) mod tls {
#[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());
+ let new = option_as_ptr(new.as_ref());
ret(syscall!(
__NR_rt_sigaction,
signal,
@@ -131,7 +131,7 @@ pub(crate) unsafe fn sigaction(signal: Signal, new: Option<Sigaction>) -> io::Re
#[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());
+ let new = option_as_ptr(new.as_ref());
ret(syscall!(__NR_sigaltstack, new, &mut old))?;
Ok(old.assume_init())
}
@@ -144,7 +144,7 @@ pub(crate) unsafe fn tkill(tid: Pid, sig: Signal) -> io::Result<()> {
#[inline]
pub(crate) unsafe fn sigprocmask(how: How, new: Option<&Sigset>) -> io::Result<Sigset> {
let mut old = MaybeUninit::<Sigset>::uninit();
- let new = optional_as_ptr(new);
+ let new = option_as_ptr(new);
ret(syscall!(
__NR_rt_sigprocmask,
how,
@@ -189,7 +189,7 @@ pub(crate) fn sigwaitinfo(set: &Sigset) -> io::Result<Siginfo> {
#[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());
+ let timeout_ptr = option_as_ptr(timeout.as_ref());
// `rt_sigtimedwait_time64` was introduced in Linux 5.1. The old
// `rt_sigtimedwait` syscall is not y2038-compatible on 32-bit
@@ -237,7 +237,7 @@ unsafe fn sigtimedwait_old(
None => None,
};
- let old_timeout_ptr = optional_as_ptr(old_timeout.as_ref());
+ let old_timeout_ptr = option_as_ptr(old_timeout.as_ref());
let _signum = ret_c_int(syscall!(
__NR_rt_sigtimedwait,
diff --git a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
index 5e21397bc..8f030e1c3 100644
--- a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
@@ -63,7 +63,12 @@ pub(crate) fn tcsetattr(
// Translate from `optional_actions` into an ioctl request code. On MIPS,
// `optional_actions` already has `TCGETS` added to it.
let request = linux_raw_sys::ioctl::TCSETS2
- + if cfg!(any(target_arch = "mips", target_arch = "mips64")) {
+ + if cfg!(any(
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6"
+ )) {
optional_actions as u32 - linux_raw_sys::ioctl::TCSETS
} else {
optional_actions as u32
diff --git a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
index 422793690..316d26a1c 100644
--- a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
+++ b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
@@ -12,8 +12,8 @@
#[cfg(target_arch = "x86")]
use super::reg::{ArgReg, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0};
use super::vdso;
-#[cfg(all(asm, target_arch = "x86"))]
-use core::arch::asm;
+#[cfg(target_arch = "x86")]
+use core::arch::global_asm;
use core::mem::transmute;
use core::ptr::null_mut;
use core::sync::atomic::AtomicPtr;
@@ -45,6 +45,10 @@ pub(crate) fn clock_gettime(which_clock: ClockId) -> __kernel_timespec {
None => init_clock_gettime(),
};
let r0 = callee(which_clock as c::c_int, result.as_mut_ptr());
+ // The `ClockId` enum only contains clocks which never fail. It may be
+ // tempting to change this to `debug_assert_eq`, however they can still
+ // fail on uncommon kernel configs, so we leave this in place to ensure
+ // that we don't execute undefined behavior if they ever do fail.
assert_eq!(r0, 0);
result.assume_init()
}
@@ -227,6 +231,7 @@ pub(super) type SyscallType = unsafe extern "C" fn();
/// Initialize `CLOCK_GETTIME` and return its value.
#[cfg(feature = "time")]
+#[cold]
fn init_clock_gettime() -> ClockGettimeType {
init();
// SAFETY: Load the function address from static storage that we
@@ -236,6 +241,7 @@ fn init_clock_gettime() -> ClockGettimeType {
/// Initialize `SYSCALL` and return its value.
#[cfg(target_arch = "x86")]
+#[cold]
fn init_syscall() -> SyscallType {
init();
// SAFETY: Load the function address from static storage that we
@@ -310,21 +316,34 @@ 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
-/// 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"))]
-#[naked]
-unsafe extern "C" fn rustix_int_0x80() {
- asm!("int $$0x80", "ret", options(noreturn))
-}
-
-// The outline version of the `rustix_int_0x80` above.
-#[cfg(all(not(asm), target_arch = "x86"))]
+#[cfg(target_arch = "x86")]
extern "C" {
+ /// 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.
+ ///
+ /// This extern block and the `global_asm!` below can be replaced with
+ /// `#[naked]` if it's stabilized.
fn rustix_int_0x80();
}
+#[cfg(target_arch = "x86")]
+global_asm!(
+ r#"
+ .section .text.rustix_int_0x80,"ax",@progbits
+ .p2align 4
+ .weak rustix_int_0x80
+ .hidden rustix_int_0x80
+ .type rustix_int_0x80, @function
+rustix_int_0x80:
+ .cfi_startproc
+ int 0x80
+ ret
+ .cfi_endproc
+ .size rustix_int_0x80, .-rustix_int_0x80
+"#
+);
+
fn minimal_init() {
// SAFETY: Store default function addresses in static storage so that if we
// end up making any system calls while we read the vDSO, they'll work.
@@ -380,9 +399,9 @@ fn init() {
let ptr = vdso.sym(cstr!("LINUX_4.15"), cstr!("__vdso_clock_gettime"));
#[cfg(target_arch = "powerpc64")]
let ptr = vdso.sym(cstr!("LINUX_2.6.15"), cstr!("__kernel_clock_gettime"));
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
let ptr = vdso.sym(cstr!("LINUX_2.6"), cstr!("__vdso_clock_gettime64"));
- #[cfg(target_arch = "mips64")]
+ #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]
let ptr = vdso.sym(cstr!("LINUX_2.6"), cstr!("__vdso_clock_gettime"));
// On all 64-bit platforms, the 64-bit `clock_gettime` symbols are
@@ -392,7 +411,12 @@ fn init() {
// On some 32-bit platforms, the 64-bit `clock_gettime` symbols are not
// available on older kernel versions.
- #[cfg(any(target_arch = "arm", target_arch = "mips", target_arch = "x86"))]
+ #[cfg(any(
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "x86"
+ ))]
let ok = !ptr.is_null();
if ok {