This commit was manufactured by cvs2svn to create tag 'r3_1_0'.
[minix.git] / kernel / system / do_endksig.c
blob7e8038649329157131b902f138485405c877bd5f
1 /* The kernel call that is implemented in this file:
2 * m_type: SYS_ENDKSIG
4 * The parameters for this kernel call are:
5 * m2_i1: SIG_PROC # process for which PM is done
6 */
8 #include "../system.h"
9 #include <signal.h>
10 #include <sys/sigcontext.h>
12 #if USE_ENDKSIG
14 /*===========================================================================*
15 * do_endksig *
16 *===========================================================================*/
17 PUBLIC int do_endksig(m_ptr)
18 message *m_ptr; /* pointer to request message */
20 /* Finish up after a kernel type signal, caused by a SYS_KILL message or a
21 * call to cause_sig by a task. This is called by the PM after processing a
22 * signal it got with SYS_GETKSIG.
24 register struct proc *rp;
26 /* Get process pointer and verify that it had signals pending. If the
27 * process is already dead its flags will be reset.
29 rp = proc_addr(m_ptr->SIG_PROC);
30 if (! (rp->p_rts_flags & SIG_PENDING)) return(EINVAL);
32 /* PM has finished one kernel signal. Perhaps process is ready now? */
33 if (! (rp->p_rts_flags & SIGNALED)) /* new signal arrived */
34 if ((rp->p_rts_flags &= ~SIG_PENDING)==0) /* remove pending flag */
35 lock_enqueue(rp); /* ready if no flags */
36 return(OK);
39 #endif /* USE_ENDKSIG */