2005-07-14 17:12:12 +02:00
|
|
|
/* The system call that is implemented in this file:
|
2005-07-19 14:21:36 +02:00
|
|
|
* m_type: SYS_GETKSIG
|
2005-07-14 17:12:12 +02:00
|
|
|
*
|
2005-07-19 14:21:36 +02:00
|
|
|
* The parameters for this system call are:
|
|
|
|
* m2_i1: SIG_PROC # process with pending signals
|
|
|
|
* m2_l1: SIG_MAP # bit map with pending signals
|
2005-07-14 17:12:12 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "../system.h"
|
|
|
|
#include <signal.h>
|
|
|
|
#include <sys/sigcontext.h>
|
|
|
|
|
|
|
|
#if USE_GETKSIG
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* do_getksig *
|
|
|
|
*===========================================================================*/
|
|
|
|
PUBLIC int do_getksig(m_ptr)
|
|
|
|
message *m_ptr; /* pointer to request message */
|
|
|
|
{
|
|
|
|
/* PM is ready to accept signals and repeatedly does a system call to get
|
|
|
|
* one. Find a process with pending signals. If no signals are available,
|
|
|
|
* return NONE in the process number field.
|
2005-07-19 14:21:36 +02:00
|
|
|
* It is not sufficient to ready the process when PM is informed, because
|
|
|
|
* PM can block waiting for FS to do a core dump.
|
2005-07-14 17:12:12 +02:00
|
|
|
*/
|
|
|
|
register struct proc *rp;
|
|
|
|
|
|
|
|
/* Find the next process with pending signals. */
|
|
|
|
for (rp = BEG_USER_ADDR; rp < END_PROC_ADDR; rp++) {
|
|
|
|
if (rp->p_rts_flags & SIGNALED) {
|
2005-07-19 14:21:36 +02:00
|
|
|
m_ptr->SIG_PROC = rp->p_nr; /* store signaled process */
|
|
|
|
m_ptr->SIG_MAP = rp->p_pending; /* pending signals map */
|
|
|
|
sigemptyset(&rp->p_pending); /* ball is in PM's court */
|
|
|
|
rp->p_rts_flags &= ~SIGNALED; /* blocked by SIG_PENDING */
|
2005-07-14 17:12:12 +02:00
|
|
|
return(OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No process with pending signals was found. */
|
|
|
|
m_ptr->SIG_PROC = NONE;
|
|
|
|
return(OK);
|
|
|
|
}
|
|
|
|
#endif /* USE_GETKSIG */
|
|
|
|
|
|
|
|
|