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/sys/signalvar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: signalvar.h,v 1.51 2004/03/26 15:01:16 drochner Exp $  */
    2 
    3 /*
    4  * Copyright (c) 1991, 1993
    5  *      The Regents of the University of California.  All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. Neither the name of the University nor the names of its contributors
   16  *    may be used to endorse or promote products derived from this software
   17  *    without specific prior written permission.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29  * SUCH DAMAGE.
   30  *
   31  *      @(#)signalvar.h 8.6 (Berkeley) 2/19/95
   32  */
   33 
   34 #ifndef _SYS_SIGNALVAR_H_               /* tmp for user.h */
   35 #define _SYS_SIGNALVAR_H_
   36 
   37 #include <sys/siginfo.h>
   38 #include <sys/lock.h>
   39 #include <sys/queue.h>
   40 
   41 /*
   42  * Kernel signal definitions and data structures,
   43  * not exported to user programs.
   44  */
   45 
   46 /*
   47  * Process signal actions, possibly shared between threads.
   48  */
   49 struct sigacts {
   50         struct sigact_sigdesc {
   51                 struct sigaction sd_sigact;
   52                 const void *sd_tramp;
   53                 int sd_vers;
   54         } sa_sigdesc[NSIG];             /* disposition of signals */
   55 
   56         int     sa_refcnt;              /* reference count */
   57 };
   58 
   59 /*
   60  * Process signal state.
   61  */
   62 struct sigctx {
   63         /* This needs to be zeroed on fork */
   64         sigset_t ps_siglist;            /* Signals arrived but not delivered. */
   65         char    ps_sigcheck;            /* May have deliverable signals. */
   66         struct ksiginfo *ps_sigwaited;  /* Delivered signal from wait set */
   67         const sigset_t *ps_sigwait;     /* Signals being waited for */
   68         struct simplelock ps_silock;    /* Lock for ps_siginfo */
   69         CIRCLEQ_HEAD(, ksiginfo) ps_siginfo;/* for SA_SIGINFO */
   70 
   71         /* This should be copied on fork */
   72 #define ps_startcopy    ps_sigstk
   73         struct  sigaltstack ps_sigstk;  /* sp & on stack state variable */
   74         sigset_t ps_oldmask;            /* saved mask from before sigpause */
   75         int     ps_flags;               /* signal flags, below */
   76         int     ps_signo;               /* for core dump/debugger XXX */
   77         int     ps_code;                /* for core dump/debugger XXX */
   78         int     ps_lwp;                 /* for core dump/debugger XXX */
   79         void    *ps_sigcode;            /* address of signal trampoline */
   80         sigset_t ps_sigmask;            /* Current signal mask. */
   81         sigset_t ps_sigignore;          /* Signals being ignored. */
   82         sigset_t ps_sigcatch;           /* Signals being caught by user. */
   83 };
   84 
   85 /* signal flags */
   86 #define SAS_OLDMASK     0x01            /* need to restore mask before pause */
   87 
   88 /* additional signal action values, used only temporarily/internally */
   89 #define SIG_CATCH       (void (*) __P((int)))2
   90 
   91 /*
   92  * get signal action for process and signal; currently only for current process
   93  */
   94 #define SIGACTION(p, sig)       (p->p_sigacts->sa_sigdesc[(sig)].sd_sigact)
   95 #define SIGACTION_PS(ps, sig)   (ps->sa_sigdesc[(sig)].sd_sigact)
   96 
   97 /*
   98  * Mark that signals for a process need to be checked.
   99  */
  100 #define CHECKSIGS(p)                                                    \
  101 do {                                                                    \
  102         (p)->p_sigctx.ps_sigcheck = 1;                                  \
  103         signotify(p);                                                   \
  104 } while (/* CONSTCOND */ 0)
  105 
  106 /*
  107  * Determine signal that should be delivered to process p, the current
  108  * process, 0 if none.  If there is a pending stop signal with default
  109  * action, the process stops in issignal().
  110  */
  111 #define CURSIG(l)       (l->l_proc->p_sigctx.ps_sigcheck ? issignal(l) : 0)
  112 
  113 /*
  114  * Clear a pending signal from a process.
  115  */
  116 #define CLRSIG(p, sig)  sigdelset(&p->p_sigctx.ps_siglist, sig)
  117 
  118 /*
  119  * Signal properties and actions.
  120  * The array below categorizes the signals and their default actions
  121  * according to the following properties:
  122  */
  123 #define SA_KILL         0x01            /* terminates process by default */
  124 #define SA_CORE         0x02            /* ditto and coredumps */
  125 #define SA_STOP         0x04            /* suspend process */
  126 #define SA_TTYSTOP      0x08            /* ditto, from tty */
  127 #define SA_IGNORE       0x10            /* ignore by default */
  128 #define SA_CONT         0x20            /* continue if suspended */
  129 #define SA_CANTMASK     0x40            /* non-maskable, catchable */
  130 #define SA_NORESET      0x80            /* not reset when caught */
  131 
  132 #ifdef _KERNEL
  133 
  134 extern sigset_t contsigmask, stopsigmask, sigcantmask;
  135 
  136 struct vnode;
  137 struct ucred;
  138 
  139 /*
  140  * Machine-independent functions:
  141  */
  142 int     coredump __P((struct lwp *));
  143 int     coredump_netbsd __P((struct lwp *, struct vnode *, struct ucred *));
  144 void    execsigs __P((struct proc *));
  145 void    gsignal __P((int, int));
  146 void    kgsignal __P((int, struct ksiginfo *, void *));
  147 int     issignal __P((struct lwp *));
  148 void    pgsignal __P((struct pgrp *, int, int));
  149 void    kpgsignal __P((struct pgrp *, struct ksiginfo *, void *, int));
  150 void    postsig __P((int));
  151 void    psignal1 __P((struct proc *, int, int));
  152 void    kpsignal1 __P((struct proc *, struct ksiginfo *, void *, int));
  153 #define kpsignal(p, ksi, data)          kpsignal1((p), (ksi), (data), 1)
  154 #define psignal(p, sig)                 psignal1((p), (sig), 1)
  155 #define sched_psignal(p, sig)           psignal1((p), (sig), 0)
  156 void    siginit __P((struct proc *));
  157 void    trapsignal __P((struct lwp *, const struct ksiginfo *));
  158 void    sigexit __P((struct lwp *, int));
  159 void    killproc __P((struct proc *, const char *));
  160 void    setsigvec __P((struct proc *, int, struct sigaction *));
  161 int     killpg1 __P((struct proc *, struct ksiginfo *, int, int));
  162 struct lwp *proc_unstop __P((struct proc *p));
  163 
  164 int     sigaction1 __P((struct proc *, int, const struct sigaction *,
  165             struct sigaction *, const void *, int));
  166 int     sigprocmask1 __P((struct proc *, int, const sigset_t *, sigset_t *));
  167 void    sigpending1 __P((struct proc *, sigset_t *));
  168 int     sigsuspend1 __P((struct proc *, const sigset_t *));
  169 int     sigaltstack1 __P((struct proc *, const struct sigaltstack *,
  170             struct sigaltstack *));
  171 int     sigismasked __P((struct proc *, int));
  172 
  173 void    signal_init __P((void));
  174 
  175 void    sigactsinit __P((struct proc *, struct proc *, int));
  176 void    sigactsunshare __P((struct proc *));
  177 void    sigactsfree __P((struct proc *));
  178 
  179 void    kpsendsig __P((struct lwp *, const struct ksiginfo *,
  180     const sigset_t *));
  181 
  182 /*
  183  * Machine-dependent functions:
  184  */
  185 void    sendsig __P((const struct ksiginfo *, const sigset_t *));
  186 struct core;
  187 struct core32;
  188 int     cpu_coredump __P((struct lwp *, struct vnode *, struct ucred *,
  189             struct core *));
  190 int     cpu_coredump32 __P((struct lwp *, struct vnode *, struct ucred *,
  191             struct core32 *));
  192 
  193 /*
  194  * Compatibility functions.  See compat/common/kern_sig_13.c.
  195  */
  196 void    native_sigset13_to_sigset __P((const sigset13_t *, sigset_t *));
  197 void    native_sigset_to_sigset13 __P((const sigset_t *, sigset13_t *));
  198 void    native_sigaction13_to_sigaction __P((const struct sigaction13 *,
  199             struct sigaction *));
  200 void    native_sigaction_to_sigaction13 __P((const struct sigaction *,
  201             struct sigaction13 *));
  202 void    native_sigaltstack13_to_sigaltstack __P((const struct sigaltstack13 *,
  203             struct sigaltstack *));
  204 void    native_sigaltstack_to_sigaltstack13 __P((const struct sigaltstack *,
  205             struct sigaltstack13 *));
  206 #endif  /* _KERNEL */
  207 #endif  /* !_SYS_SIGNALVAR_H_ */
  208 
  209 #ifdef  _KERNEL
  210 #ifdef  SIGPROP
  211 const int sigprop[NSIG] = {
  212         0,                              /* 0 unused */
  213         SA_KILL,                        /* 1 SIGHUP */
  214         SA_KILL,                        /* 2 SIGINT */
  215         SA_KILL|SA_CORE,                /* 3 SIGQUIT */
  216         SA_KILL|SA_CORE|SA_NORESET,     /* 4 SIGILL */
  217         SA_KILL|SA_CORE|SA_NORESET,     /* 5 SIGTRAP */
  218         SA_KILL|SA_CORE,                /* 6 SIGABRT */
  219         SA_KILL|SA_CORE,                /* 7 SIGEMT */
  220         SA_KILL|SA_CORE,                /* 8 SIGFPE */
  221         SA_KILL|SA_CANTMASK,            /* 9 SIGKILL */
  222         SA_KILL|SA_CORE,                /* 10 SIGBUS */
  223         SA_KILL|SA_CORE,                /* 11 SIGSEGV */
  224         SA_KILL|SA_CORE,                /* 12 SIGSYS */
  225         SA_KILL,                        /* 13 SIGPIPE */
  226         SA_KILL,                        /* 14 SIGALRM */
  227         SA_KILL,                        /* 15 SIGTERM */
  228         SA_IGNORE,                      /* 16 SIGURG */
  229         SA_STOP|SA_CANTMASK,            /* 17 SIGSTOP */
  230         SA_STOP|SA_TTYSTOP,             /* 18 SIGTSTP */
  231         SA_IGNORE|SA_CONT,              /* 19 SIGCONT */
  232         SA_IGNORE,                      /* 20 SIGCHLD */
  233         SA_STOP|SA_TTYSTOP,             /* 21 SIGTTIN */
  234         SA_STOP|SA_TTYSTOP,             /* 22 SIGTTOU */
  235         SA_IGNORE,                      /* 23 SIGIO */
  236         SA_KILL,                        /* 24 SIGXCPU */
  237         SA_KILL,                        /* 25 SIGXFSZ */
  238         SA_KILL,                        /* 26 SIGVTALRM */
  239         SA_KILL,                        /* 27 SIGPROF */
  240         SA_IGNORE,                      /* 28 SIGWINCH  */
  241         SA_IGNORE,                      /* 29 SIGINFO */
  242         SA_KILL,                        /* 30 SIGUSR1 */
  243         SA_KILL,                        /* 31 SIGUSR2 */
  244         SA_IGNORE|SA_NORESET,           /* 32 SIGPWR */
  245         SA_KILL,                        /* 33 SIGRTMIN + 0 */
  246         SA_KILL,                        /* 34 SIGRTMIN + 1 */
  247         SA_KILL,                        /* 35 SIGRTMIN + 2 */
  248         SA_KILL,                        /* 36 SIGRTMIN + 3 */
  249         SA_KILL,                        /* 37 SIGRTMIN + 4 */
  250         SA_KILL,                        /* 38 SIGRTMIN + 5 */
  251         SA_KILL,                        /* 39 SIGRTMIN + 6 */
  252         SA_KILL,                        /* 40 SIGRTMIN + 7 */
  253         SA_KILL,                        /* 41 SIGRTMIN + 8 */
  254         SA_KILL,                        /* 42 SIGRTMIN + 9 */
  255         SA_KILL,                        /* 43 SIGRTMIN + 10 */
  256         SA_KILL,                        /* 44 SIGRTMIN + 11 */
  257         SA_KILL,                        /* 45 SIGRTMIN + 12 */
  258         SA_KILL,                        /* 46 SIGRTMIN + 13 */
  259         SA_KILL,                        /* 47 SIGRTMIN + 14 */
  260         SA_KILL,                        /* 48 SIGRTMIN + 15 */
  261         SA_KILL,                        /* 49 SIGRTMIN + 16 */
  262         SA_KILL,                        /* 50 SIGRTMIN + 17 */
  263         SA_KILL,                        /* 51 SIGRTMIN + 18 */
  264         SA_KILL,                        /* 52 SIGRTMIN + 19 */
  265         SA_KILL,                        /* 53 SIGRTMIN + 20 */
  266         SA_KILL,                        /* 54 SIGRTMIN + 21 */
  267         SA_KILL,                        /* 55 SIGRTMIN + 22 */
  268         SA_KILL,                        /* 56 SIGRTMIN + 23 */
  269         SA_KILL,                        /* 57 SIGRTMIN + 24 */
  270         SA_KILL,                        /* 58 SIGRTMIN + 25 */
  271         SA_KILL,                        /* 59 SIGRTMIN + 26 */
  272         SA_KILL,                        /* 60 SIGRTMIN + 27 */
  273         SA_KILL,                        /* 61 SIGRTMIN + 28 */
  274         SA_KILL,                        /* 62 SIGRTMIN + 29 */
  275         SA_KILL,                        /* 63 SIGRTMIN + 30 */
  276 };
  277 #undef  SIGPROP
  278 #else
  279 extern const int sigprop[NSIG];
  280 #endif  /* SIGPROP */
  281 #endif  /* _KERNEL */

Cache object: c9a7b75dbb32612f486dc2f95daf0884


[ 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.