Annotation of kernel/bsd/sys/signal.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     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.4 (Berkeley) 5/4/95
                     64:  */
                     65: 
                     66: #ifndef        _SYS_SIGNAL_H_
                     67: #define        _SYS_SIGNAL_H_
                     68: 
                     69: #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
                     70: #define NSIG   32              /* counting 0; could be 33 (mask is 1-32) */
                     71: #endif
                     72: 
                     73: #include <machine/signal.h>    /* sigcontext; codes for SIGILL, SIGFPE */
                     74: 
                     75: #define        SIGHUP  1       /* hangup */
                     76: #define        SIGINT  2       /* interrupt */
                     77: #define        SIGQUIT 3       /* quit */
                     78: #define        SIGILL  4       /* illegal instruction (not reset when caught) */
                     79: #if  !defined(_POSIX_SOURCE)
                     80: #define        SIGTRAP 5       /* trace trap (not reset when caught) */
                     81: #endif
                     82: #define        SIGABRT 6       /* abort() */
                     83: #if  !defined(_POSIX_SOURCE)
                     84: #define        SIGIOT  SIGABRT /* compatibility */
                     85: #define        SIGEMT  7       /* EMT instruction */
                     86: #endif
                     87: #define        SIGFPE  8       /* floating point exception */
                     88: #define        SIGKILL 9       /* kill (cannot be caught or ignored) */
                     89: #if  !defined(_POSIX_SOURCE)
                     90: #define        SIGBUS  10      /* bus error */
                     91: #endif
                     92: #define        SIGSEGV 11      /* segmentation violation */
                     93: #if  !defined(_POSIX_SOURCE)
                     94: #define        SIGSYS  12      /* bad argument to system call */
                     95: #endif
                     96: #define        SIGPIPE 13      /* write on a pipe with no one to read it */
                     97: #define        SIGALRM 14      /* alarm clock */
                     98: #define        SIGTERM 15      /* software termination signal from kill */
                     99: #if  !defined(_POSIX_SOURCE)
                    100: #define        SIGURG  16      /* urgent condition on IO channel */
                    101: #endif
                    102: #define        SIGSTOP 17      /* sendable stop signal not from tty */
                    103: #define        SIGTSTP 18      /* stop signal from tty */
                    104: #define        SIGCONT 19      /* continue a stopped process */
                    105: #define        SIGCHLD 20      /* to parent on child stop or exit */
                    106: #define        SIGTTIN 21      /* to readers pgrp upon background tty read */
                    107: #define        SIGTTOU 22      /* like TTIN for output if (tp->t_local&LTOSTOP) */
                    108: #if  !defined(_POSIX_SOURCE)
                    109: #define        SIGIO   23      /* input/output possible signal */
                    110: #define        SIGXCPU 24      /* exceeded CPU time limit */
                    111: #define        SIGXFSZ 25      /* exceeded file size limit */
                    112: #define        SIGVTALRM 26    /* virtual time alarm */
                    113: #define        SIGPROF 27      /* profiling time alarm */
                    114: #define SIGWINCH 28    /* window size changes */
                    115: #define SIGINFO        29      /* information request */
                    116: #endif
                    117: #define SIGUSR1 30     /* user defined signal 1 */
                    118: #define SIGUSR2 31     /* user defined signal 2 */
                    119: 
                    120: #if defined(_ANSI_SOURCE) || defined(__cplusplus)
                    121: /*
                    122:  * Language spec sez we must list exactly one parameter, even though we
                    123:  * actually supply three.  Ugh!
                    124:  */
                    125: #define        SIG_DFL         (void (*)(int))0
                    126: #define        SIG_IGN         (void (*)(int))1
                    127: #define        SIG_ERR         (void (*)(int))-1
                    128: #else
                    129: #define        SIG_DFL         (void (*)())0
                    130: #define        SIG_IGN         (void (*)())1
                    131: #define        SIG_ERR         (void (*)())-1
                    132: #endif
                    133: 
                    134: #ifndef _ANSI_SOURCE
                    135: typedef unsigned int sigset_t;
                    136: 
                    137: /*
                    138:  * Signal vector "template" used in sigaction call.
                    139:  */
                    140: struct sigaction {
                    141:        void    (*sa_handler)();        /* signal handler */
                    142:        sigset_t sa_mask;               /* signal mask to apply */
                    143:        int     sa_flags;               /* see signal options below */
                    144: };
                    145: #if  !defined(_POSIX_SOURCE)
                    146: #define SA_ONSTACK     0x0001  /* take signal on signal stack */
                    147: #define SA_RESTART     0x0002  /* restart system on signal return */
                    148: #define        SA_DISABLE      0x0004  /* disable taking signals on alternate stack */
                    149: #define        SA_USERTRAMP    0x0100  /* do not bounce off kernel's sigtramp */
                    150: #endif
                    151: #define SA_NOCLDSTOP   0x0008  /* do not generate SIGCHLD on child stop */
                    152: 
                    153: /*
                    154:  * Flags for sigprocmask:
                    155:  */
                    156: #define        SIG_BLOCK       1       /* block specified signal set */
                    157: #define        SIG_UNBLOCK     2       /* unblock specified signal set */
                    158: #define        SIG_SETMASK     3       /* set specified signal set */
                    159: 
                    160: #if !defined(_POSIX_SOURCE)
                    161: #include <sys/cdefs.h>
                    162: typedef        void (*sig_t) __P((int));       /* type of signal function */
                    163: 
                    164: /*
                    165:  * Structure used in sigaltstack call.
                    166:  */
                    167: struct sigaltstack {
                    168:        char    *ss_sp;         /* signal stack base */
                    169:        int     ss_size;                /* signal stack length */
                    170:        int     ss_flags;               /* SA_DISABLE and/or SA_ONSTACK */
                    171: };
                    172: #define        MINSIGSTKSZ     8192                    /* minimum allowable stack */
                    173: #define        SIGSTKSZ        (MINSIGSTKSZ + 32768)   /* recommended stack size */
                    174: 
                    175: /*
                    176:  * 4.3 compatibility:
                    177:  * Signal vector "template" used in sigvec call.
                    178:  */
                    179: struct sigvec {
                    180:        void    (*sv_handler)();        /* signal handler */
                    181:        int     sv_mask;                /* signal mask to apply */
                    182:        int     sv_flags;               /* see signal options below */
                    183: };
                    184: 
                    185: #define SV_ONSTACK     SA_ONSTACK
                    186: #define SV_INTERRUPT   SA_RESTART      /* same bit, opposite sense */
                    187: #define sv_onstack sv_flags    /* isn't compatibility wonderful! */
                    188: 
                    189: /*
                    190:  * Structure used in sigstack call.
                    191:  */
                    192: struct sigstack {
                    193:        char    *ss_sp;                 /* signal stack pointer */
                    194:        int     ss_onstack;             /* current status */
                    195: };
                    196: 
                    197: /*
                    198:  * Macro for converting signal number to a mask suitable for
                    199:  * sigblock().
                    200:  */
                    201: #define sigmask(m)     (1 << ((m)-1))
                    202: 
                    203: #ifdef _KERNEL
                    204:                /*
                    205:                 *      signals delivered on a per-thread basis.
                    206:                 */
                    207:                #define threadmask (sigmask(SIGILL)|sigmask(SIGTRAP)|\
                    208:                                    sigmask(SIGIOT)|sigmask(SIGEMT)|\
                    209:                                    sigmask(SIGFPE)|sigmask(SIGBUS)|\
                    210:                                    sigmask(SIGSEGV)|sigmask(SIGSYS)|\
                    211:                                    sigmask(SIGPIPE))
                    212: #endif /* _KERNEL */
                    213: 
                    214: #define        BADSIG          SIG_ERR
                    215: 
                    216: #endif /* !_POSIX_SOURCE */
                    217: #endif /* !_ANSI_SOURCE */
                    218: 
                    219: /*
                    220:  * For historical reasons; programs expect signal's return value to be
                    221:  * defined by <sys/signal.h>.
                    222:  */
                    223: __BEGIN_DECLS
                    224: void   (*signal __P((int, void (*) __P((int))))) __P((int));
                    225: __END_DECLS
                    226: #endif /* !_SYS_SIGNAL_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.