System processes can be signaled; signals are transformed in SYS_EVENT message

that passes signal map along. This mechanisms is also used for nonuser signals
like SIGKMESS, SIGKSTOP, SIGKSIG.

Revised comments of many system call handlers. Renamed setpriority to nice.
This commit is contained in:
Jorrit Herder
2005-07-19 12:21:36 +00:00
parent f8c380c195
commit 198c976f7e
33 changed files with 289 additions and 395 deletions

View File

@@ -1,20 +1,9 @@
/* The system call that is implemented in this file:
* SYS_SIGCTL # signal handling functionality
* m_type: SYS_KILL
*
* The parameters and types for this system call are:
* SIG_REQUEST # request to perform (long)
* SIG_PROC # process to signal/ pending (int)
* SIG_CTXT_PTR # pointer to sigcontext structure (pointer)
* SIG_FLAGS # flags for S_SIGRETURN call (int)
* SIG_MAP # bit map with pending signals (long)
* SIG_NUMBER # signal number to send to process (int)
*
* Supported request types are in the parameter SIG_REQUEST:
* S_GETSIG # get a pending kernel signal
* S_ENDSIG # signal has been processed
* S_SENDSIG # deliver a POSIX-style signal
* S_SIGRETURN # return from a POSIX-style signal
* S_KILL # send a signal to a process
* The parameters for this system call are:
* m2_i1: SIG_PROC # process to signal/ pending
* m2_i2: SIG_NUMBER # signal number to send to process
*/
#include "../system.h"
@@ -29,11 +18,27 @@
PUBLIC int do_kill(m_ptr)
message *m_ptr; /* pointer to request message */
{
/* Handle sys_kill(). Cause a signal to be sent to a process via PM.
* Note that this has nothing to do with the kill (2) system call, this
* is how the FS (and possibly other servers) get access to cause_sig.
/* Handle sys_kill(). Cause a signal to be sent to a process. The PM is the
* central server where all signals are processed and handler policies can
* be registered. Any request, except for PM requests, is added to the map
* of pending signals and the PM is informed about the new signal.
* Since system servers cannot use normal POSIX signal handlers (because they
* are usually blocked on a RECEIVE), they can request the PM to transform
* signals into messages. This is done by the PM with a call to sys_kill().
*/
cause_sig(m_ptr->SIG_PROC, m_ptr->SIG_NUMBER);
proc_nr_t proc_nr = m_ptr->SIG_PROC;
int sig_nr = m_ptr->SIG_NUMBER;
if (! isokprocn(proc_nr) || sig_nr > _NSIG) return(EINVAL);
if (m_ptr->m_source == PM_PROC_NR) {
/* Directly send signal notification to a system process. */
if (! (priv(proc_addr(proc_nr))->s_flags & SYS_PROC)) return(EPERM);
send_sig(proc_nr, sig_nr);
} else {
/* Set pending signal to be processed by the PM. */
cause_sig(proc_nr, sig_nr);
}
return(OK);
}