Skip to content

Commit 142a52c

Browse files
xingxue-ibmSteveLauC
authored andcommitted
Use sa_sigaction instead of sa_union.__su_sigaction for AIX.
1 parent 2e6956e commit 142a52c

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

src/sys/signal.rs

-34
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,6 @@ impl SigAction {
784784
/// is the `SigAction` variant). `mask` specifies other signals to block during execution of
785785
/// the signal-catching function.
786786
pub fn new(handler: SigHandler, flags: SaFlags, mask: SigSet) -> SigAction {
787-
#[cfg(not(target_os = "aix"))]
788787
unsafe fn install_sig(p: *mut libc::sigaction, handler: SigHandler) {
789788
unsafe {
790789
(*p).sa_sigaction = match handler {
@@ -797,18 +796,6 @@ impl SigAction {
797796
}
798797
}
799798

800-
#[cfg(target_os = "aix")]
801-
unsafe fn install_sig(p: *mut libc::sigaction, handler: SigHandler) {
802-
unsafe {
803-
(*p).sa_union.__su_sigaction = match handler {
804-
SigHandler::SigDfl => unsafe { mem::transmute::<usize, extern "C" fn(libc::c_int, *mut libc::siginfo_t, *mut libc::c_void)>(libc::SIG_DFL) },
805-
SigHandler::SigIgn => unsafe { mem::transmute::<usize, extern "C" fn(libc::c_int, *mut libc::siginfo_t, *mut libc::c_void)>(libc::SIG_IGN) },
806-
SigHandler::Handler(f) => unsafe { mem::transmute::<extern "C" fn(i32), extern "C" fn(i32, *mut libc::siginfo_t, *mut libc::c_void)>(f) },
807-
SigHandler::SigAction(f) => f,
808-
};
809-
}
810-
}
811-
812799
let mut s = mem::MaybeUninit::<libc::sigaction>::uninit();
813800
unsafe {
814801
let p = s.as_mut_ptr();
@@ -836,7 +823,6 @@ impl SigAction {
836823
}
837824

838825
/// Returns the action's handler.
839-
#[cfg(not(target_os = "aix"))]
840826
pub fn handler(&self) -> SigHandler {
841827
match self.sigaction.sa_sigaction {
842828
libc::SIG_DFL => SigHandler::SigDfl,
@@ -869,26 +855,6 @@ impl SigAction {
869855
as extern "C" fn(libc::c_int)),
870856
}
871857
}
872-
873-
/// Returns the action's handler.
874-
#[cfg(target_os = "aix")]
875-
pub fn handler(&self) -> SigHandler {
876-
unsafe {
877-
match self.sigaction.sa_union.__su_sigaction as usize {
878-
libc::SIG_DFL => SigHandler::SigDfl,
879-
libc::SIG_IGN => SigHandler::SigIgn,
880-
p if self.flags().contains(SaFlags::SA_SIGINFO) =>
881-
SigHandler::SigAction(
882-
*(&p as *const usize
883-
as *const extern "C" fn(_, _, _))
884-
as extern "C" fn(_, _, _)),
885-
p => SigHandler::Handler(
886-
*(&p as *const usize
887-
as *const extern "C" fn(libc::c_int))
888-
as extern "C" fn(libc::c_int)),
889-
}
890-
}
891-
}
892858
}
893859

894860
/// Changes the action taken by a process on receipt of a specific signal.

0 commit comments

Comments
 (0)