Fix signal handlers after EINTR nanosleep.
This commit is contained in:
+15
-6
@@ -6,10 +6,17 @@ use syscall::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
arch::*, current_proc_fd, proc::FdGuard, protocol::{
|
||||
arch::*,
|
||||
current_proc_fd,
|
||||
proc::FdGuard,
|
||||
protocol::{
|
||||
ProcCall, RtSigInfo, ThreadCall, SIGCHLD, SIGKILL, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU,
|
||||
SIGURG, SIGWINCH,
|
||||
}, static_proc_info, sync::Mutex, sys::{proc_call, this_thread_call}, RtTcb, Tcb
|
||||
},
|
||||
static_proc_info,
|
||||
sync::Mutex,
|
||||
sys::{proc_call, this_thread_call},
|
||||
RtTcb, Tcb,
|
||||
};
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
@@ -158,10 +165,12 @@ unsafe fn inner(stack: &mut SigStack) {
|
||||
SigactionKind::Default => {
|
||||
let sig = (stack.sig_num & 0x3f) as u8;
|
||||
|
||||
let _ = proc_call(**current_proc_fd(), &mut [], CallFlags::empty(), &[
|
||||
ProcCall::Exit as u64,
|
||||
u64::from(sig) << 8,
|
||||
]);
|
||||
let _ = proc_call(
|
||||
**current_proc_fd(),
|
||||
&mut [],
|
||||
CallFlags::empty(),
|
||||
&[ProcCall::Exit as u64, u64::from(sig) << 8],
|
||||
);
|
||||
core::intrinsics::abort()
|
||||
}
|
||||
SigactionKind::Handled { handler } => handler,
|
||||
|
||||
@@ -340,3 +340,7 @@ pub fn posix_setsid() -> Result<()> {
|
||||
this_proc_call(&mut [], CallFlags::empty(), &[ProcCall::Setsid as u64])?;
|
||||
Ok(())
|
||||
}
|
||||
pub fn posix_nanosleep(rqtp: &TimeSpec, rmtp: &mut TimeSpec) -> Result<()> {
|
||||
wrapper(false, false, || syscall::nanosleep(rqtp, rmtp))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -742,7 +742,7 @@ impl Pal for Sys {
|
||||
} else {
|
||||
redox_rmtp = unsafe { redox_timespec::from(&*rmtp) };
|
||||
}
|
||||
match syscall::nanosleep(&redox_rqtp, &mut redox_rmtp) {
|
||||
match redox_rt::sys::posix_nanosleep(&redox_rqtp, &mut redox_rmtp) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(Error { errno: EINTR }) => {
|
||||
unsafe {
|
||||
|
||||
Reference in New Issue
Block a user