rustix/backend/libc/process/
types.rs#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
use crate::backend::c;
#[cfg(linux_kernel)]
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
#[repr(u32)]
pub enum MembarrierCommand {
#[doc(alias = "Shared")]
#[doc(alias = "MEMBARRIER_CMD_SHARED")]
Global = c::MEMBARRIER_CMD_GLOBAL as u32,
GlobalExpedited = c::MEMBARRIER_CMD_GLOBAL_EXPEDITED as u32,
RegisterGlobalExpedited = c::MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED as u32,
PrivateExpedited = c::MEMBARRIER_CMD_PRIVATE_EXPEDITED as u32,
RegisterPrivateExpedited = c::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED as u32,
PrivateExpeditedSyncCore = c::MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE as u32,
RegisterPrivateExpeditedSyncCore =
c::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE as u32,
PrivateExpeditedRseq = c::MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ as u32,
RegisterPrivateExpeditedRseq = c::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ as u32,
}
#[cfg(not(any(
target_os = "espidf",
target_os = "fuchsia",
target_os = "redox",
target_os = "vita",
target_os = "wasi"
)))]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(not(target_os = "l4re"), repr(u32))]
#[cfg_attr(target_os = "l4re", repr(u64))]
pub enum Resource {
Cpu = bitcast!(c::RLIMIT_CPU),
Fsize = bitcast!(c::RLIMIT_FSIZE),
Data = bitcast!(c::RLIMIT_DATA),
Stack = bitcast!(c::RLIMIT_STACK),
#[cfg(not(target_os = "haiku"))]
Core = bitcast!(c::RLIMIT_CORE),
#[cfg(not(any(apple, solarish, target_os = "nto", target_os = "haiku")))]
Rss = bitcast!(c::RLIMIT_RSS),
#[cfg(not(any(solarish, target_os = "haiku")))]
Nproc = bitcast!(c::RLIMIT_NPROC),
Nofile = bitcast!(c::RLIMIT_NOFILE),
#[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
Memlock = bitcast!(c::RLIMIT_MEMLOCK),
#[cfg(not(target_os = "openbsd"))]
As = bitcast!(c::RLIMIT_AS),
#[cfg(not(any(
bsd,
solarish,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "nto"
)))]
Locks = bitcast!(c::RLIMIT_LOCKS),
#[cfg(not(any(
bsd,
solarish,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "nto"
)))]
Sigpending = bitcast!(c::RLIMIT_SIGPENDING),
#[cfg(not(any(
bsd,
solarish,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "nto"
)))]
Msgqueue = bitcast!(c::RLIMIT_MSGQUEUE),
#[cfg(not(any(
bsd,
solarish,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "nto"
)))]
Nice = bitcast!(c::RLIMIT_NICE),
#[cfg(not(any(
bsd,
solarish,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "nto"
)))]
Rtprio = bitcast!(c::RLIMIT_RTPRIO),
#[cfg(not(any(
bsd,
solarish,
target_os = "aix",
target_os = "android",
target_os = "emscripten",
target_os = "haiku",
target_os = "hurd",
target_os = "nto",
)))]
Rttime = bitcast!(c::RLIMIT_RTTIME),
}
#[cfg(apple)]
#[allow(non_upper_case_globals)]
impl Resource {
pub const Rss: Self = Self::As;
}
#[cfg(linux_kernel)]
pub type RawCpuid = u32;
#[cfg(freebsdlike)]
pub type RawId = c::id_t;
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
pub(crate) type RawCpuSet = c::cpu_set_t;
#[cfg(freebsdlike)]
pub(crate) type RawCpuSet = c::cpuset_t;
#[cfg(any(freebsdlike, linux_kernel, target_os = "fuchsia"))]
#[inline]
pub(crate) fn raw_cpu_set_new() -> RawCpuSet {
let mut set = unsafe { core::mem::zeroed() };
super::cpu_set::CPU_ZERO(&mut set);
set
}
#[cfg(any(freebsdlike, linux_kernel, target_os = "fuchsia"))]
pub(crate) const CPU_SETSIZE: usize = c::CPU_SETSIZE as usize;