From 3fef626dfcdc3203b2467987771d822f97851c73 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 26 Dec 2015 23:14:48 +0000 Subject: [PATCH] process: first cut at SIGCONT/SIGSTOP handling done properly --- Kernel/process.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Kernel/process.c b/Kernel/process.c index e887ee15..989a3c1f 100644 --- a/Kernel/process.c +++ b/Kernel/process.c @@ -490,12 +490,23 @@ void ssig(ptptr proc, uint16_t sig) sigm = sigmask(sig); irq = di(); - /* FIXME: - SIGCONT needs to wake even if ignored. - SIGSTOP needs to actually stop the task once it hits - the syscall exit path */ + if (proc->p_status != P_EMPTY) { /* Presumably was killed just now */ - if (sig == SIGCONT || !(proc->p_ignored & sigm)) { + /* SIGSTOP can't be ignored and puts the process into P_STOPPED */ + /* FIXME: Level 2 will need a lot more handling here, both SIGTSTP + handling and the wait() handling for stopping */ + if (sig == SIGSTOP) { + if (proc->p_status == P_RUNNING || + proc->p_status == P_READY) + nready--; + proc->p_status = P_STOPPED; + /* SIGCONT likewise has an unblockable effect */ + } else if (sig == SIGCONT && proc->p_status == P_STOPPED) { + proc->p_status = P_READY; + nready++; + } + /* Routine signal behaviour */ + else if (!(proc->p_ignored & sigm)) { /* Don't wake for held signals */ if (!(proc->p_held & sigm)) { switch (proc->p_status) { -- 2.34.1