Added lance entry to drivers.conf.
[minix3-old.git] / kernel / system / do_kill.c
blobf5d1d8685d865876c11f6b7bc089d13b1b00f511
1 /* The kernel call that is implemented in this file:
2 * m_type: SYS_KILL
4 * The parameters for this kernel call are:
5 * m2_i1: SIG_ENDPT # process to signal/ pending
6 * m2_i2: SIG_NUMBER # signal number to send to process
7 */
9 #include "../system.h"
10 #include <signal.h>
11 #include <sys/sigcontext.h>
13 #if USE_KILL
15 /*===========================================================================*
16 * do_kill *
17 *===========================================================================*/
18 PUBLIC int do_kill(m_ptr)
19 message *m_ptr; /* pointer to request message */
21 /* Handle sys_kill(). Cause a signal to be sent to a process. The PM is the
22 * central server where all signals are processed and handler policies can
23 * be registered. Any request, except for PM requests, is added to the map
24 * of pending signals and the PM is informed about the new signal.
25 * Since system servers cannot use normal POSIX signal handlers (because they
26 * are usually blocked on a RECEIVE), they can request the PM to transform
27 * signals into messages. This is done by the PM with a call to sys_kill().
29 proc_nr_t proc_nr, proc_nr_e;
30 int sig_nr = m_ptr->SIG_NUMBER;
32 proc_nr_e= m_ptr->SIG_ENDPT;
34 if (!isokendpt(proc_nr_e, &proc_nr)) return(EINVAL);
35 if (sig_nr > _NSIG) return(EINVAL);
36 if (iskerneln(proc_nr)) return(EPERM);
38 /* Set pending signal to be processed by the PM. */
39 cause_sig(proc_nr, sig_nr);
40 if (sig_nr == SIGKILL)
41 clear_endpoint(proc_addr(proc_nr));
42 return(OK);
45 #endif /* USE_KILL */