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/bsd/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 /*
    2  * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
    5  * 
    6  * This file contains Original Code and/or Modifications of Original Code
    7  * as defined in and that are subject to the Apple Public Source License
    8  * Version 2.0 (the 'License'). You may not use this file except in
    9  * compliance with the License. The rights granted to you under the License
   10  * may not be used to create, or enable the creation or redistribution of,
   11  * unlawful or unlicensed copies of an Apple operating system, or to
   12  * circumvent, violate, or enable the circumvention or violation of, any
   13  * terms of an Apple operating system software license agreement.
   14  * 
   15  * Please obtain a copy of the License at
   16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
   17  * 
   18  * The Original Code and all software distributed under the License are
   19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   23  * Please see the License for the specific language governing rights and
   24  * limitations under the License.
   25  * 
   26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
   27  */
   28 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
   29 /*
   30  * Copyright (c) 1982, 1986, 1989, 1991, 1993
   31  *      The Regents of the University of California.  All rights reserved.
   32  * (c) UNIX System Laboratories, Inc.
   33  * All or some portions of this file are derived from material licensed
   34  * to the University of California by American Telephone and Telegraph
   35  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
   36  * the permission of UNIX System Laboratories, Inc.
   37  *
   38  * Redistribution and use in source and binary forms, with or without
   39  * modification, are permitted provided that the following conditions
   40  * are met:
   41  * 1. Redistributions of source code must retain the above copyright
   42  *    notice, this list of conditions and the following disclaimer.
   43  * 2. Redistributions in binary form must reproduce the above copyright
   44  *    notice, this list of conditions and the following disclaimer in the
   45  *    documentation and/or other materials provided with the distribution.
   46  * 3. All advertising materials mentioning features or use of this software
   47  *    must display the following acknowledgement:
   48  *      This product includes software developed by the University of
   49  *      California, Berkeley and its contributors.
   50  * 4. Neither the name of the University nor the names of its contributors
   51  *    may be used to endorse or promote products derived from this software
   52  *    without specific prior written permission.
   53  *
   54  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   55  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   56  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   57  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   58  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   59  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   60  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   61  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   62  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   63  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   64  * SUCH DAMAGE.
   65  *
   66  *      @(#)signal.h    8.2 (Berkeley) 1/21/94
   67  */
   68 
   69 #ifndef _SYS_SIGNAL_H_
   70 #define _SYS_SIGNAL_H_
   71 
   72 #include <sys/cdefs.h>
   73 #include <sys/appleapiopts.h>
   74 
   75 #define __DARWIN_NSIG   32      /* counting 0; could be 33 (mask is 1-32) */
   76 
   77 #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
   78 #define NSIG    __DARWIN_NSIG
   79 #endif
   80 
   81 #include <machine/signal.h>     /* sigcontext; codes for SIGILL, SIGFPE */
   82 
   83 #define SIGHUP  1       /* hangup */
   84 #define SIGINT  2       /* interrupt */
   85 #define SIGQUIT 3       /* quit */
   86 #define SIGILL  4       /* illegal instruction (not reset when caught) */
   87 #define SIGTRAP 5       /* trace trap (not reset when caught) */
   88 #define SIGABRT 6       /* abort() */
   89 #if  (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE))
   90 #define SIGPOLL 7       /* pollable event ([XSR] generated, not supported) */
   91 #else   /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
   92 #define SIGIOT  SIGABRT /* compatibility */
   93 #define SIGEMT  7       /* EMT instruction */
   94 #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
   95 #define SIGFPE  8       /* floating point exception */
   96 #define SIGKILL 9       /* kill (cannot be caught or ignored) */
   97 #define SIGBUS  10      /* bus error */
   98 #define SIGSEGV 11      /* segmentation violation */
   99 #define SIGSYS  12      /* bad argument to system call */
  100 #define SIGPIPE 13      /* write on a pipe with no one to read it */
  101 #define SIGALRM 14      /* alarm clock */
  102 #define SIGTERM 15      /* software termination signal from kill */
  103 #define SIGURG  16      /* urgent condition on IO channel */
  104 #define SIGSTOP 17      /* sendable stop signal not from tty */
  105 #define SIGTSTP 18      /* stop signal from tty */
  106 #define SIGCONT 19      /* continue a stopped process */
  107 #define SIGCHLD 20      /* to parent on child stop or exit */
  108 #define SIGTTIN 21      /* to readers pgrp upon background tty read */
  109 #define SIGTTOU 22      /* like TTIN for output if (tp->t_local&LTOSTOP) */
  110 #if  (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
  111 #define SIGIO   23      /* input/output possible signal */
  112 #endif
  113 #define SIGXCPU 24      /* exceeded CPU time limit */
  114 #define SIGXFSZ 25      /* exceeded file size limit */
  115 #define SIGVTALRM 26    /* virtual time alarm */
  116 #define SIGPROF 27      /* profiling time alarm */
  117 #if  (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
  118 #define SIGWINCH 28     /* window size changes */
  119 #define SIGINFO 29      /* information request */
  120 #endif
  121 #define SIGUSR1 30      /* user defined signal 1 */
  122 #define SIGUSR2 31      /* user defined signal 2 */
  123 
  124 #if defined(_ANSI_SOURCE) || __DARWIN_UNIX03 || defined(__cplusplus)
  125 /*
  126  * Language spec sez we must list exactly one parameter, even though we
  127  * actually supply three.  Ugh!
  128  * SIG_HOLD is chosen to avoid KERN_SIG_* values in <sys/signalvar.h>
  129  */
  130 #define SIG_DFL         (void (*)(int))0
  131 #define SIG_IGN         (void (*)(int))1
  132 #define SIG_HOLD        (void (*)(int))5
  133 #define SIG_ERR         ((void (*)(int))-1)
  134 #else
  135 /* DO NOT REMOVE THE COMMENTED OUT int: fixincludes needs to see them */
  136 #define SIG_DFL         (void (*)(/*int*/))0
  137 #define SIG_IGN         (void (*)(/*int*/))1
  138 #define SIG_HOLD        (void (*)(/*int*/))5
  139 #define SIG_ERR         ((void (*)(/*int*/))-1)
  140 #endif
  141 
  142 #ifndef _ANSI_SOURCE
  143 #include <sys/_types.h>
  144 
  145 #define __need_mcontext_t
  146 #define __need_stack_t
  147 #define __need_ucontext_t
  148 #include <sys/_structs.h>
  149 
  150 #ifndef _PID_T
  151 #define _PID_T
  152 typedef __darwin_pid_t                  pid_t;
  153 #endif
  154 
  155 #ifndef _PTHREAD_ATTR_T
  156 #define _PTHREAD_ATTR_T
  157 typedef __darwin_pthread_attr_t         pthread_attr_t;
  158 #endif
  159 
  160 #ifndef _SIGSET_T
  161 #define _SIGSET_T
  162 typedef __darwin_sigset_t               sigset_t;
  163 #endif
  164 
  165 #ifndef _SIZE_T
  166 #define _SIZE_T
  167 typedef __darwin_size_t                 size_t;
  168 #endif
  169 
  170 #ifndef _UID_T
  171 #define _UID_T
  172 typedef __darwin_uid_t                  uid_t;
  173 #endif
  174 
  175 union sigval {
  176         /* Members as suggested by Annex C of POSIX 1003.1b. */
  177         int     sival_int;
  178         void    *sival_ptr;
  179 };
  180 
  181 #define SIGEV_NONE      0       /* No async notification */
  182 #define SIGEV_SIGNAL    1       /* aio - completion notification */
  183 #define SIGEV_THREAD    3       /* [NOTIMP] [RTS] call notification function */
  184 
  185 struct sigevent {
  186         int                             sigev_notify;                           /* Notification type */
  187         int                             sigev_signo;                            /* Signal number */
  188         union sigval    sigev_value;                            /* Signal value */
  189         void                    (*sigev_notify_function)(union sigval);   /* Notification function */
  190         pthread_attr_t  *sigev_notify_attributes;       /* Notification attributes */
  191 };
  192 
  193 #ifdef BSD_KERNEL_PRIVATE
  194 
  195 union user64_sigval {
  196         struct {
  197                 uint32_t                pad;    /* assumes Motorola byte order */
  198                 int32_t                 sival_int;
  199         } size_equivalent;
  200         user64_addr_t   sival_ptr;
  201 };
  202 
  203 union user32_sigval {
  204         /* Members as suggested by Annex C of POSIX 1003.1b. */
  205         int32_t sival_int;
  206         user32_addr_t sival_ptr;
  207 };
  208 
  209 union user_sigval {
  210         struct {
  211                 uint32_t                pad;    /* assumes Motorola byte order */
  212                 int32_t                 sival_int;
  213         } size_equivalent;
  214         user_addr_t sival_ptr;
  215 };
  216 
  217 struct user64_sigevent {
  218         int             sigev_notify;                   /* Notification type */
  219         int             sigev_signo;                    /* Signal number */
  220         union user64_sigval sigev_value;                        /* Signal value */
  221         user64_addr_t   sigev_notify_function;          /* Notify function */
  222         user64_addr_t   sigev_notify_attributes;        /* Notify attributes */
  223 };
  224 
  225 struct user32_sigevent {
  226         int             sigev_notify;                   /* Notification type */
  227         int             sigev_signo;                    /* Signal number */
  228         union user32_sigval sigev_value;                        /* Signal value */
  229         user32_addr_t   sigev_notify_function;          /* Notify function */
  230         user32_addr_t   sigev_notify_attributes;        /* Notify attributes */
  231 };
  232 
  233 struct user_sigevent {
  234         int             sigev_notify;                   /* Notification type */
  235         int             sigev_signo;                    /* Signal number */
  236         union user_sigval sigev_value;                  /* Signal value */
  237         user_addr_t     sigev_notify_function;          /* Notify function */
  238         user_addr_t     sigev_notify_attributes;        /* Notify attributes */
  239 };
  240 
  241 #endif  /* BSD_KERNEL_PRIVATE */
  242 
  243 typedef struct __siginfo {
  244         int     si_signo;               /* signal number */
  245         int     si_errno;               /* errno association */
  246         int     si_code;                /* signal code */
  247         pid_t   si_pid;                 /* sending process */
  248         uid_t   si_uid;                 /* sender's ruid */
  249         int     si_status;              /* exit value */
  250         void    *si_addr;               /* faulting instruction */
  251         union sigval si_value;          /* signal value */
  252         long    si_band;                /* band event for SIGPOLL */
  253         unsigned long   __pad[7];       /* Reserved for Future Use */
  254 } siginfo_t;
  255 
  256 #ifdef BSD_KERNEL_PRIVATE
  257 
  258 typedef struct user_siginfo {
  259         int             si_signo;       /* signal number */
  260         int             si_errno;       /* errno association */
  261         int             si_code;        /* signal code */
  262         pid_t           si_pid;         /* sending process */
  263         uid_t           si_uid;         /* sender's ruid */
  264         int             si_status;      /* exit value */
  265         user_addr_t     si_addr;        /* faulting instruction (see below) */
  266         union user_sigval si_value;     /* signal value */
  267         user_long_t     si_band;        /* band event for SIGPOLL */
  268         user_ulong_t    pad[7];         /* Reserved for Future Use */
  269 } user_siginfo_t;
  270 
  271 typedef struct user64_siginfo {
  272         int             si_signo;       /* signal number */
  273         int             si_errno;       /* errno association */
  274         int             si_code;        /* signal code */
  275         pid_t           si_pid;         /* sending process */
  276         uid_t           si_uid;         /* sender's ruid */
  277         int             si_status;      /* exit value */
  278         user64_addr_t   si_addr;        /* faulting instruction (see below) */
  279         union user64_sigval si_value;   /* signal value */
  280         user64_long_t   si_band;        /* band event for SIGPOLL */
  281         user64_ulong_t  __pad[7];               /* Reserved for Future Use */
  282 } user64_siginfo_t;
  283 
  284 typedef struct user32_siginfo {
  285         int             si_signo;       /* signal number */
  286         int             si_errno;       /* errno association */
  287         int             si_code;        /* signal code */
  288         pid_t           si_pid;         /* sending process */
  289         uid_t           si_uid;         /* sender's ruid */
  290         int             si_status;      /* exit value */
  291         user32_addr_t   si_addr;        /* faulting instruction (see below) */
  292         union user32_sigval     si_value;       /* signal value */
  293         user32_long_t   si_band;        /* band event for SIGPOLL */
  294         user32_ulong_t  __pad[7];               /* Reserved for Future Use */
  295 } user32_siginfo_t;
  296 
  297 void siginfo_user_to_user32(user_siginfo_t *, user32_siginfo_t *);
  298 void siginfo_user_to_user64(user_siginfo_t *, user64_siginfo_t *);
  299 
  300 #endif  /* BSD_KERNEL_PRIVATE */
  301 
  302 /* 
  303  * When the signal is SIGILL or SIGFPE, si_addr contains the address of 
  304  * the faulting instruction.
  305  * When the signal is SIGSEGV or SIGBUS, si_addr contains the address of 
  306  * the faulting memory reference. Although for x86 there are cases of SIGSEGV
  307  * for which si_addr cannot be determined and is NULL. 
  308  * If the signal is SIGCHLD, the si_pid field will contain the child process ID,
  309  *  si_status contains the exit value or signal and
  310  *  si_uid contains the real user ID of the process that sent the signal.
  311  */
  312 
  313 /* Values for si_code */
  314 
  315 /* Codes for SIGILL */
  316 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  317 #define ILL_NOOP        0       /* if only I knew... */
  318 #endif
  319 #define ILL_ILLOPC      1       /* [XSI] illegal opcode */
  320 #define ILL_ILLTRP      2       /* [XSI] illegal trap */
  321 #define ILL_PRVOPC      3       /* [XSI] privileged opcode */
  322 #define ILL_ILLOPN      4       /* [XSI] illegal operand -NOTIMP */
  323 #define ILL_ILLADR      5       /* [XSI] illegal addressing mode -NOTIMP */
  324 #define ILL_PRVREG      6       /* [XSI] privileged register -NOTIMP */
  325 #define ILL_COPROC      7       /* [XSI] coprocessor error -NOTIMP */
  326 #define ILL_BADSTK      8       /* [XSI] internal stack error -NOTIMP */
  327 
  328 /* Codes for SIGFPE */
  329 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  330 #define FPE_NOOP        0       /* if only I knew... */
  331 #endif
  332 #define FPE_FLTDIV      1       /* [XSI] floating point divide by zero */
  333 #define FPE_FLTOVF      2       /* [XSI] floating point overflow */
  334 #define FPE_FLTUND      3       /* [XSI] floating point underflow */
  335 #define FPE_FLTRES      4       /* [XSI] floating point inexact result */
  336 #define FPE_FLTINV      5       /* [XSI] invalid floating point operation */
  337 #define FPE_FLTSUB      6       /* [XSI] subscript out of range -NOTIMP */
  338 #define FPE_INTDIV      7       /* [XSI] integer divide by zero */
  339 #define FPE_INTOVF      8       /* [XSI] integer overflow */
  340 
  341 /* Codes for SIGSEGV */
  342 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  343 #define SEGV_NOOP       0       /* if only I knew... */
  344 #endif
  345 #define SEGV_MAPERR     1       /* [XSI] address not mapped to object */
  346 #define SEGV_ACCERR     2       /* [XSI] invalid permission for mapped object */
  347 
  348 /* Codes for SIGBUS */
  349 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  350 #define BUS_NOOP        0       /* if only I knew... */
  351 #endif
  352 #define BUS_ADRALN      1       /* [XSI] Invalid address alignment */
  353 #define BUS_ADRERR      2       /* [XSI] Nonexistent physical address -NOTIMP */
  354 #define BUS_OBJERR      3       /* [XSI] Object-specific HW error - NOTIMP */
  355 
  356 /* Codes for SIGTRAP */
  357 #define TRAP_BRKPT      1       /* [XSI] Process breakpoint -NOTIMP */
  358 #define TRAP_TRACE      2       /* [XSI] Process trace trap -NOTIMP */
  359 
  360 /* Codes for SIGCHLD */
  361 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  362 #define CLD_NOOP        0       /* if only I knew... */
  363 #endif
  364 #define CLD_EXITED      1       /* [XSI] child has exited */
  365 #define CLD_KILLED      2       /* [XSI] terminated abnormally, no core file */
  366 #define CLD_DUMPED      3       /* [XSI] terminated abnormally, core file */
  367 #define CLD_TRAPPED     4       /* [XSI] traced child has trapped */
  368 #define CLD_STOPPED     5       /* [XSI] child has stopped */
  369 #define CLD_CONTINUED   6       /* [XSI] stopped child has continued */
  370 
  371 /* Codes for SIGPOLL */
  372 #define POLL_IN         1       /* [XSR] Data input available */
  373 #define POLL_OUT        2       /* [XSR] Output buffers available */
  374 #define POLL_MSG        3       /* [XSR] Input message available */
  375 #define POLL_ERR        4       /* [XSR] I/O error */
  376 #define POLL_PRI        5       /* [XSR] High priority input available */
  377 #define POLL_HUP        6       /* [XSR] Device disconnected */
  378 
  379 /* union for signal handlers */
  380 union __sigaction_u {
  381         void    (*__sa_handler)(int);
  382         void    (*__sa_sigaction)(int, struct __siginfo *,
  383                        void *);
  384 };
  385 
  386 /* Signal vector template for Kernel user boundary */
  387 struct  __sigaction {
  388         union __sigaction_u __sigaction_u;  /* signal handler */
  389         void    (*sa_tramp)(void *, int, int, siginfo_t *, void *);
  390         sigset_t sa_mask;               /* signal mask to apply */
  391         int     sa_flags;               /* see signal options below */
  392 };
  393 
  394 /*
  395  * Signal vector "template" used in sigaction call.
  396  */
  397 struct  sigaction {
  398         union __sigaction_u __sigaction_u;  /* signal handler */
  399         sigset_t sa_mask;               /* signal mask to apply */
  400         int     sa_flags;               /* see signal options below */
  401 };
  402 
  403 #ifdef  BSD_KERNEL_PRIVATE
  404 #include <machine/types.h>
  405 
  406 union __user32_sigaction_u {
  407         user32_addr_t __sa_handler;
  408         user32_addr_t __sa_sigaction;
  409 };
  410 
  411 struct  user32_sigaction {
  412         union __user32_sigaction_u __sigaction_u;  /* signal handler */
  413         sigset_t sa_mask;               /* signal mask to apply */
  414         int     sa_flags;               /* see signal options below */
  415 };
  416 
  417 struct  __user32_sigaction {
  418         union __user32_sigaction_u __sigaction_u;  /* signal handler */
  419         user32_addr_t sa_tramp;
  420         sigset_t sa_mask;               /* signal mask to apply */
  421         int     sa_flags;               /* see signal options below */
  422 };
  423 
  424 union __user64_sigaction_u {
  425         user64_addr_t   __sa_handler;
  426         user64_addr_t   __sa_sigaction;
  427 };
  428 
  429 struct  user64_sigaction {
  430         union __user64_sigaction_u __sigaction_u;  /* signal handler */
  431         sigset_t sa_mask;               /* signal mask to apply */
  432         int     sa_flags;               /* see signal options below */
  433 };
  434 
  435 struct  __user64_sigaction {
  436         union __user64_sigaction_u __sigaction_u;  /* signal handler */
  437         user64_addr_t   sa_tramp;       /* signal mask to apply */
  438         sigset_t sa_mask;               /* signal mask to apply */
  439         int     sa_flags;               /* see signal options below */
  440 };
  441 
  442 union __kern_sigaction_u {
  443         user_addr_t     __sa_handler;
  444         user_addr_t     __sa_sigaction;
  445 };
  446 
  447 struct  kern_sigaction {
  448         union __kern_sigaction_u __sigaction_u;  /* signal handler */
  449         sigset_t sa_mask;               /* signal mask to apply */
  450         int     sa_flags;               /* see signal options below */
  451 };
  452 
  453 struct  __kern_sigaction {
  454         union __kern_sigaction_u __sigaction_u;  /* signal handler */
  455         user_addr_t     sa_tramp;       /* signal mask to apply */
  456         sigset_t sa_mask;               /* signal mask to apply */
  457         int     sa_flags;               /* see signal options below */
  458 };
  459 
  460 #undef SIG_DFL
  461 #undef SIG_IGN
  462 #undef SIG_ERR
  463 #define  SIG_DFL        ((user_addr_t)0LL)
  464 #define  SIG_IGN        ((user_addr_t)1LL)
  465 #define  SIG_ERR        ((user_addr_t)-1LL)
  466 
  467 #endif  /* BSD_KERNEL_PRIVATE */
  468 
  469 
  470 /* if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler. */
  471 #define sa_handler      __sigaction_u.__sa_handler
  472 #define sa_sigaction    __sigaction_u.__sa_sigaction
  473 
  474 #define SA_ONSTACK      0x0001  /* take signal on signal stack */
  475 #define SA_RESTART      0x0002  /* restart system on signal return */
  476 #ifdef  BSD_KERNEL_PRIVATE
  477 #define SA_DISABLE      0x0004  /* disable taking signals on alternate stack - for user_sigaltstack.ss_flags only */
  478 #endif  /* BSD_KERNEL_PRIVATE */
  479 #define SA_RESETHAND    0x0004  /* reset to SIG_DFL when taking signal */
  480 #define SA_NOCLDSTOP    0x0008  /* do not generate SIGCHLD on child stop */
  481 #define SA_NODEFER      0x0010  /* don't mask the signal we're delivering */
  482 #define SA_NOCLDWAIT    0x0020  /* don't keep zombies around */
  483 #define SA_SIGINFO      0x0040  /* signal handler with SA_SIGINFO args */
  484 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  485 #define SA_USERTRAMP    0x0100  /* do not bounce off kernel's sigtramp */
  486 /* This will provide 64bit register set in a 32bit user address space */
  487 #define SA_64REGSET     0x0200  /* signal handler with SA_SIGINFO args with 64bit regs information */
  488 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
  489 
  490 /* the following are the only bits we support from user space, the 
  491  * rest are for kernel use only.
  492  */
  493 #define SA_USERSPACE_MASK (SA_ONSTACK | SA_RESTART | SA_RESETHAND | SA_NOCLDSTOP | SA_NODEFER | SA_NOCLDWAIT | SA_SIGINFO)
  494 
  495 /*
  496  * Flags for sigprocmask:
  497  */
  498 #define SIG_BLOCK       1       /* block specified signal set */
  499 #define SIG_UNBLOCK     2       /* unblock specified signal set */
  500 #define SIG_SETMASK     3       /* set specified signal set */
  501 
  502 /* POSIX 1003.1b required values. */
  503 #define SI_USER         0x10001 /* [CX] signal from kill() */
  504 #define SI_QUEUE        0x10002 /* [CX] signal from sigqueue() */
  505 #define SI_TIMER        0x10003 /* [CX] timer expiration */
  506 #define SI_ASYNCIO      0x10004 /* [CX] aio request completion */
  507 #define SI_MESGQ        0x10005 /* [CX] from message arrival on empty queue */
  508 
  509 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  510 typedef void (*sig_t)(int);     /* type of signal function */
  511 #endif
  512 
  513 /*
  514  * Structure used in sigaltstack call.
  515  */
  516 #ifdef  BSD_KERNEL_PRIVATE
  517 
  518 struct  user32_sigaltstack {
  519         user32_addr_t   ss_sp;          /* signal stack base */
  520         user32_size_t   ss_size;        /* signal stack length */
  521         int                 ss_flags;   /* SA_DISABLE and/or SA_ONSTACK */
  522 };
  523 
  524 struct  user64_sigaltstack {
  525         user64_addr_t   ss_sp;          /* signal stack base */
  526         user64_size_t   ss_size;        /* signal stack length */
  527         int             ss_flags;       /* SA_DISABLE and/or SA_ONSTACK */
  528 };
  529 
  530 struct  kern_sigaltstack {
  531         user_addr_t     ss_sp;          /* signal stack base */
  532         user_size_t     ss_size;        /* signal stack length */
  533         int             ss_flags;       /* SA_DISABLE and/or SA_ONSTACK */
  534 };
  535 
  536 #endif  /* BSD_KERNEL_PRIVATE */
  537 
  538 #define SS_ONSTACK      0x0001  /* take signal on signal stack */
  539 #define SS_DISABLE      0x0004  /* disable taking signals on alternate stack */
  540 #define MINSIGSTKSZ     32768   /* (32K)minimum allowable stack */
  541 #define SIGSTKSZ        131072  /* (128K)recommended stack size */
  542 
  543 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  544 /*
  545  * 4.3 compatibility:
  546  * Signal vector "template" used in sigvec call.
  547  */
  548 struct  sigvec {
  549         void    (*sv_handler)(int);     /* signal handler */
  550         int     sv_mask;                /* signal mask to apply */
  551         int     sv_flags;               /* see signal options below */
  552 };
  553 
  554 #define SV_ONSTACK      SA_ONSTACK
  555 #define SV_INTERRUPT    SA_RESTART      /* same bit, opposite sense */
  556 #define SV_RESETHAND    SA_RESETHAND
  557 #define SV_NODEFER      SA_NODEFER
  558 #define SV_NOCLDSTOP    SA_NOCLDSTOP
  559 #define SV_SIGINFO      SA_SIGINFO
  560 
  561 #define sv_onstack sv_flags     /* isn't compatibility wonderful! */
  562 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
  563 
  564 /*
  565  * Structure used in sigstack call.
  566  */
  567 struct  sigstack {
  568         char    *ss_sp;                 /* signal stack pointer */
  569         int     ss_onstack;             /* current status */
  570 };
  571 
  572 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  573 /*
  574  * Macro for converting signal number to a mask suitable for
  575  * sigblock().
  576  */
  577 #define sigmask(m)      (1 << ((m)-1))
  578 
  579 #ifdef  BSD_KERNEL_PRIVATE
  580 /*
  581  *      signals delivered on a per-thread basis.
  582  */
  583 #define threadmask (sigmask(SIGILL)|sigmask(SIGTRAP)|\
  584                     sigmask(SIGIOT)|sigmask(SIGEMT)|\
  585                     sigmask(SIGFPE)|sigmask(SIGBUS)|\
  586                     sigmask(SIGSEGV)|sigmask(SIGSYS)|\
  587                     sigmask(SIGPIPE))
  588 
  589 #define workq_threadmask (threadmask | sigcantmask)
  590 
  591 /*
  592  * Signals carried across exec.
  593  */
  594 #define execmask   (sigmask(SIGHUP)|sigmask(SIGINT)|\
  595                     sigmask(SIGQUIT)|sigmask(SIGKILL)|\
  596                     sigmask(SIGTERM)|sigmask(SIGSTOP)|\
  597                     sigmask(SIGTSTP)|sigmask(SIGCONT)|\
  598                     sigmask(SIGTTIN)|sigmask(SIGTTOU)|\
  599                     sigmask(SIGUSR1)|sigmask(SIGUSR2))
  600 
  601 #endif  /* BSD_KERNEL_PRIVATE */
  602 
  603 #define BADSIG          SIG_ERR
  604 
  605 #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
  606 #endif  /* !_ANSI_SOURCE */
  607 
  608 /*
  609  * For historical reasons; programs expect signal's return value to be
  610  * defined by <sys/signal.h>.
  611  */
  612 __BEGIN_DECLS
  613 void    (*signal(int, void (*)(int)))(int);
  614 __END_DECLS
  615 #endif  /* !_SYS_SIGNAL_H_ */

Cache object: 094bec2ea6f455cc021bf4ce2511670c


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