Skip to content
This repository has been archived by the owner on Sep 15, 2018. It is now read-only.

Commit

Permalink
Merge pull request #30 from nivkner/android_aarch64
Browse files Browse the repository at this point in the history
account for definition mismatch on aarch64 android
  • Loading branch information
Marwes committed May 27, 2018
2 parents 63f6e24 + 44c3646 commit 5f04df3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ extern "C" fn handler(signum: c_int, info: *mut libc::siginfo_t, ptr: *mut libc:
if fnptr == 0 || fnptr == libc::SIG_DFL || fnptr == libc::SIG_IGN {
return;
}
if (*slot.prev.get()).sa_flags & libc::SA_SIGINFO == 0 {
#[cfg(all(target_os = "android", target_pointer_width = "64"))]
let contains_siginfo = (*slot.prev.get()).sa_flags & libc::SA_SIGINFO as libc::c_uint;
#[cfg(not(all(target_os = "android", target_pointer_width = "64")))]
let contains_siginfo = (*slot.prev.get()).sa_flags & libc::SA_SIGINFO;
if contains_siginfo == 0 {
let action = mem::transmute::<usize, FnHandler>(fnptr);
action(signum)
} else {
Expand All @@ -132,11 +136,16 @@ fn signal_enable(signal: c_int) -> io::Result<()> {
None => return Err(io::Error::new(io::ErrorKind::Other, "signal too large")),
};
unsafe {
#[cfg(target_os = "android")]
#[cfg(all(target_os = "android", target_pointer_width = "32"))]
fn flags() -> libc::c_ulong {
(libc::SA_RESTART as libc::c_ulong) | libc::SA_SIGINFO
| (libc::SA_NOCLDSTOP as libc::c_ulong)
}
#[cfg(all(target_os = "android", target_pointer_width = "64"))]
fn flags() -> libc::c_uint {
(libc::SA_RESTART as libc::c_uint) | (libc::SA_SIGINFO as libc::c_uint)
| (libc::SA_NOCLDSTOP as libc::c_uint)
}
#[cfg(not(target_os = "android"))]
fn flags() -> c_int {
libc::SA_RESTART | libc::SA_SIGINFO | libc::SA_NOCLDSTOP
Expand Down

0 comments on commit 5f04df3

Please sign in to comment.