source: trunk/minix/kernel/system/do_endksig.c@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.3 KB
Line 
1/* The kernel call that is implemented in this file:
2 * m_type: SYS_ENDKSIG
3 *
4 * The parameters for this kernel call are:
5 * m2_i1: SIG_ENDPT # process for which PM is done
6 */
7
8#include "../system.h"
9#include <signal.h>
10#include <sys/sigcontext.h>
11
12#if USE_ENDKSIG
13
14/*===========================================================================*
15 * do_endksig *
16 *===========================================================================*/
17PUBLIC int do_endksig(m_ptr)
18message *m_ptr; /* pointer to request message */
19{
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.
23 */
24 register struct proc *rp;
25 int proc;
26
27 /* Get process pointer and verify that it had signals pending. If the
28 * process is already dead its flags will be reset.
29 */
30 if(!isokendpt(m_ptr->SIG_ENDPT, &proc))
31 return EINVAL;
32
33 rp = proc_addr(proc);
34 if (! (rp->p_rts_flags & SIG_PENDING)) return(EINVAL);
35
36 /* PM has finished one kernel signal. Perhaps process is ready now? */
37 if (! (rp->p_rts_flags & SIGNALED)) /* new signal arrived */
38 if ((rp->p_rts_flags &= ~SIG_PENDING)==0) /* remove pending flag */
39 lock_enqueue(rp); /* ready if no flags */
40 return(OK);
41}
42
43#endif /* USE_ENDKSIG */
44
Note: See TracBrowser for help on using the repository browser.