From 3f80953dee5cba450dc161315d7b8c58862c6462 Mon Sep 17 00:00:00 2001 From: Niv Kaminer Date: Tue, 22 May 2018 23:24:35 +0300 Subject: [PATCH] signal: account for definition mismatch on aarch64 android --- src/unix.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/unix.rs b/src/unix.rs index bf4a01391..85cbc8fe0 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -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::(fnptr); action(signum) } else { @@ -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