Skip to content

Commit

Permalink
Temporary excluded MIPS from real-time signal support.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrysoliteAzalea committed Jul 22, 2024
1 parent f047ff3 commit aa2b84c
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ const SIGNALS: [Signal; 31] = [

// Support for real-time signals
/// Operating system signal value
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_arch = "mips")))]
#[cfg(any(feature = "aio", feature = "signal"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum SignalValue {
Expand All @@ -381,7 +381,7 @@ pub enum SignalValue {

// Support for real-time signals
/// Operating system signal value
#[cfg(not(target_os = "linux"))]
#[cfg(any(not(target_os = "linux"), all(target_os = "linux", target_arch = "mips")))]
#[cfg(any(feature = "signal", feature = "aio"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum SignalValue {
Expand All @@ -391,7 +391,7 @@ pub enum SignalValue {

#[cfg(any(feature = "aio", feature = "signal"))]
impl SignalValue {
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_arch = "mips")))]
#[allow(dead_code)]
unsafe fn convert_to_int_unchecked(self) -> libc::c_int {
// Note: dead code is allowed, since this is a private method that can remain unused on some platforms
Expand All @@ -401,7 +401,7 @@ impl SignalValue {
}
}

#[cfg(not(target_os = "linux"))]
#[cfg(any(not(target_os = "linux"), all(target_os = "linux", target_arch = "mips")))]
#[allow(dead_code)]
unsafe fn convert_to_int_unchecked(self) -> libc::c_int {
// Note: dead code is allowed, since this is a private method that can remain unused on some platforms
Expand All @@ -411,7 +411,7 @@ impl SignalValue {
}

/// Check whether this enum contains a valid signal for this operating system
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_arch = "mips")))]
pub fn is_valid(&self) -> bool {
match self {
SignalValue::Standard(_) => true,
Expand All @@ -422,7 +422,7 @@ impl SignalValue {
}

/// Check whether this enum contains a valid signal for this operating system
#[cfg(not(target_os = "linux"))]
#[cfg(any(not(target_os = "linux"), all(target_os = "linux", target_arch = "mips")))]
pub fn is_valid(&self) -> bool {
match self {
SignalValue::Standard(_) => true,
Expand All @@ -432,7 +432,7 @@ impl SignalValue {

#[cfg(feature = "signal")]
impl From<SignalValue> for String {
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_arch = "mips")))]
fn from(x: SignalValue) -> Self {
match x {
SignalValue::Standard(s) => s.to_string(),
Expand All @@ -442,7 +442,7 @@ impl From<SignalValue> for String {
}
}

#[cfg(not(target_os = "linux"))]
#[cfg(any(not(target_os = "linux"), all(target_os = "linux", target_arch = "mips")))]
fn from(x: SignalValue) -> Self {
match x {
SignalValue::Standard(s) => s.to_string(),
Expand All @@ -454,7 +454,7 @@ impl From<SignalValue> for String {
impl TryFrom<i32> for SignalValue {
type Error = Errno;

#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_arch = "mips")))]
fn try_from(x: i32) -> Result<Self> {
if x < libc::SIGRTMIN() {
match Signal::try_from(x) {
Expand All @@ -466,7 +466,7 @@ impl TryFrom<i32> for SignalValue {
}
}

#[cfg(not(target_os = "linux"))]
#[cfg(any(not(target_os = "linux"), all(target_os = "linux", target_arch = "mips")))]
fn try_from(x: i32) -> Result<Self> {
match Signal::try_from(x) {
Ok(s) => Ok(SignalValue::Standard(s)),
Expand All @@ -479,7 +479,7 @@ impl TryFrom<i32> for SignalValue {
impl TryFrom<SignalValue> for i32 {
type Error = Errno;

#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_arch = "mips")))]
fn try_from(x: SignalValue) -> Result<Self> {
match x {
SignalValue::Standard(s) => Ok(s as i32),
Expand All @@ -494,7 +494,7 @@ impl TryFrom<SignalValue> for i32 {
}
}

#[cfg(not(target_os = "linux"))]
#[cfg(any(not(target_os = "linux"), all(target_os = "linux", target_arch = "mips")))]
fn try_from(x: SignalValue) -> Result<Self> {
match x {
SignalValue::Standard(s) => Ok(s as i32),
Expand All @@ -513,15 +513,15 @@ impl From<Signal> for SignalValue {
impl TryFrom<SignalValue> for Signal {
type Error = Errno;

#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_arch = "mips")))]
fn try_from(x: SignalValue) -> Result<Self> {
match x {
SignalValue::Standard(s) => Ok(s),
SignalValue::Realtime(_) => Err(Errno::EINVAL),
}
}

#[cfg(not(target_os = "linux"))]
#[cfg(any(not(target_os = "linux"), all(target_os = "linux", target_arch = "mips")))]
fn try_from(x: SignalValue) -> Result<Self> {
match x {
SignalValue::Standard(s) => Ok(s),
Expand Down Expand Up @@ -561,7 +561,7 @@ impl Iterator for SignalIterator {
impl Iterator for SignalValueIterator {
type Item = SignalValue;

#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_arch = "mips")))]
fn next(&mut self) -> Option<SignalValue> {
let next_signal = match SignalValue::try_from(self.next) {
Ok(s) => {
Expand All @@ -578,7 +578,7 @@ impl Iterator for SignalValueIterator {
if next_signal.is_valid() { Some(next_signal) } else { None }
}

#[cfg(not(target_os = "linux"))]
#[cfg(any(not(target_os = "linux"), all(target_os = "linux", target_arch = "mips")))]
fn next(&mut self) -> Option<SignalValue> {
let next_signal = match SignalValue::try_from(self.next) {
Ok(s) => {
Expand Down

0 comments on commit aa2b84c

Please sign in to comment.