Fix signal handlers after EINTR nanosleep.

This commit is contained in:
4lDO2
2025-04-17 01:04:34 +02:00
parent c25b4c67e1
commit 5dfc76dda8
3 changed files with 20 additions and 7 deletions
+15 -6
View File
@@ -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,
+4
View File
@@ -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(())
}
+1 -1
View File
@@ -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 {