Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sa_sigaction instead of sa_union.__su_sigaction for AIX #2614

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,6 @@ impl SigAction {
/// is the `SigAction` variant). `mask` specifies other signals to block during execution of
/// the signal-catching function.
pub fn new(handler: SigHandler, flags: SaFlags, mask: SigSet) -> SigAction {
#[cfg(not(target_os = "aix"))]
unsafe fn install_sig(p: *mut libc::sigaction, handler: SigHandler) {
unsafe {
(*p).sa_sigaction = match handler {
Expand All @@ -797,18 +796,6 @@ impl SigAction {
}
}

#[cfg(target_os = "aix")]
unsafe fn install_sig(p: *mut libc::sigaction, handler: SigHandler) {
unsafe {
(*p).sa_union.__su_sigaction = match handler {
SigHandler::SigDfl => unsafe { mem::transmute::<usize, extern "C" fn(libc::c_int, *mut libc::siginfo_t, *mut libc::c_void)>(libc::SIG_DFL) },
SigHandler::SigIgn => unsafe { mem::transmute::<usize, extern "C" fn(libc::c_int, *mut libc::siginfo_t, *mut libc::c_void)>(libc::SIG_IGN) },
SigHandler::Handler(f) => unsafe { mem::transmute::<extern "C" fn(i32), extern "C" fn(i32, *mut libc::siginfo_t, *mut libc::c_void)>(f) },
SigHandler::SigAction(f) => f,
};
}
}

let mut s = mem::MaybeUninit::<libc::sigaction>::uninit();
unsafe {
let p = s.as_mut_ptr();
Expand Down Expand Up @@ -836,7 +823,6 @@ impl SigAction {
}

/// Returns the action's handler.
#[cfg(not(target_os = "aix"))]
pub fn handler(&self) -> SigHandler {
match self.sigaction.sa_sigaction {
libc::SIG_DFL => SigHandler::SigDfl,
Expand Down Expand Up @@ -869,26 +855,6 @@ impl SigAction {
as extern "C" fn(libc::c_int)),
}
}

/// Returns the action's handler.
#[cfg(target_os = "aix")]
pub fn handler(&self) -> SigHandler {
unsafe {
match self.sigaction.sa_union.__su_sigaction as usize {
libc::SIG_DFL => SigHandler::SigDfl,
libc::SIG_IGN => SigHandler::SigIgn,
p if self.flags().contains(SaFlags::SA_SIGINFO) =>
SigHandler::SigAction(
*(&p as *const usize
as *const extern "C" fn(_, _, _))
as extern "C" fn(_, _, _)),
p => SigHandler::Handler(
*(&p as *const usize
as *const extern "C" fn(libc::c_int))
as extern "C" fn(libc::c_int)),
}
}
}
}

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