From 9918693037dce8aa4bb6f08741b6812923486c18 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 19 Jun 2024 11:26:03 +0200 Subject: Merging upstream version 1.76.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/rustix/src/process/mod.rs | 4 ++-- vendor/rustix/src/process/sched.rs | 15 +++++++++++++++ vendor/rustix/src/process/wait.rs | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) (limited to 'vendor/rustix/src/process') diff --git a/vendor/rustix/src/process/mod.rs b/vendor/rustix/src/process/mod.rs index 195216c3a..5fbc1f3b7 100644 --- a/vendor/rustix/src/process/mod.rs +++ b/vendor/rustix/src/process/mod.rs @@ -32,7 +32,7 @@ mod procctl; target_os = "wasi" )))] mod rlimit; -#[cfg(any(linux_kernel, target_os = "dragonfly", target_os = "fuchsia"))] +#[cfg(any(freebsdlike, linux_kernel, target_os = "fuchsia"))] mod sched; mod sched_yield; #[cfg(not(target_os = "wasi"))] // WASI doesn't have umask. @@ -71,7 +71,7 @@ pub use procctl::*; target_os = "wasi" )))] pub use rlimit::*; -#[cfg(any(linux_kernel, target_os = "dragonfly", target_os = "fuchsia"))] +#[cfg(any(freebsdlike, linux_kernel, target_os = "fuchsia"))] pub use sched::*; pub use sched_yield::sched_yield; #[cfg(not(target_os = "wasi"))] diff --git a/vendor/rustix/src/process/sched.rs b/vendor/rustix/src/process/sched.rs index b7dcd58cc..d6a303af5 100644 --- a/vendor/rustix/src/process/sched.rs +++ b/vendor/rustix/src/process/sched.rs @@ -108,3 +108,18 @@ pub fn sched_getaffinity(pid: Option) -> io::Result { let mut cpuset = CpuSet::new(); backend::process::syscalls::sched_getaffinity(pid, &mut cpuset.cpu_set).and(Ok(cpuset)) } + +/// `sched_getcpu()`—Get the CPU that the current thread is currently on. +/// +/// # References +/// - [Linux] +/// - [DragonFly BSD] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/sched_getcpu.2.html +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sched_getcpu§ion=2 +// FreeBSD added `sched_getcpu` in 13.0. +#[cfg(any(linux_kernel, target_os = "dragonfly"))] +#[inline] +pub fn sched_getcpu() -> usize { + backend::process::syscalls::sched_getcpu() +} diff --git a/vendor/rustix/src/process/wait.rs b/vendor/rustix/src/process/wait.rs index ccb90ae43..4d0e6e25d 100644 --- a/vendor/rustix/src/process/wait.rs +++ b/vendor/rustix/src/process/wait.rs @@ -37,7 +37,7 @@ bitflags! { /// Return immediately if no child has exited. const NOHANG = bitcast!(backend::process::wait::WNOHANG); /// Return if a stopped child has been resumed by delivery of - /// [`Signal::Cont`] + /// [`Signal::Cont`]. const CONTINUED = bitcast!(backend::process::wait::WCONTINUED); /// Wait for processed that have exited. const EXITED = bitcast!(backend::process::wait::WEXITED); -- cgit v1.2.3