summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/process/membarrier.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/rustix/src/process/membarrier.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/process/membarrier.rs')
-rw-r--r--vendor/rustix/src/process/membarrier.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/vendor/rustix/src/process/membarrier.rs b/vendor/rustix/src/process/membarrier.rs
index 8709337bc..df9f1a44c 100644
--- a/vendor/rustix/src/process/membarrier.rs
+++ b/vendor/rustix/src/process/membarrier.rs
@@ -1,24 +1,20 @@
//! The Linux `membarrier` syscall.
-//!
-//! # Safety
-//!
-//! This file defines an enum and a bitflags type that represent the same
-//! set of values and are kept in sync.
-#![allow(unsafe_code)]
use crate::process::Cpuid;
use crate::{backend, io};
pub use backend::process::types::MembarrierCommand;
-#[cfg(any(target_os = "android", target_os = "linux"))]
+#[cfg(linux_kernel)]
bitflags::bitflags! {
/// A result from [`membarrier_query`].
///
/// These flags correspond to values of [`MembarrierCommand`] which are
/// supported in the OS.
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct MembarrierQuery: u32 {
- /// `MEMBARRIER_CMD_GLOBAL`
+ /// `MEMBARRIER_CMD_GLOBAL` (also known as `MEMBARRIER_CMD_SHARED`)
#[doc(alias = "SHARED")]
#[doc(alias = "MEMBARRIER_CMD_SHARED")]
const GLOBAL = MembarrierCommand::Global as _;
@@ -41,14 +37,14 @@ bitflags::bitflags! {
}
}
-#[cfg(any(target_os = "android", target_os = "linux"))]
+#[cfg(linux_kernel)]
impl MembarrierQuery {
/// Test whether this query result contains the given command.
#[inline]
pub fn contains_command(self, cmd: MembarrierCommand) -> bool {
- // SAFETY: `MembarrierCommand` is an enum that only contains values
- // also valid in `MembarrierQuery`.
- self.contains(unsafe { Self::from_bits_unchecked(cmd as _) })
+ // `MembarrierCommand` is an enum that only contains values also valid
+ // in `MembarrierQuery`.
+ self.contains(Self::from_bits_retain(cmd as _))
}
}