Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / kernel / system / do_kill.c
blobb3e22f7357f399c755669114d309c9a0a8c75f33
1 /* The kernel call that is implemented in this file:
2 * m_type: SYS_KILL
4 * The parameters for this kernel call are:
5 * m_sigcalls.endpt # process to signal/ pending
6 * m_sigcalls.sig # 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->m_sigcalls.sig;
28 proc_nr_e = (proc_nr_t)m_ptr->m_sigcalls.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 */