diff --git a/include/bits/sys/wait.h b/include/bits/sys/wait.h index 7af6a82bbe..c76dbcab95 100644 --- a/include/bits/sys/wait.h +++ b/include/bits/sys/wait.h @@ -2,7 +2,7 @@ #define _BITS_SYS_WAIT_H #define WEXITSTATUS(s) (((s) >> 8) & 0xff) -#define WTERMSIG(s) (((s) & 0x7f) != 0) +#define WTERMSIG(s) ((s) & 0x7f) #define WSTOPSIG(s) WEXITSTATUS(s) #define WCOREDUMP(s) (((s) & 0x80) != 0) #define WIFEXITED(s) (((s) & 0x7f) == 0) diff --git a/redox-rt/src/signal.rs b/redox-rt/src/signal.rs index 2518b5b61e..14a39c316f 100644 --- a/redox-rt/src/signal.rs +++ b/redox-rt/src/signal.rs @@ -6,16 +6,10 @@ use syscall::{ }; use crate::{ - arch::*, - 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")] @@ -162,9 +156,13 @@ unsafe fn inner(stack: &mut SigStack) { panic!("ctl {:x?} signal {}", os.control, stack.sig_num) } SigactionKind::Default => { - //syscall::exit(stack.sig_num as usize); - todo!("exit"); - unreachable!(); + 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, + ]); + core::intrinsics::abort() } SigactionKind::Handled { handler } => handler, }; @@ -508,8 +506,7 @@ bitflags::bitflags! { const STORED_FLAGS: u32 = 0xfe00_0000; fn default_handler(sig: c_int) { - //syscall::exit(sig as usize); - todo!("exit") + unreachable!(); } #[derive(Clone, Copy)] diff --git a/tests/Makefile b/tests/Makefile index 60ffd85624..38412a55ce 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -127,6 +127,7 @@ EXPECT_NAMES=\ unistd/rmdir \ waitpid \ waitpid_multiple \ + kill-waitpid \ # unistd/sleep \ unistd/swab \ unistd/write \