mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-09 00:00:08 +02:00
committed by
Carl Lerche
parent
0df1882f21
commit
8ddebf4309
+13
-3
@@ -138,13 +138,23 @@ fn signal_enable(signal: c_int) -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
unsafe {
|
unsafe {
|
||||||
|
#[cfg(target_os = "android")]
|
||||||
|
fn flags() -> libc::c_ulong {
|
||||||
|
(libc::SA_RESTART as libc::c_ulong) |
|
||||||
|
libc::SA_SIGINFO |
|
||||||
|
(libc::SA_NOCLDSTOP as libc::c_ulong)
|
||||||
|
}
|
||||||
|
#[cfg(not(target_os = "android"))]
|
||||||
|
fn flags() -> c_int {
|
||||||
|
libc::SA_RESTART |
|
||||||
|
libc::SA_SIGINFO |
|
||||||
|
libc::SA_NOCLDSTOP
|
||||||
|
}
|
||||||
let mut err = None;
|
let mut err = None;
|
||||||
siginfo.init.call_once(|| {
|
siginfo.init.call_once(|| {
|
||||||
let mut new: libc::sigaction = mem::zeroed();
|
let mut new: libc::sigaction = mem::zeroed();
|
||||||
new.sa_sigaction = handler as usize;
|
new.sa_sigaction = handler as usize;
|
||||||
new.sa_flags = libc::SA_RESTART |
|
new.sa_flags = flags();
|
||||||
libc::SA_SIGINFO |
|
|
||||||
libc::SA_NOCLDSTOP;
|
|
||||||
if libc::sigaction(signal, &new, &mut *siginfo.prev.get()) != 0 {
|
if libc::sigaction(signal, &new, &mut *siginfo.prev.get()) != 0 {
|
||||||
err = Some(io::Error::last_os_error());
|
err = Some(io::Error::last_os_error());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user