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-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: signal.h,v 1.75 2021/11/02 20:12:26 christos Exp $     */
    2 
    3 /*
    4  * Copyright (c) 1982, 1986, 1989, 1991, 1993
    5  *      The Regents of the University of California.  All rights reserved.
    6  * (c) UNIX System Laboratories, Inc.
    7  * All or some portions of this file are derived from material licensed
    8  * to the University of California by American Telephone and Telegraph
    9  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
   10  * the permission of UNIX System Laboratories, Inc.
   11  *
   12  * Redistribution and use in source and binary forms, with or without
   13  * modification, are permitted provided that the following conditions
   14  * are met:
   15  * 1. Redistributions of source code must retain the above copyright
   16  *    notice, this list of conditions and the following disclaimer.
   17  * 2. Redistributions in binary form must reproduce the above copyright
   18  *    notice, this list of conditions and the following disclaimer in the
   19  *    documentation and/or other materials provided with the distribution.
   20  * 3. Neither the name of the University nor the names of its contributors
   21  *    may be used to endorse or promote products derived from this software
   22  *    without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34  * SUCH DAMAGE.
   35  *
   36  *      @(#)signal.h    8.4 (Berkeley) 5/4/95
   37  */
   38 
   39 #ifndef _SYS_SIGNAL_H_
   40 #define _SYS_SIGNAL_H_
   41 
   42 #include <sys/featuretest.h>
   43 #include <sys/sigtypes.h>
   44 
   45 #define _NSIG           64
   46 
   47 #if defined(_NETBSD_SOURCE)
   48 #define NSIG _NSIG
   49 
   50 #endif /* _NETBSD_SOURCE */
   51 
   52 #define SIGHUP          1       /* hangup */
   53 #define SIGINT          2       /* interrupt */
   54 #define SIGQUIT         3       /* quit */
   55 #define SIGILL          4       /* illegal instruction (not reset when caught) */
   56 #define SIGTRAP         5       /* trace trap (not reset when caught) */
   57 #define SIGABRT         6       /* abort() */
   58 #define SIGIOT          SIGABRT /* compatibility */
   59 #define SIGEMT          7       /* EMT instruction */
   60 #define SIGFPE          8       /* floating point exception */
   61 #define SIGKILL         9       /* kill (cannot be caught or ignored) */
   62 #define SIGBUS          10      /* bus error */
   63 #define SIGSEGV         11      /* segmentation violation */
   64 #define SIGSYS          12      /* bad argument to system call */
   65 #define SIGPIPE         13      /* write on a pipe with no one to read it */
   66 #define SIGALRM         14      /* alarm clock */
   67 #define SIGTERM         15      /* software termination signal from kill */
   68 #define SIGURG          16      /* urgent condition on IO channel */
   69 #define SIGSTOP         17      /* sendable stop signal not from tty */
   70 #define SIGTSTP         18      /* stop signal from tty */
   71 #define SIGCONT         19      /* continue a stopped process */
   72 #define SIGCHLD         20      /* to parent on child stop or exit */
   73 #define SIGTTIN         21      /* to readers pgrp upon background tty read */
   74 #define SIGTTOU         22      /* like TTIN for output if (tp->t_local&LTOSTOP) */
   75 #define SIGIO           23      /* input/output possible signal */
   76 #define SIGXCPU         24      /* exceeded CPU time limit */
   77 #define SIGXFSZ         25      /* exceeded file size limit */
   78 #define SIGVTALRM       26      /* virtual time alarm */
   79 #define SIGPROF         27      /* profiling time alarm */
   80 #define SIGWINCH        28      /* window size changes */
   81 #define SIGINFO         29      /* information request */
   82 #define SIGUSR1         30      /* user defined signal 1 */
   83 #define SIGUSR2         31      /* user defined signal 2 */
   84 #define SIGPWR          32      /* power fail/restart (not reset when caught) */
   85 #define SIGRTMIN        33
   86 #define SIGRTMAX        63
   87 
   88 #ifndef _KERNEL
   89 #include <sys/cdefs.h>
   90 #endif
   91 
   92 #define SIG_DFL         ((void (*)(int))  0)
   93 #define SIG_IGN         ((void (*)(int))  1)
   94 #define SIG_ERR         ((void (*)(int)) -1)
   95 #define SIG_HOLD        ((void (*)(int))  3)
   96 
   97 #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
   98     defined(_NETBSD_SOURCE)
   99 
  100 #ifdef _KERNEL
  101 #define sigaddset(s, n)         __sigaddset(s, n)
  102 #define sigdelset(s, n)         __sigdelset(s, n)
  103 #define sigismember(s, n)       __sigismember(s, n)
  104 #define sigemptyset(s)          __sigemptyset(s)
  105 #define sigfillset(s)           __sigfillset(s)
  106 #define sigplusset(s, t)        __sigplusset(s, t)
  107 #define sigminusset(s, t)       __sigminusset(s, t)
  108 #endif /* _KERNEL */
  109 
  110 #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
  111     defined(_NETBSD_SOURCE)
  112 #include <sys/siginfo.h>
  113 #endif
  114 
  115 #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
  116     (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
  117 #include <sys/ucontext.h>
  118 #endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
  119 
  120 /*
  121  * Signal vector "template" used in sigaction call.
  122  */
  123 struct  sigaction {
  124         union {
  125                 void (*_sa_handler)(int);
  126 #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
  127     defined(_NETBSD_SOURCE)
  128                 void (*_sa_sigaction)(int, siginfo_t *, void *);
  129 #endif
  130         } _sa_u;        /* signal handler */
  131         sigset_t sa_mask;               /* signal mask to apply */
  132         int     sa_flags;               /* see signal options below */
  133 };
  134 
  135 #define sa_handler _sa_u._sa_handler
  136 #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
  137     defined(_NETBSD_SOURCE)
  138 #define sa_sigaction _sa_u._sa_sigaction
  139 #endif
  140 
  141 /*
  142  * Signal return trampoline versioning:
  143  *
  144  * In historical BSD, the kernel provided the signal trampoline, copying
  145  * it out to the process's stack.  In NetBSD 2.0, the signal trampoline
  146  * was moved into libc, and versioned in order to support the historical
  147  * BSD "sigcontext" style of handler in addition to the modern "siginfo"
  148  * style of handler.  The trampoline and its ABI version are registered
  149  * with the kernel along with the handlers.
  150  *
  151  * The versioning follows this general pattern:
  152  *
  153  * 0    Historical BSD style, trampoline provided by the kernel.  This is
  154  *      now used only by COMPAT_* modules.
  155  *
  156  * 1    Legacy BSD "sigcontext" trampoline.  This style is deprecated and
  157  *      no longer documented.  However, on platforms that have a legacy
  158  *      "sigcontext" structure, it is still possible to register a handler
  159  *      that uses this trampoline.
  160  *
  161  * 2    Modern "siginfo" trampoline.  This style is used if a handler
  162  *      explicitly requests "siginfo", or if the deprecation of "sigcontext"
  163  *      style handlers pre-dates support for the platform.
  164  *
  165  * Some architectures have, in the past, needed to version the "sigcontext"
  166  * trampoline; an override mechanism is provided for this purpose.  No more
  167  * changes to the old "sigcontext" trampoline ABI will ever be performed,
  168  * and support for it should not be included when adding support for new
  169  * architectures.  Those architectures that support the "sigcontext"
  170  * trampoline must define __HAVE_STRUCT_SIGCONTEXT in <machine/signal.h>.
  171  * If a 64-bit architecture needs to support "sigcontext" trampolines only
  172  * for 32-bit compatibility, then __HAVE_STRUCT_SIGCONTEXT can be conditional
  173  * on _KERNEL.
  174  *
  175  * If an architecture defines a sigcontext structure in <machine/signal.h>,
  176  * it should be visible only for _KERNEL and _LIBC.
  177  *
  178  * In the unlikely event that an an architecture needs to version
  179  * the "siginfo" trampoline, it can achieve this by overriding the
  180  * various __SIGTRAMP_SIGINFO_VERSION-related constants.
  181  */
  182 
  183 #include <machine/signal.h>     /* sigcontext; codes for SIGILL, SIGFPE */
  184 
  185 #define __SIGTRAMP_SIGCODE_VERSION        0
  186 
  187 #define __SIGTRAMP_SIGCONTEXT_VERSION_MIN 1
  188 
  189 #ifndef __SIGTRAMP_SIGCONTEXT_VERSION_MAX
  190 #define __SIGTRAMP_SIGCONTEXT_VERSION_MAX 1
  191 #endif
  192 
  193 #ifndef __SIGTRAMP_SIGCONTEXT_VERSION
  194 #define __SIGTRAMP_SIGCONTEXT_VERSION     1
  195 #endif
  196 
  197 #if __SIGTRAMP_SIGCONTEXT_VERSION_MAX < __SIGTRAMP_SIGCONTEXT_VERSION_MIN
  198 #error invalid __SIGTRAMP_SIGCONTEXT_VERSION_MAX
  199 #endif
  200 
  201 #ifndef __SIGTRAMP_SIGINFO_VERSION_MIN
  202 #define __SIGTRAMP_SIGINFO_VERSION_MIN    2
  203 #endif
  204 
  205 #ifndef __SIGTRAMP_SIGINFO_VERSION_MAX
  206 #define __SIGTRAMP_SIGINFO_VERSION_MAX    2
  207 #endif
  208 
  209 #ifndef __SIGTRAMP_SIGINFO_VERSION
  210 #define __SIGTRAMP_SIGINFO_VERSION        2
  211 #endif
  212 
  213 #if __SIGTRAMP_SIGINFO_VERSION_MAX < __SIGTRAMP_SIGINFO_VERSION_MIN
  214 #error invalid __SIGTRAMP_SIGINFO_VERSION_MAX
  215 #endif
  216 
  217 #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
  218     (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
  219 #define SA_ONSTACK      0x0001  /* take signal on signal stack */
  220 #define SA_RESTART      0x0002  /* restart system call on signal return */
  221 #define SA_RESETHAND    0x0004  /* reset to SIG_DFL when taking signal */
  222 #define SA_NODEFER      0x0010  /* don't mask the signal we're delivering */
  223 #endif /* _XOPEN_SOURCE_EXTENDED || XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
  224 /* Only valid for SIGCHLD. */
  225 #define SA_NOCLDSTOP    0x0008  /* do not generate SIGCHLD on child stop */
  226 #define SA_NOCLDWAIT    0x0020  /* do not generate zombies on unwaited child */
  227 #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
  228     defined(_NETBSD_SOURCE)
  229 #define SA_SIGINFO      0x0040  /* take sa_sigaction handler */
  230 #endif /* (_POSIX_C_SOURCE - 0) >= 199309L || ... */
  231 #if defined(_NETBSD_SOURCE)
  232 #define SA_NOKERNINFO   0x0080  /* siginfo does not print kernel info on tty */
  233 #endif /*_NETBSD_SOURCE */
  234 #ifdef _KERNEL
  235 #define SA_ALLBITS      0x00ff
  236 #endif
  237 
  238 /*
  239  * Flags for sigprocmask():
  240  */
  241 #define SIG_BLOCK       1       /* block specified signal set */
  242 #define SIG_UNBLOCK     2       /* unblock specified signal set */
  243 #define SIG_SETMASK     3       /* set specified signal set */
  244 
  245 #if defined(_NETBSD_SOURCE)
  246 typedef void (*sig_t)(int);     /* type of signal function */
  247 
  248 #define SS_INIT                 /* Initializer for stack_t */ \
  249     ((stack_t) { .ss_sp = NULL, .ss_flags = SS_DISABLE,  .ss_size = 0 })
  250 
  251 #endif
  252 
  253 #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
  254     (_XOPEN_SOURCE - 0) >= 500 || (_POSIX_C_SOURCE - 0) >= 200809L || \
  255     defined(_NETBSD_SOURCE)
  256 /*
  257  * Flags used with stack_t/struct sigaltstack.
  258  */
  259 #define SS_ONSTACK      0x0001  /* take signals on alternate stack */
  260 #define SS_DISABLE      0x0004  /* disable taking signals on alternate stack */
  261 #ifdef _KERNEL
  262 #define SS_ALLBITS      0x0005
  263 #endif
  264 #define MINSIGSTKSZ     8192                    /* minimum allowable stack */
  265 #define SIGSTKSZ        (MINSIGSTKSZ + 32768)   /* recommended stack size */
  266 #endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500
  267         * || _POSIX_C_SOURCE >= 200809L || _NETBSD_SOURCE
  268         */
  269 
  270 #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
  271     (_XOPEN_SOURCE - 0) >= 500 || (_POSIX_C_SOURCE - 0) >= 200809L || \
  272     defined(_NETBSD_SOURCE)
  273 /*
  274  * Structure used in sigstack call.
  275  */
  276 struct  sigstack {
  277         void    *ss_sp;                 /* signal stack pointer */
  278         int     ss_onstack;             /* current status */
  279 };
  280 #endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500
  281         * || _POSIX_C_SOURCE >= 200809L || _NETBSD_SOURCE
  282         */
  283 
  284 #if defined(_NETBSD_SOURCE) && !defined(_KERNEL)
  285 /*
  286  * Macro for converting signal number to a mask suitable for
  287  * sigblock().
  288  */
  289 #define sigmask(n)      __sigmask(n)
  290 
  291 #define BADSIG          SIG_ERR
  292 #endif /* _NETBSD_SOURCE */
  293 
  294 #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
  295     defined(_NETBSD_SOURCE)
  296 struct  sigevent {
  297         int     sigev_notify;
  298         int     sigev_signo;
  299         union sigval    sigev_value;
  300         void    (*sigev_notify_function)(union sigval);
  301         void /* pthread_attr_t */       *sigev_notify_attributes;
  302 };
  303 
  304 #define SIGEV_NONE      0
  305 #define SIGEV_SIGNAL    1
  306 #define SIGEV_THREAD    2
  307 #if defined(_NETBSD_SOURCE)
  308 #define SIGEV_SA        3
  309 #endif
  310 #endif /* (_POSIX_C_SOURCE - 0) >= 199309L || ... */
  311 
  312 #endif  /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
  313 
  314 /*
  315  * For historical reasons; programs expect signal's return value to be
  316  * defined by <sys/signal.h>.
  317  */
  318 __BEGIN_DECLS
  319 void    (*signal(int, void (*)(int)))(int);
  320 void    (*bsd_signal(int, void (*)(int)))(int);
  321 #if (_POSIX_C_SOURCE - 0) >= 200112L || defined(_NETBSD_SOURCE)
  322 int     sigqueue(pid_t, int, const union sigval);
  323 #endif
  324 #if defined(_NETBSD_SOURCE)
  325 int     sigqueueinfo(pid_t, const siginfo_t *);
  326 #endif
  327 __END_DECLS
  328 #endif  /* !_SYS_SIGNAL_H_ */

Cache object: e7be958999dbc50f811617d68601b26d


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