ramdisk Makefile: CLEANFILES fix
[minix.git] / kernel / system / do_endksig.c
blobde1a3505f00c86bc2c4f9dccc4e964b9a3f0a0cd
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_ENDPT # process for which PM is done
6 */
8 #include "kernel/system.h"
10 #if USE_ENDKSIG
12 /*===========================================================================*
13 * do_endksig *
14 *===========================================================================*/
15 int do_endksig(struct proc * caller, message * m_ptr)
17 /* Finish up after a kernel type signal, caused by a SYS_KILL message or a
18 * call to cause_sig by a task. This is called by a signal manager after
19 * processing a signal it got with SYS_GETKSIG.
21 register struct proc *rp;
22 int proc_nr;
24 /* Get process pointer and verify that it had signals pending. If the
25 * process is already dead its flags will be reset.
27 if(!isokendpt(m_ptr->SIG_ENDPT, &proc_nr))
28 return EINVAL;
30 rp = proc_addr(proc_nr);
31 if (caller->p_endpoint != priv(rp)->s_sig_mgr) return(EPERM);
32 if (!RTS_ISSET(rp, RTS_SIG_PENDING)) return(EINVAL);
34 /* The signal manager has finished one kernel signal. Is the process ready? */
35 if (!RTS_ISSET(rp, RTS_SIGNALED)) /* new signal arrived */
36 RTS_UNSET(rp, RTS_SIG_PENDING); /* remove pending flag */
37 return(OK);
40 #endif /* USE_ENDKSIG */