diff options
Diffstat (limited to 'vendor/rustix/src/thread')
-rw-r--r-- | vendor/rustix/src/thread/futex.rs | 2 | ||||
-rw-r--r-- | vendor/rustix/src/thread/id.rs | 9 | ||||
-rw-r--r-- | vendor/rustix/src/thread/libcap.rs | 3 | ||||
-rw-r--r-- | vendor/rustix/src/thread/mod.rs | 9 | ||||
-rw-r--r-- | vendor/rustix/src/thread/prctl.rs | 38 | ||||
-rw-r--r-- | vendor/rustix/src/thread/setns.rs | 10 |
6 files changed, 48 insertions, 23 deletions
diff --git a/vendor/rustix/src/thread/futex.rs b/vendor/rustix/src/thread/futex.rs index 7c4399f7a..47947c8b5 100644 --- a/vendor/rustix/src/thread/futex.rs +++ b/vendor/rustix/src/thread/futex.rs @@ -9,7 +9,7 @@ use crate::thread::Timespec; use crate::{backend, io}; -pub use backend::thread::{FutexFlags, FutexOperation}; +pub use backend::thread::futex::{FutexFlags, FutexOperation}; /// `futex(uaddr, op, val, utime, uaddr2, val3)` /// diff --git a/vendor/rustix/src/thread/id.rs b/vendor/rustix/src/thread/id.rs index fa3bcfb8d..11193c9d1 100644 --- a/vendor/rustix/src/thread/id.rs +++ b/vendor/rustix/src/thread/id.rs @@ -1,7 +1,8 @@ -use crate::pid::Pid; -use crate::ugid::{Gid, Uid}; use crate::{backend, io}; +pub use crate::pid::{Pid, RawPid}; +pub use crate::ugid::{Gid, RawGid, RawUid, Uid}; + /// `gettid()`—Returns the thread ID. /// /// This returns the OS thread ID, which is not necessarily the same as the @@ -69,7 +70,7 @@ pub fn set_thread_res_uid(ruid: Uid, euid: Uid, suid: Uid) -> io::Result<()> { /// /// # Warning /// -/// This is not the setxid you are looking for... POSIX requires xids to be +/// This is not the setxid you are looking for… POSIX requires xids to be /// process granular, but on Linux they are per-thread. Thus, this call only /// changes the xid for the current *thread*, not the entire process even /// though that is in violation of the POSIX standard. @@ -94,7 +95,7 @@ pub fn set_thread_gid(gid: Gid) -> io::Result<()> { /// /// # Warning /// -/// This is not the setresxid you are looking for... POSIX requires xids to be +/// This is not the setresxid you are looking for… POSIX requires xids to be /// process granular, but on Linux they are per-thread. Thus, this call only /// changes the xid for the current *thread*, not the entire process even /// though that is in violation of the POSIX standard. diff --git a/vendor/rustix/src/thread/libcap.rs b/vendor/rustix/src/thread/libcap.rs index 8d2368720..19f81a904 100644 --- a/vendor/rustix/src/thread/libcap.rs +++ b/vendor/rustix/src/thread/libcap.rs @@ -102,6 +102,9 @@ bitflags! { const BPF = 1 << linux_raw_sys::general::CAP_BPF; /// `CAP_CHECKPOINT_RESTORE` const CHECKPOINT_RESTORE = 1 << linux_raw_sys::general::CAP_CHECKPOINT_RESTORE; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } diff --git a/vendor/rustix/src/thread/mod.rs b/vendor/rustix/src/thread/mod.rs index fa4897025..6f19635f0 100644 --- a/vendor/rustix/src/thread/mod.rs +++ b/vendor/rustix/src/thread/mod.rs @@ -2,7 +2,7 @@ #[cfg(not(target_os = "redox"))] mod clock; -#[cfg(linux_raw)] +#[cfg(linux_kernel)] mod futex; #[cfg(linux_kernel)] mod id; @@ -15,10 +15,13 @@ mod setns; #[cfg(not(target_os = "redox"))] pub use clock::*; -#[cfg(linux_raw)] +#[cfg(linux_kernel)] pub use futex::{futex, FutexFlags, FutexOperation}; #[cfg(linux_kernel)] -pub use id::{gettid, set_thread_gid, set_thread_res_gid, set_thread_res_uid, set_thread_uid}; +pub use id::{ + gettid, set_thread_gid, set_thread_res_gid, set_thread_res_uid, set_thread_uid, Gid, Pid, + RawGid, RawPid, RawUid, Uid, +}; #[cfg(linux_kernel)] pub use libcap::{capabilities, set_capabilities, CapabilityFlags, CapabilitySets}; #[cfg(linux_kernel)] diff --git a/vendor/rustix/src/thread/prctl.rs b/vendor/rustix/src/thread/prctl.rs index a9f411640..b2d40d65c 100644 --- a/vendor/rustix/src/thread/prctl.rs +++ b/vendor/rustix/src/thread/prctl.rs @@ -19,7 +19,9 @@ use bitflags::bitflags; use crate::backend::c::{c_int, c_uint, c_void}; use crate::backend::prctl::syscalls; -use crate::ffi::{CStr, CString}; +use crate::ffi::CStr; +#[cfg(feature = "alloc")] +use crate::ffi::CString; use crate::io; use crate::pid::Pid; use crate::prctl::{ @@ -61,6 +63,7 @@ pub fn set_keep_capabilities(enable: bool) -> io::Result<()> { // PR_GET_NAME/PR_SET_NAME // +#[cfg(feature = "alloc")] const PR_GET_NAME: c_int = 16; /// Get the name of the calling thread. @@ -70,6 +73,7 @@ const PR_GET_NAME: c_int = 16; /// /// [`prctl(PR_GET_NAME,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html #[inline] +#[cfg(feature = "alloc")] pub fn name() -> io::Result<CString> { let mut buffer = [0_u8; 16]; unsafe { prctl_2args(PR_GET_NAME, buffer.as_mut_ptr().cast())? }; @@ -134,8 +138,8 @@ impl TryFrom<i32> for SecureComputingMode { /// computing mode, then this call will cause a [`Signal::Kill`] signal to be /// sent to the process. If the caller is in filter mode, and this system call /// is allowed by the seccomp filters, it returns -/// [`SecureComputingMode::Filter`]; otherwise, the process is killed with -/// a [`Signal::Kill`] signal. +/// [`SecureComputingMode::Filter`]; otherwise, the process is killed with a +/// [`Signal::Kill`] signal. /// /// Since Linux 3.8, the Seccomp field of the `/proc/[pid]/status` file /// provides a method of obtaining the same information, without the risk that @@ -414,28 +418,33 @@ bitflags! { #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct CapabilitiesSecureBits: u32 { - /// If this bit is set, then the kernel does not grant capabilities when - /// a `set-user-ID-root` program is executed, or when a process with an effective or real - /// UID of 0 calls `execve`. + /// If this bit is set, then the kernel does not grant capabilities + /// when a `set-user-ID-root` program is executed, or when a process + /// with an effective or real UID of 0 calls `execve`. const NO_ROOT = 1_u32 << 0; /// Set [`NO_ROOT`] irreversibly. const NO_ROOT_LOCKED = 1_u32 << 1; - /// Setting this flag stops the kernel from adjusting the process's permitted, effective, - /// and ambient capability sets when the thread's effective and filesystem UIDs are switched - /// between zero and nonzero values. + /// Setting this flag stops the kernel from adjusting the process' + /// permitted, effective, and ambient capability sets when the thread's + /// effective and filesystem UIDs are switched between zero and nonzero + /// values. const NO_SETUID_FIXUP = 1_u32 << 2; /// Set [`NO_SETUID_FIXUP`] irreversibly. const NO_SETUID_FIXUP_LOCKED = 1_u32 << 3; - /// Setting this flag allows a thread that has one or more 0 UIDs to retain capabilities in - /// its permitted set when it switches all of its UIDs to nonzero values. + /// Setting this flag allows a thread that has one or more 0 UIDs to + /// retain capabilities in its permitted set when it switches all of + /// its UIDs to nonzero values. const KEEP_CAPS = 1_u32 << 4; /// Set [`KEEP_CAPS`] irreversibly. const KEEP_CAPS_LOCKED = 1_u32 << 5; - /// Setting this flag disallows raising ambient capabilities via the `prctl`'s - /// `PR_CAP_AMBIENT_RAISE` operation. + /// Setting this flag disallows raising ambient capabilities via the + /// `prctl`'s `PR_CAP_AMBIENT_RAISE` operation. const NO_CAP_AMBIENT_RAISE = 1_u32 << 6; /// Set [`NO_CAP_AMBIENT_RAISE`] irreversibly. const NO_CAP_AMBIENT_RAISE_LOCKED = 1_u32 << 7; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -743,6 +752,9 @@ bitflags! { const TCF_SYNC = 1_u32 << 1; /// Asynchronous tag check fault mode. const TCF_ASYNC = 1_u32 << 2; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } diff --git a/vendor/rustix/src/thread/setns.rs b/vendor/rustix/src/thread/setns.rs index 2dd522a14..4568912b2 100644 --- a/vendor/rustix/src/thread/setns.rs +++ b/vendor/rustix/src/thread/setns.rs @@ -30,6 +30,9 @@ bitflags! { const PROCESS_ID = CLONE_NEWPID; /// Network name space. const NETWORK = CLONE_NEWNET; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -82,6 +85,9 @@ bitflags! { const NEWUTS = CLONE_NEWUTS; /// `CLONE_SYSVSEM`. const SYSVSEM = CLONE_SYSVSEM; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -96,7 +102,7 @@ bitflags! { /// /// [Linux]: https://man7.org/linux/man-pages/man2/setns.2.html pub fn move_into_link_name_space( - fd: BorrowedFd, + fd: BorrowedFd<'_>, allowed_type: Option<LinkNameSpaceType>, ) -> io::Result<()> { let allowed_type = allowed_type.map_or(0, |t| t as c_int); @@ -113,7 +119,7 @@ pub fn move_into_link_name_space( /// /// [Linux]: https://man7.org/linux/man-pages/man2/setns.2.html pub fn move_into_thread_name_spaces( - fd: BorrowedFd, + fd: BorrowedFd<'_>, allowed_types: ThreadNameSpaceType, ) -> io::Result<()> { syscalls::setns(fd, allowed_types.bits() as c_int).map(|_r| ()) |