1*433d6423SLionel Sambuc /* The kernel call that is implemented in this file: 2*433d6423SLionel Sambuc * m_type: SYS_ENDKSIG 3*433d6423SLionel Sambuc * 4*433d6423SLionel Sambuc * The parameters for this kernel call are: 5*433d6423SLionel Sambuc * m_sigcalls.endpt # process for which PM is done 6*433d6423SLionel Sambuc */ 7*433d6423SLionel Sambuc 8*433d6423SLionel Sambuc #include "kernel/system.h" 9*433d6423SLionel Sambuc 10*433d6423SLionel Sambuc #if USE_ENDKSIG 11*433d6423SLionel Sambuc 12*433d6423SLionel Sambuc /*===========================================================================* 13*433d6423SLionel Sambuc * do_endksig * 14*433d6423SLionel Sambuc *===========================================================================*/ do_endksig(struct proc * caller,message * m_ptr)15*433d6423SLionel Sambucint do_endksig(struct proc * caller, message * m_ptr) 16*433d6423SLionel Sambuc { 17*433d6423SLionel Sambuc /* Finish up after a kernel type signal, caused by a SYS_KILL message or a 18*433d6423SLionel Sambuc * call to cause_sig by a task. This is called by a signal manager after 19*433d6423SLionel Sambuc * processing a signal it got with SYS_GETKSIG. 20*433d6423SLionel Sambuc */ 21*433d6423SLionel Sambuc register struct proc *rp; 22*433d6423SLionel Sambuc int proc_nr; 23*433d6423SLionel Sambuc 24*433d6423SLionel Sambuc /* Get process pointer and verify that it had signals pending. If the 25*433d6423SLionel Sambuc * process is already dead its flags will be reset. 26*433d6423SLionel Sambuc */ 27*433d6423SLionel Sambuc if(!isokendpt(m_ptr->m_sigcalls.endpt, &proc_nr)) 28*433d6423SLionel Sambuc return EINVAL; 29*433d6423SLionel Sambuc 30*433d6423SLionel Sambuc rp = proc_addr(proc_nr); 31*433d6423SLionel Sambuc if (caller->p_endpoint != priv(rp)->s_sig_mgr) return(EPERM); 32*433d6423SLionel Sambuc if (!RTS_ISSET(rp, RTS_SIG_PENDING)) return(EINVAL); 33*433d6423SLionel Sambuc 34*433d6423SLionel Sambuc /* The signal manager has finished one kernel signal. Is the process ready? */ 35*433d6423SLionel Sambuc if (!RTS_ISSET(rp, RTS_SIGNALED)) /* new signal arrived */ 36*433d6423SLionel Sambuc RTS_UNSET(rp, RTS_SIG_PENDING); /* remove pending flag */ 37*433d6423SLionel Sambuc return(OK); 38*433d6423SLionel Sambuc } 39*433d6423SLionel Sambuc 40*433d6423SLionel Sambuc #endif /* USE_ENDKSIG */ 41*433d6423SLionel Sambuc 42