1 /* The kernel call that is implemented in this file:
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
9 #include "kernel/system.h"
11 #include <minix/endpoint.h>
15 /*===========================================================================*
17 *===========================================================================*/
18 int do_getksig(struct proc
* caller
, message
* m_ptr
)
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.
24 register struct proc
*rp
;
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 */
39 /* No process with pending signals was found. */
40 m_ptr
->m_sigcalls
.endpt
= NONE
;
43 #endif /* USE_GETKSIG */