Skip to content

Commit

Permalink
Use sa_sigaction instead the union for AIX.
Browse files Browse the repository at this point in the history
  • Loading branch information
xingxue-ibm committed Jan 23, 2025
1 parent 0f9f8c9 commit 03b30be
Showing 1 changed file with 3 additions and 51 deletions.
54 changes: 3 additions & 51 deletions src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,20 +533,15 @@ s! {
pub it_interval: crate::timespec,
pub it_value: crate::timespec,
}
}

s_no_extra_traits! {
pub union __sigaction_sa_union {
pub __su_handler: extern "C" fn(c: c_int),
pub __su_sigaction: extern "C" fn(c: c_int, info: *mut siginfo_t, ptr: *mut c_void),
}

pub struct sigaction {
pub sa_union: __sigaction_sa_union,
pub sa_sigaction: crate::sighandler_t, //actually a union with sa_handle
pub sa_mask: sigset_t,
pub sa_flags: c_int,
}
}

s_no_extra_traits! {
pub union __poll_ctl_ext_u {
pub addr: *mut c_void,
pub data32: u32,
Expand All @@ -565,49 +560,6 @@ s_no_extra_traits! {

cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for __sigaction_sa_union {
fn eq(&self, other: &__sigaction_sa_union) -> bool {
unsafe {
self.__su_handler == other.__su_handler
&& self.__su_sigaction == other.__su_sigaction
}
}
}
impl Eq for __sigaction_sa_union {}
impl hash::Hash for __sigaction_sa_union {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
unsafe {
self.__su_handler.hash(state);
self.__su_sigaction.hash(state);
}
}
}

impl PartialEq for sigaction {
fn eq(&self, other: &sigaction) -> bool {
self.sa_mask == other.sa_mask
&& self.sa_flags == other.sa_flags
&& self.sa_union == other.sa_union
}
}
impl Eq for sigaction {}
impl fmt::Debug for sigaction {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("sigaction")
.field("sa_union", &self.sa_union)
.field("sa_mask", &self.sa_mask)
.field("sa_flags", &self.sa_flags)
.finish()
}
}
impl hash::Hash for sigaction {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.sa_union.hash(state);
self.sa_mask.hash(state);
self.sa_flags.hash(state);
}
}

impl PartialEq for __poll_ctl_ext_u {
fn eq(&self, other: &__poll_ctl_ext_u) -> bool {
unsafe {
Expand Down

0 comments on commit 03b30be

Please sign in to comment.