Annotation of XNU/bsd/sys/signal.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * The contents of this file constitute Original Code as defined in and
        !             7:  * are subject to the Apple Public Source License Version 1.1 (the
        !             8:  * "License").  You may not use this file except in compliance with the
        !             9:  * License.  Please obtain a copy of the License at
        !            10:  * http://www.apple.com/publicsource and read it before using this file.
        !            11:  * 
        !            12:  * This Original Code and all software distributed under the License are
        !            13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            17:  * License for the specific language governing rights and limitations
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
        !            23: /*
        !            24:  * Copyright (c) 1982, 1986, 1989, 1991, 1993
        !            25:  *     The Regents of the University of California.  All rights reserved.
        !            26:  * (c) UNIX System Laboratories, Inc.
        !            27:  * All or some portions of this file are derived from material licensed
        !            28:  * to the University of California by American Telephone and Telegraph
        !            29:  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
        !            30:  * the permission of UNIX System Laboratories, Inc.
        !            31:  *
        !            32:  * Redistribution and use in source and binary forms, with or without
        !            33:  * modification, are permitted provided that the following conditions
        !            34:  * are met:
        !            35:  * 1. Redistributions of source code must retain the above copyright
        !            36:  *    notice, this list of conditions and the following disclaimer.
        !            37:  * 2. Redistributions in binary form must reproduce the above copyright
        !            38:  *    notice, this list of conditions and the following disclaimer in the
        !            39:  *    documentation and/or other materials provided with the distribution.
        !            40:  * 3. All advertising materials mentioning features or use of this software
        !            41:  *    must display the following acknowledgement:
        !            42:  *     This product includes software developed by the University of
        !            43:  *     California, Berkeley and its contributors.
        !            44:  * 4. Neither the name of the University nor the names of its contributors
        !            45:  *    may be used to endorse or promote products derived from this software
        !            46:  *    without specific prior written permission.
        !            47:  *
        !            48:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        !            49:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            50:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            51:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            52:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            53:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            54:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            55:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            56:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            57:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            58:  * SUCH DAMAGE.
        !            59:  *
        !            60:  *     @(#)signal.h    8.2 (Berkeley) 1/21/94
        !            61:  */
        !            62: 
        !            63: #ifndef        _SYS_SIGNAL_H_
        !            64: #define        _SYS_SIGNAL_H_
        !            65: 
        !            66: #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
        !            67: #define NSIG   32              /* counting 0; could be 33 (mask is 1-32) */
        !            68: #endif
        !            69: 
        !            70: #include <machine/signal.h>    /* sigcontext; codes for SIGILL, SIGFPE */
        !            71: 
        !            72: #define        SIGHUP  1       /* hangup */
        !            73: #define        SIGINT  2       /* interrupt */
        !            74: #define        SIGQUIT 3       /* quit */
        !            75: #define        SIGILL  4       /* illegal instruction (not reset when caught) */
        !            76: #if  !defined(_POSIX_SOURCE)
        !            77: #define        SIGTRAP 5       /* trace trap (not reset when caught) */
        !            78: #endif
        !            79: #define        SIGABRT 6       /* abort() */
        !            80: #if  !defined(_POSIX_SOURCE)
        !            81: #define        SIGIOT  SIGABRT /* compatibility */
        !            82: #define        SIGEMT  7       /* EMT instruction */
        !            83: #endif
        !            84: #define        SIGFPE  8       /* floating point exception */
        !            85: #define        SIGKILL 9       /* kill (cannot be caught or ignored) */
        !            86: #if  !defined(_POSIX_SOURCE)
        !            87: #define        SIGBUS  10      /* bus error */
        !            88: #endif
        !            89: #define        SIGSEGV 11      /* segmentation violation */
        !            90: #if  !defined(_POSIX_SOURCE)
        !            91: #define        SIGSYS  12      /* bad argument to system call */
        !            92: #endif
        !            93: #define        SIGPIPE 13      /* write on a pipe with no one to read it */
        !            94: #define        SIGALRM 14      /* alarm clock */
        !            95: #define        SIGTERM 15      /* software termination signal from kill */
        !            96: #if  !defined(_POSIX_SOURCE)
        !            97: #define        SIGURG  16      /* urgent condition on IO channel */
        !            98: #endif
        !            99: #define        SIGSTOP 17      /* sendable stop signal not from tty */
        !           100: #define        SIGTSTP 18      /* stop signal from tty */
        !           101: #define        SIGCONT 19      /* continue a stopped process */
        !           102: #define        SIGCHLD 20      /* to parent on child stop or exit */
        !           103: #define        SIGTTIN 21      /* to readers pgrp upon background tty read */
        !           104: #define        SIGTTOU 22      /* like TTIN for output if (tp->t_local&LTOSTOP) */
        !           105: #if  !defined(_POSIX_SOURCE)
        !           106: #define        SIGIO   23      /* input/output possible signal */
        !           107: #define        SIGXCPU 24      /* exceeded CPU time limit */
        !           108: #define        SIGXFSZ 25      /* exceeded file size limit */
        !           109: #define        SIGVTALRM 26    /* virtual time alarm */
        !           110: #define        SIGPROF 27      /* profiling time alarm */
        !           111: #define SIGWINCH 28    /* window size changes */
        !           112: #define SIGINFO        29      /* information request */
        !           113: #endif
        !           114: #define SIGUSR1 30     /* user defined signal 1 */
        !           115: #define SIGUSR2 31     /* user defined signal 2 */
        !           116: 
        !           117: #if defined(_ANSI_SOURCE) || defined(__cplusplus)
        !           118: /*
        !           119:  * Language spec sez we must list exactly one parameter, even though we
        !           120:  * actually supply three.  Ugh!
        !           121:  */
        !           122: #define        SIG_DFL         (void (*)(int))0
        !           123: #define        SIG_IGN         (void (*)(int))1
        !           124: #define        SIG_ERR         (void (*)(int))-1
        !           125: #else
        !           126: #define        SIG_DFL         (void (*)())0
        !           127: #define        SIG_IGN         (void (*)())1
        !           128: #define        SIG_ERR         (void (*)())-1
        !           129: #endif
        !           130: 
        !           131: #ifndef _ANSI_SOURCE
        !           132: typedef unsigned int sigset_t;
        !           133: 
        !           134: /*
        !           135:  * Signal vector "template" used in sigaction call.
        !           136:  */
        !           137: struct sigaction {
        !           138:        void    (*sa_handler)();        /* signal handler */
        !           139:        sigset_t sa_mask;               /* signal mask to apply */
        !           140:        int     sa_flags;               /* see signal options below */
        !           141: };
        !           142: #if  !defined(_POSIX_SOURCE)
        !           143: #define SA_ONSTACK     0x0001  /* take signal on signal stack */
        !           144: #define SA_RESTART     0x0002  /* restart system on signal return */
        !           145: #define        SA_DISABLE      0x0004  /* disable taking signals on alternate stack */
        !           146: #define        SA_USERTRAMP    0x0100  /* do not bounce off kernel's sigtramp */
        !           147: #endif
        !           148: #define SA_NOCLDSTOP   0x0008  /* do not generate SIGCHLD on child stop */
        !           149: 
        !           150: /*
        !           151:  * Flags for sigprocmask:
        !           152:  */
        !           153: #define        SIG_BLOCK       1       /* block specified signal set */
        !           154: #define        SIG_UNBLOCK     2       /* unblock specified signal set */
        !           155: #define        SIG_SETMASK     3       /* set specified signal set */
        !           156: 
        !           157: #if !defined(_POSIX_SOURCE)
        !           158: #include <sys/cdefs.h>
        !           159: typedef        void (*sig_t) __P((int));       /* type of signal function */
        !           160: 
        !           161: /*
        !           162:  * Structure used in sigaltstack call.
        !           163:  */
        !           164: struct sigaltstack {
        !           165:        char    *ss_sp;         /* signal stack base */
        !           166:        int     ss_size;                /* signal stack length */
        !           167:        int     ss_flags;               /* SA_DISABLE and/or SA_ONSTACK */
        !           168: };
        !           169: #define        MINSIGSTKSZ     8192                    /* minimum allowable stack */
        !           170: #define        SIGSTKSZ        (MINSIGSTKSZ + 32768)   /* recommended stack size */
        !           171: 
        !           172: /*
        !           173:  * 4.3 compatibility:
        !           174:  * Signal vector "template" used in sigvec call.
        !           175:  */
        !           176: struct sigvec {
        !           177:        void    (*sv_handler)();        /* signal handler */
        !           178:        int     sv_mask;                /* signal mask to apply */
        !           179:        int     sv_flags;               /* see signal options below */
        !           180: };
        !           181: 
        !           182: #define SV_ONSTACK     SA_ONSTACK
        !           183: #define SV_INTERRUPT   SA_RESTART      /* same bit, opposite sense */
        !           184: #define sv_onstack sv_flags    /* isn't compatibility wonderful! */
        !           185: 
        !           186: /*
        !           187:  * Structure used in sigstack call.
        !           188:  */
        !           189: struct sigstack {
        !           190:        char    *ss_sp;                 /* signal stack pointer */
        !           191:        int     ss_onstack;             /* current status */
        !           192: };
        !           193: 
        !           194: /*
        !           195:  * Macro for converting signal number to a mask suitable for
        !           196:  * sigblock().
        !           197:  */
        !           198: #define sigmask(m)     (1 << ((m)-1))
        !           199: 
        !           200: #ifdef KERNEL
        !           201:                /*
        !           202:                 *      signals delivered on a per-thread basis.
        !           203:                 */
        !           204:                #define threadmask (sigmask(SIGILL)|sigmask(SIGTRAP)|\
        !           205:                                    sigmask(SIGIOT)|sigmask(SIGEMT)|\
        !           206:                                    sigmask(SIGFPE)|sigmask(SIGBUS)|\
        !           207:                                    sigmask(SIGSEGV)|sigmask(SIGSYS)|\
        !           208:                                    sigmask(SIGPIPE))
        !           209: #endif /* KERNEL */
        !           210: 
        !           211: #define        BADSIG          SIG_ERR
        !           212: 
        !           213: #endif /* !_POSIX_SOURCE */
        !           214: #endif /* !_ANSI_SOURCE */
        !           215: 
        !           216: /*
        !           217:  * For historical reasons; programs expect signal's return value to be
        !           218:  * defined by <sys/signal.h>.
        !           219:  */
        !           220: __BEGIN_DECLS
        !           221: void   (*signal __P((int, void (*) __P((int))))) __P((int));
        !           222: __END_DECLS
        !           223: #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.