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 * m_sigcalls.endpt # process with pending signals 6 * m_sigcalls.map # bit map with pending signals 7 */ 8 9 #include "kernel/system.h" 10 #include <signal.h> 11 #include <minix/endpoint.h> 12 13 #if USE_GETKSIG 14 15 /*===========================================================================* 16 * do_getksig * 17 *===========================================================================*/ do_getksig(struct proc * caller,message * m_ptr)18int do_getksig(struct proc * caller, message * m_ptr) 19 { 20 /* The signal manager is ready to accept signals and repeatedly does a kernel 21 * call to get one. Find a process with pending signals. If no signals are 22 * available, return NONE in the process number field. 23 */ 24 register struct proc *rp; 25 26 /* Find the next process with pending signals. */ 27 for (rp = BEG_USER_ADDR; rp < END_PROC_ADDR; rp++) { 28 if (RTS_ISSET(rp, RTS_SIGNALED)) { 29 if (caller->p_endpoint != priv(rp)->s_sig_mgr) continue; 30 /* store signaled process' endpoint */ 31 m_ptr->m_sigcalls.endpt = rp->p_endpoint; 32 m_ptr->m_sigcalls.map = rp->p_pending; /* pending signals map */ 33 (void) sigemptyset(&rp->p_pending); /* clear map in the kernel */ 34 RTS_UNSET(rp, RTS_SIGNALED); /* blocked by SIG_PENDING */ 35 return(OK); 36 } 37 } 38 39 /* No process with pending signals was found. */ 40 m_ptr->m_sigcalls.endpt = NONE; 41 return(OK); 42 } 43 #endif /* USE_GETKSIG */ 44