The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/kernel/system/do_kill.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /* The kernel call that is implemented in this file:
    2  *   m_type:    SYS_KILL
    3  *
    4  * The parameters for this kernel call are:
    5  *     m2_i1:   SIG_PROC        # process to signal/ pending            
    6  *     m2_i2:   SIG_NUMBER      # signal number to send to process
    7  */
    8 
    9 #include "../system.h"
   10 #include <signal.h>
   11 #include <sys/sigcontext.h>
   12 
   13 #if USE_KILL
   14 
   15 /*===========================================================================*
   16  *                                do_kill                                    *
   17  *===========================================================================*/
   18 PUBLIC int do_kill(m_ptr)
   19 message *m_ptr;                 /* pointer to request message */
   20 {
   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(). 
   28  */
   29   proc_nr_t proc_nr = m_ptr->SIG_PROC;
   30   int sig_nr = m_ptr->SIG_NUMBER;
   31 
   32   if (! isokprocn(proc_nr) || sig_nr > _NSIG) return(EINVAL);
   33   if (iskerneln(proc_nr)) return(EPERM);
   34 
   35   if (m_ptr->m_source == PM_PROC_NR) {
   36       /* Directly send signal notification to a system process. */
   37       if (! (priv(proc_addr(proc_nr))->s_flags & SYS_PROC)) return(EPERM);
   38       send_sig(proc_nr, sig_nr);
   39   } else {
   40       /* Set pending signal to be processed by the PM. */
   41       cause_sig(proc_nr, sig_nr);
   42   }
   43   return(OK);
   44 }
   45 
   46 #endif /* USE_KILL */
   47 

Cache object: 40af6b6d108526ebe9835ca9245c3920


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.