[BACK]Return to signalvar.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / sys

Annotation of src/sys/sys/signalvar.h, Revision 1.30.2.3

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

CVSweb <webmaster@jp.NetBSD.org>