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/signal.h

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 /*
    2  * Copyright (c) 1982, 1986, 1989, 1991, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  * (c) UNIX System Laboratories, Inc.
    5  * All or some portions of this file are derived from material licensed
    6  * to the University of California by American Telephone and Telegraph
    7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
    8  * the permission of UNIX System Laboratories, Inc.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *      This product includes software developed by the University of
   21  *      California, Berkeley and its contributors.
   22  * 4. Neither the name of the University nor the names of its contributors
   23  *    may be used to endorse or promote products derived from this software
   24  *    without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   36  * SUCH DAMAGE.
   37  *
   38  *      @(#)signal.h    8.4 (Berkeley) 5/4/95
   39  * $FreeBSD: stable/4/sys/sys/signal.h 75688 2001-04-19 01:38:35Z alfred $
   40  */
   41 
   42 #ifndef _SYS_SIGNAL_H_
   43 #define _SYS_SIGNAL_H_
   44 
   45 #include <sys/cdefs.h>
   46 #include <sys/_posix.h>
   47 
   48 /*
   49  * sigset_t macros.
   50  */
   51 #define _SIG_WORDS      4
   52 #define _SIG_MAXSIG     128
   53 #define _SIG_IDX(sig)   ((sig) - 1)
   54 #define _SIG_WORD(sig)  (_SIG_IDX(sig) >> 5)
   55 #define _SIG_BIT(sig)   (1 << (_SIG_IDX(sig) & 31))
   56 #define _SIG_VALID(sig) ((sig) < _SIG_MAXSIG && (sig) > 0)
   57 
   58 /*
   59  * System defined signals.
   60  */
   61 #define SIGHUP          1       /* hangup */
   62 #define SIGINT          2       /* interrupt */
   63 #define SIGQUIT         3       /* quit */
   64 #define SIGILL          4       /* illegal instr. (not reset when caught) */
   65 #ifndef _POSIX_SOURCE
   66 #define SIGTRAP         5       /* trace trap (not reset when caught) */
   67 #endif
   68 #define SIGABRT         6       /* abort() */
   69 #ifndef _POSIX_SOURCE
   70 #define SIGIOT          SIGABRT /* compatibility */
   71 #define SIGEMT          7       /* EMT instruction */
   72 #endif
   73 #define SIGFPE          8       /* floating point exception */
   74 #define SIGKILL         9       /* kill (cannot be caught or ignored) */
   75 #ifndef _POSIX_SOURCE
   76 #define SIGBUS          10      /* bus error */
   77 #endif
   78 #define SIGSEGV         11      /* segmentation violation */
   79 #ifndef _POSIX_SOURCE
   80 #define SIGSYS          12      /* non-existent system call invoked */
   81 #endif
   82 #define SIGPIPE         13      /* write on a pipe with no one to read it */
   83 #define SIGALRM         14      /* alarm clock */
   84 #define SIGTERM         15      /* software termination signal from kill */
   85 #ifndef _POSIX_SOURCE
   86 #define SIGURG          16      /* urgent condition on IO channel */
   87 #endif
   88 #define SIGSTOP         17      /* sendable stop signal not from tty */
   89 #define SIGTSTP         18      /* stop signal from tty */
   90 #define SIGCONT         19      /* continue a stopped process */
   91 #define SIGCHLD         20      /* to parent on child stop or exit */
   92 #define SIGTTIN         21      /* to readers pgrp upon background tty read */
   93 #define SIGTTOU         22      /* like TTIN if (tp->t_local&LTOSTOP) */
   94 #ifndef _POSIX_SOURCE
   95 #define SIGIO           23      /* input/output possible signal */
   96 #define SIGXCPU         24      /* exceeded CPU time limit */
   97 #define SIGXFSZ         25      /* exceeded file size limit */
   98 #define SIGVTALRM       26      /* virtual time alarm */
   99 #define SIGPROF         27      /* profiling time alarm */
  100 #define SIGWINCH        28      /* window size changes */
  101 #define SIGINFO         29      /* information request */
  102 #endif
  103 #define SIGUSR1         30      /* user defined signal 1 */
  104 #define SIGUSR2         31      /* user defined signal 2 */
  105 
  106 /*-
  107  * Type of a signal handling function.
  108  *
  109  * Language spec sez signal handlers take exactly one arg, even though we
  110  * actually supply three.  Ugh!
  111  *
  112  * We don't try to hide the difference by leaving out the args because
  113  * that would cause warnings about conformant programs.  Nonconformant
  114  * programs can avoid the warnings by casting to (__sighandler_t *) or
  115  * sig_t before calling signal() or assigning to sa_handler or sv_handler.
  116  *
  117  * The kernel should reverse the cast before calling the function.  It
  118  * has no way to do this, but on most machines 1-arg and 3-arg functions
  119  * have the same calling protocol so there is no problem in practice.
  120  * A bit in sa_flags could be used to specify the number of args.
  121  */
  122 typedef void __sighandler_t __P((int));
  123 
  124 #define SIG_DFL         ((__sighandler_t *)0)
  125 #define SIG_IGN         ((__sighandler_t *)1)
  126 #define SIG_ERR         ((__sighandler_t *)-1)
  127 
  128 #if defined(_P1003_1B_VISIBLE) || defined(_KERNEL)
  129 union sigval {
  130         /* Members as suggested by Annex C of POSIX 1003.1b. */
  131         int     sigval_int;
  132         void    *sigval_ptr;
  133 };
  134 
  135 struct sigevent {
  136         int     sigev_notify;           /* Notification type */
  137         union {
  138                 int     __sigev_signo;  /* Signal number */
  139                 int     __sigev_notify_kqueue;
  140         } __sigev_u;
  141         union sigval sigev_value;       /* Signal value */
  142 };
  143 #define sigev_signo             __sigev_u.__sigev_signo
  144 #define sigev_notify_kqueue     __sigev_u.__sigev_notify_kqueue
  145 
  146 #define SIGEV_NONE      0               /* No async notification */
  147 #define SIGEV_SIGNAL    1               /* Generate a queued signal */
  148 #define SIGEV_KEVENT    3               /* Generate a kevent */
  149 
  150 typedef struct __siginfo {
  151         int     si_signo;               /* signal number */
  152         int     si_errno;               /* errno association */
  153         /*
  154          * Cause of signal, one of the SI_ macros or signal-specific
  155          * values, i.e. one of the FPE_... values for SIGFPE. This
  156          * value is equivalent to the second argument to an old-style
  157          * FreeBSD signal handler.
  158          */
  159         int     si_code;                /* signal code */
  160         int     si_pid;                 /* sending process */
  161         unsigned int si_uid;            /* sender's ruid */
  162         int     si_status;              /* exit value */
  163         void    *si_addr;               /* faulting instruction */
  164         union sigval si_value;          /* signal value */
  165         long    si_band;                /* band event for SIGPOLL */
  166         int     __spare__[7];           /* gimme some slack */
  167 } siginfo_t;
  168 #endif /* _P1003_1B_VISIBLE */
  169 
  170 typedef struct __sigset {
  171         unsigned int    __bits[_SIG_WORDS];
  172 } sigset_t;
  173 
  174 /*
  175  * XXX - there are some nasty dependencies on include file order. Now that
  176  * sigset_t has been defined we can include the MD header.
  177  */     
  178 #include <machine/signal.h>     /* sig_atomic_t; trap codes; sigcontext */
  179 
  180 #if !defined(_ANSI_SOURCE)
  181 
  182 struct __siginfo;
  183 
  184 /*
  185  * Signal vector "template" used in sigaction call.
  186  */
  187 struct  sigaction {
  188         union {
  189                 void    (*__sa_handler) __P((int));
  190                 void    (*__sa_sigaction) __P((int, struct __siginfo *,
  191                                                void *));
  192         } __sigaction_u;                /* signal handler */
  193         int     sa_flags;               /* see signal options below */
  194         sigset_t sa_mask;               /* signal mask to apply */
  195 };
  196 
  197 /* if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler. */
  198 #define sa_handler      __sigaction_u.__sa_handler
  199 
  200 #define SA_NOCLDSTOP    0x0008  /* do not generate SIGCHLD on child stop */
  201 
  202 #if !defined(_POSIX_SOURCE)
  203 
  204 #define sa_sigaction    __sigaction_u.__sa_sigaction
  205 
  206 #define SA_ONSTACK      0x0001  /* take signal on signal stack */
  207 #define SA_RESTART      0x0002  /* restart system call on signal return */
  208 #define SA_RESETHAND    0x0004  /* reset to SIG_DFL when taking signal */
  209 #define SA_NODEFER      0x0010  /* don't mask the signal we're delivering */
  210 #define SA_NOCLDWAIT    0x0020  /* don't keep zombies around */
  211 #define SA_SIGINFO      0x0040  /* signal handler with SA_SIGINFO args */
  212 #ifdef COMPAT_SUNOS
  213 #define SA_USERTRAMP    0x0100  /* do not bounce off kernel's sigtramp */
  214 #endif
  215 
  216 #define NSIG            32      /* number of old signals (counting 0) */
  217 
  218 /* POSIX 1003.1b required values. */
  219 #define SI_USER         0x10001
  220 #define SI_QUEUE        0x10002
  221 #define SI_TIMER        0x10003
  222 #define SI_ASYNCIO      0x10004
  223 #define SI_MESGQ        0x10005
  224 
  225 /* Additional FreeBSD values. */
  226 #define SI_UNDEFINED    0
  227 
  228 typedef void __siginfohandler_t __P((int, struct __siginfo *, void *));
  229 
  230 typedef __sighandler_t  *sig_t; /* type of pointer to a signal function */
  231 
  232 #ifdef  _BSD_SIZE_T_
  233 typedef _BSD_SIZE_T_    size_t;
  234 #undef  _BSD_SIZE_T_
  235 #endif
  236 
  237 /*
  238  * Structure used in sigaltstack call.
  239  */
  240 typedef struct sigaltstack {
  241         char    *ss_sp;                 /* signal stack base */
  242         size_t  ss_size;                /* signal stack length */
  243         int     ss_flags;               /* SS_DISABLE and/or SS_ONSTACK */
  244 } stack_t;
  245 
  246 #define SS_ONSTACK      0x0001  /* take signal on alternate stack */
  247 #define SS_DISABLE      0x0004  /* disable taking signals on alternate stack */
  248 #define MINSIGSTKSZ     8192                    /* minimum allowable stack */
  249 #define SIGSTKSZ        (MINSIGSTKSZ + 32768)   /* recommended stack size */
  250 
  251 /* Have enough typedefs for this now.  XXX */
  252 #include <sys/ucontext.h>
  253 
  254 /*
  255  * 4.3 compatibility:
  256  * Signal vector "template" used in sigvec call.
  257  */
  258 struct  sigvec {
  259         __sighandler_t *sv_handler;     /* signal handler */
  260         int     sv_mask;                /* signal mask to apply */
  261         int     sv_flags;               /* see signal options below */
  262 };
  263 
  264 #define SV_ONSTACK      SA_ONSTACK
  265 #define SV_INTERRUPT    SA_RESTART      /* same bit, opposite sense */
  266 #define SV_RESETHAND    SA_RESETHAND
  267 #define SV_NODEFER      SA_NODEFER
  268 #define SV_NOCLDSTOP    SA_NOCLDSTOP
  269 #define SV_SIGINFO      SA_SIGINFO
  270 #define sv_onstack sv_flags     /* isn't compatibility wonderful! */
  271 
  272 /*
  273  * Structure used in sigstack call.
  274  */
  275 struct  sigstack {
  276         char    *ss_sp;                 /* signal stack pointer */
  277         int     ss_onstack;             /* current status */
  278 };
  279 
  280 /*
  281  * Macro for converting signal number to a mask suitable for
  282  * sigblock().
  283  */
  284 #define sigmask(m)      (1 << ((m)-1))
  285 
  286 #define BADSIG          SIG_ERR
  287 
  288 #endif /* !_POSIX_SOURCE */
  289 
  290 /*
  291  * Flags for sigprocmask:
  292  */
  293 #define SIG_BLOCK       1       /* block specified signal set */
  294 #define SIG_UNBLOCK     2       /* unblock specified signal set */
  295 #define SIG_SETMASK     3       /* set specified signal set */
  296 
  297 #endif /* !_ANSI_SOURCE */
  298 
  299 /*
  300  * For historical reasons; programs expect signal's return value to be
  301  * defined by <sys/signal.h>.
  302  */
  303 __BEGIN_DECLS
  304 __sighandler_t *signal __P((int, __sighandler_t *));
  305 __END_DECLS
  306 
  307 #endif  /* !_SYS_SIGNAL_H_ */

Cache object: 49ee9d792ab5f94df3d361ff28d81f08


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