use linux_raw_sys::general::membarrier_cmd;
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
#[repr(u32)]
pub enum MembarrierCommand {
#[doc(alias = "Shared")]
#[doc(alias = "MEMBARRIER_CMD_SHARED")]
Global = membarrier_cmd::MEMBARRIER_CMD_GLOBAL as _,
GlobalExpedited = membarrier_cmd::MEMBARRIER_CMD_GLOBAL_EXPEDITED as _,
RegisterGlobalExpedited = membarrier_cmd::MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED as _,
PrivateExpedited = membarrier_cmd::MEMBARRIER_CMD_PRIVATE_EXPEDITED as _,
RegisterPrivateExpedited = membarrier_cmd::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED as _,
PrivateExpeditedSyncCore = membarrier_cmd::MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE as _,
RegisterPrivateExpeditedSyncCore =
membarrier_cmd::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE as _,
PrivateExpeditedRseq = membarrier_cmd::MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ as _,
RegisterPrivateExpeditedRseq =
membarrier_cmd::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ as _,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(u32)]
pub enum Resource {
Cpu = linux_raw_sys::general::RLIMIT_CPU,
Fsize = linux_raw_sys::general::RLIMIT_FSIZE,
Data = linux_raw_sys::general::RLIMIT_DATA,
Stack = linux_raw_sys::general::RLIMIT_STACK,
Core = linux_raw_sys::general::RLIMIT_CORE,
Rss = linux_raw_sys::general::RLIMIT_RSS,
Nproc = linux_raw_sys::general::RLIMIT_NPROC,
Nofile = linux_raw_sys::general::RLIMIT_NOFILE,
Memlock = linux_raw_sys::general::RLIMIT_MEMLOCK,
As = linux_raw_sys::general::RLIMIT_AS,
Locks = linux_raw_sys::general::RLIMIT_LOCKS,
Sigpending = linux_raw_sys::general::RLIMIT_SIGPENDING,
Msgqueue = linux_raw_sys::general::RLIMIT_MSGQUEUE,
Nice = linux_raw_sys::general::RLIMIT_NICE,
Rtprio = linux_raw_sys::general::RLIMIT_RTPRIO,
Rttime = linux_raw_sys::general::RLIMIT_RTTIME,
}
pub type RawCpuid = u32;
#[repr(C)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub(crate) struct RawCpuSet {
#[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))]
pub(crate) bits: [u32; 32],
#[cfg(not(all(target_pointer_width = "32", not(target_arch = "x86_64"))))]
pub(crate) bits: [u64; 16],
}
#[inline]
pub(crate) fn raw_cpu_set_new() -> RawCpuSet {
#[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))]
{
RawCpuSet { bits: [0; 32] }
}
#[cfg(not(all(target_pointer_width = "32", not(target_arch = "x86_64"))))]
{
RawCpuSet { bits: [0; 16] }
}
}
pub(crate) const CPU_SETSIZE: usize = 8 * core::mem::size_of::<RawCpuSet>();