1 /* The kernel call that is implemented in this file:
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
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
->SIG_ENDPT
= rp
->p_endpoint
;
32 m_ptr
->SIG_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
->SIG_ENDPT
= NONE
;
43 #endif /* USE_GETKSIG */