__aeabi_ldivmod: fix sign logic
[minix.git] / kernel / system / do_kill.c
blobdc370dc67f28a90be93adf6f2e5aa70d1e70a3a4
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 "kernel/system.h"
10 #include <signal.h>
12 #if USE_KILL
14 /*===========================================================================*
15 * do_kill *
16 *===========================================================================*/
17 int do_kill(struct proc * caller, message * m_ptr)
19 /* Handle sys_kill(). Cause a signal to be sent to a process. Any request
20 * is added to the map of pending signals and the signal manager
21 * associated to the process is informed about the new signal. The signal
22 * is then delivered using POSIX signal handlers for user processes, or
23 * translated into an IPC message for system services.
25 proc_nr_t proc_nr, proc_nr_e;
26 int sig_nr = m_ptr->SIG_NUMBER;
28 proc_nr_e= (proc_nr_t) m_ptr->SIG_ENDPT;
30 if (!isokendpt(proc_nr_e, &proc_nr)) return(EINVAL);
31 if (sig_nr >= _NSIG) return(EINVAL);
32 if (iskerneln(proc_nr)) return(EPERM);
34 /* Set pending signal to be processed by the signal manager. */
35 cause_sig(proc_nr, sig_nr);
37 return(OK);
40 #endif /* USE_KILL */