-
Notifications
You must be signed in to change notification settings - Fork 88
Support AIX signal handler types #136
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,6 +141,9 @@ pub(crate) fn wake(pipe: RawFd, method: WakeMethod) { | |
| let data = b"X" as *const _ as *const _; | ||
| match method { | ||
| WakeMethod::Write => libc::write(pipe, data, 1), | ||
| #[cfg(target_os = "aix")] | ||
| WakeMethod::Send => libc::send(pipe, data, 1, libc::MSG_NONBLOCK), | ||
| #[cfg(not(target_os = "aix"))] | ||
|
||
| WakeMethod::Send => libc::send(pipe, data, 1, libc::MSG_DONTWAIT), | ||
| }; | ||
| } | ||
|
|
@@ -170,7 +173,10 @@ pub(crate) fn wake(pipe: RawFd, method: WakeMethod) { | |
| /// * If it is not possible, the [`O_NONBLOCK`][libc::O_NONBLOCK] will be set on the file | ||
| /// descriptor and [`write`][libc::write] will be used instead. | ||
| pub fn register_raw(signal: c_int, pipe: RawFd) -> Result<SigId, Error> { | ||
| #[cfg(not(target_os = "aix"))] | ||
| let res = unsafe { libc::send(pipe, &[] as *const _, 0, libc::MSG_DONTWAIT) }; | ||
| #[cfg(target_os = "aix")] | ||
| let res = unsafe { libc::send(pipe, &[] as *const _, 0, libc::MSG_NONBLOCK) }; | ||
|
||
| let fd = match (res, Error::last_os_error().kind()) { | ||
| (0, _) | (-1, ErrorKind::WouldBlock) => WakeFd { | ||
| fd: pipe, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,7 +111,17 @@ fn restore_default(signal: c_int) -> Result<(), Error> { | |
| unsafe { | ||
| // A C structure, supposed to be memset to 0 before use. | ||
| let mut action: libc::sigaction = mem::zeroed(); | ||
| action.sa_sigaction = libc::SIG_DFL as _; | ||
| #[cfg(target_os = "aix")] | ||
| let set_action = |action: &mut libc::sigaction, sigaction| { | ||
| action.sa_union.__su_sigaction = mem::transmute::< | ||
| usize, | ||
| extern "C" fn(libc::c_int, *mut libc::siginfo_t, *mut libc::c_void), | ||
| >(sigaction) | ||
| }; | ||
|
||
| #[cfg(not(target_os = "aix"))] | ||
| let set_action = | ||
| |action: &mut libc::sigaction, sigaction| action.sa_sigaction = sigaction as _; | ||
| set_action(&mut action, libc::SIG_DFL); | ||
| if libc::sigaction(signal, &action, ptr::null_mut()) == 0 { | ||
| Ok(()) | ||
| } else { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why in this super-complicated way and not just having conditionally-compiled blocks?