source: trunk/minix/kernel/system/do_getksig.c@ 9

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

Minix 3.1.2a

File size: 1.5 KB
Line 
1/* The kernel call that is implemented in this file:
2 * m_type: SYS_GETKSIG
3 *
4 * The parameters for this kernel call are:
5 * m2_i1: SIG_ENDPT # process with pending signals
6 * m2_l1: SIG_MAP # bit map with pending signals
7 */
8
9#include "../system.h"
10#include <signal.h>
11#include <sys/sigcontext.h>
12#include <minix/endpoint.h>
13
14#if USE_GETKSIG
15
16/*===========================================================================*
17 * do_getksig *
18 *===========================================================================*/
19PUBLIC int do_getksig(m_ptr)
20message *m_ptr; /* pointer to request message */
21{
22/* PM is ready to accept signals and repeatedly does a kernel call to get
23 * one. Find a process with pending signals. If no signals are available,
24 * return NONE in the process number field.
25 * It is not sufficient to ready the process when PM is informed, because
26 * PM can block waiting for FS to do a core dump.
27 */
28 register struct proc *rp;
29
30 /* Find the next process with pending signals. */
31 for (rp = BEG_USER_ADDR; rp < END_PROC_ADDR; rp++) {
32 if (rp->p_rts_flags & SIGNALED) {
33 /* store signaled process' endpoint */
34 m_ptr->SIG_ENDPT = rp->p_endpoint;
35 m_ptr->SIG_MAP = rp->p_pending; /* pending signals map */
36 sigemptyset(&rp->p_pending); /* ball is in PM's court */
37 rp->p_rts_flags &= ~SIGNALED; /* blocked by SIG_PENDING */
38 return(OK);
39 }
40 }
41
42 /* No process with pending signals was found. */
43 m_ptr->SIG_ENDPT = NONE;
44 return(OK);
45}
46#endif /* USE_GETKSIG */
47
Note: See TracBrowser for help on using the repository browser.