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

Support AIX signal action types #33

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
14 changes: 13 additions & 1 deletion src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ impl State {

// Register our sigchld handler
let mut new: libc::sigaction = mem::zeroed();
new.sa_sigaction = sigchld_handler as usize;

#[cfg(not(target_os = "aix"))]
let set_handler =
|action: &mut libc::sigaction, handler| action.sa_sigaction = handler as usize;
#[cfg(target_os = "aix")]
let set_handler =
|action: &mut libc::sigaction, handler| action.sa_union.__su_sigaction = handler;
set_handler(&mut new, sigchld_handler);

new.sa_flags = libc::SA_NOCLDSTOP | libc::SA_RESTART | libc::SA_SIGINFO;

assert_eq!(libc::sigaction(libc::SIGCHLD, &new, &mut state.prev), 0);
Expand Down Expand Up @@ -256,7 +264,11 @@ extern "C" fn sigchld_handler(signum: c_int, info: *mut libc::siginfo_t, ptr: *m
let state = &*STATE;
notify(&state.write);

#[cfg(not(target_os = "aix"))]
let fnptr = state.prev.sa_sigaction;
#[cfg(target_os = "aix")]
let fnptr = state.prev.sa_union.__su_sigaction as usize;

if fnptr == 0 {
return;
}
Expand Down