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  -  FREEBSD11  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  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) 2000-2002 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
    7  * 
    8  * This file contains Original Code and/or Modifications of Original Code
    9  * as defined in and that are subject to the Apple Public Source License
   10  * Version 2.0 (the 'License'). You may not use this file except in
   11  * compliance with the License. Please obtain a copy of the License at
   12  * http://www.opensource.apple.com/apsl/ and read it before using this
   13  * file.
   14  * 
   15  * The Original Code and all software distributed under the License are
   16  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   17  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   18  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   19  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   20  * Please see the License for the specific language governing rights and
   21  * limitations under the License.
   22  * 
   23  * @APPLE_LICENSE_HEADER_END@
   24  */
   25 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
   26 /*
   27  * Copyright (c) 1982, 1986, 1989, 1991, 1993
   28  *      The Regents of the University of California.  All rights reserved.
   29  * (c) UNIX System Laboratories, Inc.
   30  * All or some portions of this file are derived from material licensed
   31  * to the University of California by American Telephone and Telegraph
   32  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
   33  * the permission of UNIX System Laboratories, Inc.
   34  *
   35  * Redistribution and use in source and binary forms, with or without
   36  * modification, are permitted provided that the following conditions
   37  * are met:
   38  * 1. Redistributions of source code must retain the above copyright
   39  *    notice, this list of conditions and the following disclaimer.
   40  * 2. Redistributions in binary form must reproduce the above copyright
   41  *    notice, this list of conditions and the following disclaimer in the
   42  *    documentation and/or other materials provided with the distribution.
   43  * 3. All advertising materials mentioning features or use of this software
   44  *    must display the following acknowledgement:
   45  *      This product includes software developed by the University of
   46  *      California, Berkeley and its contributors.
   47  * 4. Neither the name of the University nor the names of its contributors
   48  *    may be used to endorse or promote products derived from this software
   49  *    without specific prior written permission.
   50  *
   51  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   52  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   53  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   54  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   55  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   56  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   57  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   58  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   59  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   60  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   61  * SUCH DAMAGE.
   62  *
   63  *      @(#)signal.h    8.2 (Berkeley) 1/21/94
   64  */
   65 
   66 #ifndef _SYS_SIGNAL_H_
   67 #define _SYS_SIGNAL_H_
   68 
   69 #include <sys/appleapiopts.h>
   70 
   71 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
   72 #define NSIG    32              /* counting 0; could be 33 (mask is 1-32) */
   73 #endif
   74 
   75 #include <machine/signal.h>     /* sigcontext; codes for SIGILL, SIGFPE */
   76 
   77 #define SIGHUP  1       /* hangup */
   78 #define SIGINT  2       /* interrupt */
   79 #define SIGQUIT 3       /* quit */
   80 #define SIGILL  4       /* illegal instruction (not reset when caught) */
   81 #if  !defined(_POSIX_SOURCE)
   82 #define SIGTRAP 5       /* trace trap (not reset when caught) */
   83 #endif
   84 #define SIGABRT 6       /* abort() */
   85 #if  !defined(_POSIX_SOURCE)
   86 #define SIGIOT  SIGABRT /* compatibility */
   87 #define SIGEMT  7       /* EMT instruction */
   88 #endif
   89 #define SIGFPE  8       /* floating point exception */
   90 #define SIGKILL 9       /* kill (cannot be caught or ignored) */
   91 #if  !defined(_POSIX_SOURCE)
   92 #define SIGBUS  10      /* bus error */
   93 #endif
   94 #define SIGSEGV 11      /* segmentation violation */
   95 #if  !defined(_POSIX_SOURCE)
   96 #define SIGSYS  12      /* bad argument to system call */
   97 #endif
   98 #define SIGPIPE 13      /* write on a pipe with no one to read it */
   99 #define SIGALRM 14      /* alarm clock */
  100 #define SIGTERM 15      /* software termination signal from kill */
  101 #if  !defined(_POSIX_SOURCE)
  102 #define SIGURG  16      /* urgent condition on IO channel */
  103 #endif
  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_SOURCE)
  111 #define SIGIO   23      /* input/output possible signal */
  112 #define SIGXCPU 24      /* exceeded CPU time limit */
  113 #define SIGXFSZ 25      /* exceeded file size limit */
  114 #define SIGVTALRM 26    /* virtual time alarm */
  115 #define SIGPROF 27      /* profiling time alarm */
  116 #define SIGWINCH 28     /* window size changes */
  117 #define SIGINFO 29      /* information request */
  118 #endif
  119 #define SIGUSR1 30      /* user defined signal 1 */
  120 #define SIGUSR2 31      /* user defined signal 2 */
  121 
  122 #if defined(_ANSI_SOURCE) || defined(__cplusplus)
  123 /*
  124  * Language spec sez we must list exactly one parameter, even though we
  125  * actually supply three.  Ugh!
  126  */
  127 #define SIG_DFL         (void (*)(int))0
  128 #define SIG_IGN         (void (*)(int))1
  129 #define SIG_ERR         (void (*)(int))-1
  130 #else
  131 #define SIG_DFL         (void (*)())0
  132 #define SIG_IGN         (void (*)())1
  133 #define SIG_ERR         (void (*)())-1
  134 #endif
  135 
  136 #ifndef _ANSI_SOURCE
  137 #include <sys/types.h>
  138 
  139 typedef unsigned int sigset_t;
  140 
  141 union sigval {
  142         /* Members as suggested by Annex C of POSIX 1003.1b. */
  143         int     sigval_int;
  144         void    *sigval_ptr;
  145 };
  146 
  147 #define SIGEV_NONE              0               /* No async notification */
  148 #define SIGEV_SIGNAL    1               /* aio - completion notification */
  149 #ifdef __APPLE_API_PRIVATE
  150 #define SIGEV_THREAD    3               /* A notification function will be called to perform notification */
  151 #endif /*__APPLE_API_PRIVATE */
  152 
  153 struct sigevent {
  154         int                             sigev_notify;                           /* Notification type */
  155         int                             sigev_signo;                            /* Signal number */
  156         union sigval    sigev_value;                            /* Signal value */
  157         void                    (*sigev_notify_function)(union sigval);   /* Notification function */
  158         pthread_attr_t  *sigev_notify_attributes;       /* Notification attributes */
  159 };
  160 
  161 typedef struct __siginfo {
  162         int     si_signo;               /* signal number */
  163         int     si_errno;               /* errno association */
  164         int     si_code;                /* signal code */
  165         int     si_pid;                 /* sending process */
  166         unsigned int si_uid;            /* sender's ruid */
  167         int     si_status;              /* exit value */
  168         void    *si_addr;               /* faulting instruction */
  169         union sigval si_value;          /* signal value */
  170         long    si_band;                /* band event for SIGPOLL */
  171         unsigned int    pad[7];         /* Reserved for Future Use */
  172 } siginfo_t;
  173 
  174 /* 
  175  * Incase of SIGILL and SIGFPE, si_addr contains the address of 
  176  *  faulting instruction.
  177  * Incase of SIGSEGV and SIGBUS, si_addr contains address of 
  178  *  faulting memory reference.
  179  * Incase of SIGCHLD, si_pid willhave child process ID,
  180  *  si_status will contain exit value or signal.
  181  *  si_uid contains real user ID of the process that sent the signal
  182  */
  183 
  184 /* Values for si_code */
  185 
  186 /* Codes for SIGILL */
  187 #define ILL_NOOP        0       /* if only I knew... */
  188 #define ILL_ILLOPC      1       /* illegal opcode */
  189 #define ILL_ILLTRP      2       /* illegal trap */
  190 #define ILL_PRVOPC      3       /* privileged opcode */
  191 
  192 /* Codes for SIGFPE */
  193 #define FPE_NOOP        0       /* if only I knew... */
  194 #define FPE_FLTDIV      1       /* floating point divide by zero */
  195 #define FPE_FLTOVF      2       /* floating point overflow */
  196 #define FPE_FLTUND      3       /* floating point underflow */
  197 #define FPE_FLTRES      4       /* floating point inexact result */
  198 #define FPE_FLTINV      5       /* invalid floating point operation */
  199 
  200 /* Codes for SIGSEGV */
  201 #define SEGV_NOOP       0       /* if only I knew... */
  202 #define SEGV_MAPERR     1       /* address not mapped to object */
  203 #define SEGV_ACCERR     2       /* invalid permissions for mapped to object */
  204 
  205 /* Codes for SIGBUS */
  206 #define BUS_NOOP        0       /* if only I knew... */
  207 #define BUS_ADRALN      1       /* invalid address alignment */
  208 
  209 /* Codes for SIGCHLD */
  210 #define CLD_NOOP        0       /* if only I knew... */
  211 #define CLD_EXITED      1       /* child has exited */
  212 #define CLD_KILLED      2       
  213         /* child has terminated abnormally and did not create a core file */
  214 #define CLD_DUMPED      3       
  215         /* child has terminated abnormally and create a core file */
  216 #define CLD_TRAPPED     4       /* traced child has trapped */
  217 #define CLD_STOPPED     5       /* child has stopped */
  218 #define CLD_CONTINUED   6       /* stopped child has continued */
  219 
  220 /* union for signal handlers */
  221 union __sigaction_u {
  222         void    (*__sa_handler)(int);
  223         void    (*__sa_sigaction)(int, struct __siginfo *,
  224                        void *);
  225 };
  226 
  227 /* Signal vector template for Kernel user boundary */
  228 struct  __sigaction {
  229         union __sigaction_u __sigaction_u;  /* signal handler */
  230         void    (*sa_tramp)(void *, int, int, siginfo_t *, void *);
  231         sigset_t sa_mask;               /* signal mask to apply */
  232         int     sa_flags;               /* see signal options below */
  233 };
  234 
  235 /*
  236  * Signal vector "template" used in sigaction call.
  237  */
  238 struct  sigaction {
  239         union __sigaction_u __sigaction_u;  /* signal handler */
  240         sigset_t sa_mask;               /* signal mask to apply */
  241         int     sa_flags;               /* see signal options below */
  242 };
  243 /* if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler. */
  244 #define sa_handler      __sigaction_u.__sa_handler
  245 #define sa_sigaction    __sigaction_u.__sa_sigaction
  246 
  247 
  248 #if  !defined(_POSIX_SOURCE)
  249 #define SA_ONSTACK      0x0001  /* take signal on signal stack */
  250 #define SA_RESTART      0x0002  /* restart system on signal return */
  251 #define SA_DISABLE      0x0004  /* disable taking signals on alternate stack */
  252 #define SA_RESETHAND    0x0004  /* reset to SIG_DFL when taking signal */
  253 #define SA_NODEFER      0x0010  /* don't mask the signal we're delivering */
  254 #define SA_NOCLDWAIT    0x0020  /* don't keep zombies around */
  255 #define SA_SIGINFO      0x0040  /* signal handler with SA_SIGINFO args */
  256 #define SA_USERTRAMP    0x0100  /* do not bounce off kernel's sigtramp */
  257 /* This will provide 64bit register set in a 32bit user address space */
  258 #define SA_64REGSET     0x0200  /* signal handler with SA_SIGINFO args with 64bit regs information */
  259 #endif
  260 #define SA_NOCLDSTOP    0x0008  /* do not generate SIGCHLD on child stop */
  261 
  262 /*
  263  * Flags for sigprocmask:
  264  */
  265 #define SIG_BLOCK       1       /* block specified signal set */
  266 #define SIG_UNBLOCK     2       /* unblock specified signal set */
  267 #define SIG_SETMASK     3       /* set specified signal set */
  268 
  269 /* POSIX 1003.1b required values. */
  270 #define SI_USER         0x10001
  271 #define SI_QUEUE        0x10002
  272 #define SI_TIMER        0x10003
  273 #define SI_ASYNCIO      0x10004
  274 #define SI_MESGQ        0x10005
  275 
  276 #if !defined(_POSIX_SOURCE)
  277 #include <sys/cdefs.h>
  278 typedef void (*sig_t) __P((int));       /* type of signal function */
  279 
  280 /*
  281  * Structure used in sigaltstack call.
  282  */
  283 struct  sigaltstack {
  284         char    *ss_sp;         /* signal stack base */
  285         int     ss_size;                /* signal stack length */
  286         int     ss_flags;               /* SA_DISABLE and/or SA_ONSTACK */
  287 };
  288 
  289 typedef struct  sigaltstack stack_t;
  290 
  291 #define SS_ONSTACK      0x0001  /* take signal on signal stack */
  292 #define SS_DISABLE      0x0004  /* disable taking signals on alternate stack */
  293 #define MINSIGSTKSZ     32768   /* (32K)minimum allowable stack */
  294 #define SIGSTKSZ        131072  /* (128K)recommended stack size */
  295 
  296 /*
  297  * 4.3 compatibility:
  298  * Signal vector "template" used in sigvec call.
  299  */
  300 struct  sigvec {
  301         void    (*sv_handler)(int);     /* signal handler */
  302         int     sv_mask;                /* signal mask to apply */
  303         int     sv_flags;               /* see signal options below */
  304 };
  305 
  306 #define SV_ONSTACK      SA_ONSTACK
  307 #define SV_INTERRUPT    SA_RESTART      /* same bit, opposite sense */
  308 #define SV_RESETHAND    SA_RESETHAND
  309 #define SV_NODEFER      SA_NODEFER
  310 #define SV_NOCLDSTOP    SA_NOCLDSTOP
  311 #define SV_SIGINFO      SA_SIGINFO
  312 
  313 #define sv_onstack sv_flags     /* isn't compatibility wonderful! */
  314 
  315 /*
  316  * Structure used in sigstack call.
  317  */
  318 struct  sigstack {
  319         char    *ss_sp;                 /* signal stack pointer */
  320         int     ss_onstack;             /* current status */
  321 };
  322 
  323 /*
  324  * Macro for converting signal number to a mask suitable for
  325  * sigblock().
  326  */
  327 #define sigmask(m)      (1 << ((m)-1))
  328 
  329 #ifdef  KERNEL
  330 #ifdef __APPLE_API_PRIVATE
  331 /*
  332  *      signals delivered on a per-thread basis.
  333  */
  334 #define threadmask (sigmask(SIGILL)|sigmask(SIGTRAP)|\
  335                     sigmask(SIGIOT)|sigmask(SIGEMT)|\
  336                     sigmask(SIGFPE)|sigmask(SIGBUS)|\
  337                     sigmask(SIGSEGV)|sigmask(SIGSYS)|\
  338                     sigmask(SIGPIPE))
  339 #endif /* __APPLE_API_PRIVATE */
  340 #endif  /* KERNEL */
  341 
  342 #define BADSIG          SIG_ERR
  343 
  344 #endif  /* !_POSIX_SOURCE */
  345 #endif  /* !_ANSI_SOURCE */
  346 
  347 /*
  348  * For historical reasons; programs expect signal's return value to be
  349  * defined by <sys/signal.h>.
  350  */
  351 __BEGIN_DECLS
  352 void    (*signal __P((int, void (*) __P((int))))) __P((int));
  353 __END_DECLS
  354 #endif  /* !_SYS_SIGNAL_H_ */

Cache object: c6d71ebd20b198a14e3a3d9eb4cd1693


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