Annotation of sys/sys/signal.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: signal.h,v 1.19 2006/01/08 14:20:16 millert Exp $ */
! 2: /* $NetBSD: signal.h,v 1.21 1996/02/09 18:25:32 christos Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1982, 1986, 1989, 1991, 1993
! 6: * The Regents of the University of California. All rights reserved.
! 7: * (c) UNIX System Laboratories, Inc.
! 8: * All or some portions of this file are derived from material licensed
! 9: * to the University of California by American Telephone and Telegraph
! 10: * Co. or Unix System Laboratories, Inc. and are reproduced herein with
! 11: * the permission of UNIX System Laboratories, Inc.
! 12: *
! 13: * Redistribution and use in source and binary forms, with or without
! 14: * modification, are permitted provided that the following conditions
! 15: * are met:
! 16: * 1. Redistributions of source code must retain the above copyright
! 17: * notice, this list of conditions and the following disclaimer.
! 18: * 2. Redistributions in binary form must reproduce the above copyright
! 19: * notice, this list of conditions and the following disclaimer in the
! 20: * documentation and/or other materials provided with the distribution.
! 21: * 3. Neither the name of the University nor the names of its contributors
! 22: * may be used to endorse or promote products derived from this software
! 23: * without specific prior written permission.
! 24: *
! 25: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 26: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 27: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 28: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 29: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 30: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 31: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 32: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 33: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 34: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 35: * SUCH DAMAGE.
! 36: *
! 37: * @(#)signal.h 8.2 (Berkeley) 1/21/94
! 38: */
! 39:
! 40: #ifndef _SYS_SIGNAL_H_
! 41: #define _SYS_SIGNAL_H_
! 42:
! 43: #include <sys/cdefs.h>
! 44: #include <machine/signal.h> /* sigcontext; codes for SIGILL, SIGFPE */
! 45:
! 46: #define _NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
! 47:
! 48: #if __BSD_VISIBLE
! 49: #define NSIG _NSIG
! 50: #endif
! 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: #if __BSD_VISIBLE
! 59: #define SIGIOT SIGABRT /* compatibility */
! 60: #define SIGEMT 7 /* EMT instruction */
! 61: #endif
! 62: #define SIGFPE 8 /* floating point exception */
! 63: #define SIGKILL 9 /* kill (cannot be caught or ignored) */
! 64: #define SIGBUS 10 /* bus error */
! 65: #define SIGSEGV 11 /* segmentation violation */
! 66: #define SIGSYS 12 /* bad argument to system call */
! 67: #define SIGPIPE 13 /* write on a pipe with no one to read it */
! 68: #define SIGALRM 14 /* alarm clock */
! 69: #define SIGTERM 15 /* software termination signal from kill */
! 70: #define SIGURG 16 /* urgent condition on IO channel */
! 71: #define SIGSTOP 17 /* sendable stop signal not from tty */
! 72: #define SIGTSTP 18 /* stop signal from tty */
! 73: #define SIGCONT 19 /* continue a stopped process */
! 74: #define SIGCHLD 20 /* to parent on child stop or exit */
! 75: #define SIGTTIN 21 /* to readers pgrp upon background tty read */
! 76: #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
! 77: #if __BSD_VISIBLE
! 78: #define SIGIO 23 /* input/output possible signal */
! 79: #endif
! 80: #define SIGXCPU 24 /* exceeded CPU time limit */
! 81: #define SIGXFSZ 25 /* exceeded file size limit */
! 82: #define SIGVTALRM 26 /* virtual time alarm */
! 83: #define SIGPROF 27 /* profiling time alarm */
! 84: #if __BSD_VISIBLE
! 85: #define SIGWINCH 28 /* window size changes */
! 86: #define SIGINFO 29 /* information request */
! 87: #endif
! 88: #define SIGUSR1 30 /* user defined signal 1 */
! 89: #define SIGUSR2 31 /* user defined signal 2 */
! 90:
! 91: /*
! 92: * Language spec says we must list exactly one parameter, even though we
! 93: * actually supply three. Ugh!
! 94: */
! 95: #define SIG_DFL (void (*)(int))0
! 96: #define SIG_IGN (void (*)(int))1
! 97: #define SIG_ERR (void (*)(int))-1
! 98:
! 99: #if __POSIX_VISIBLE || __XPG_VISIBLE
! 100: typedef unsigned int sigset_t;
! 101:
! 102: #include <sys/siginfo.h>
! 103:
! 104: /*
! 105: * Signal vector "template" used in sigaction call.
! 106: */
! 107: struct sigaction {
! 108: union { /* signal handler */
! 109: void (*__sa_handler)(int);
! 110: void (*__sa_sigaction)(int, siginfo_t *, void *);
! 111: } __sigaction_u;
! 112: sigset_t sa_mask; /* signal mask to apply */
! 113: int sa_flags; /* see signal options below */
! 114: };
! 115:
! 116: /* if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler. */
! 117: #define sa_handler __sigaction_u.__sa_handler
! 118: #define sa_sigaction __sigaction_u.__sa_sigaction
! 119:
! 120: #if __XPG_VISIBLE >= 500
! 121: #define SA_ONSTACK 0x0001 /* take signal on signal stack */
! 122: #define SA_RESTART 0x0002 /* restart system on signal return */
! 123: #define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */
! 124: #define SA_NODEFER 0x0010 /* don't mask the signal we're delivering */
! 125: #define SA_NOCLDWAIT 0x0020 /* don't create zombies (assign to pid 1) */
! 126: #ifdef COMPAT_SUNOS
! 127: #define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */
! 128: #endif
! 129: #endif /* __XPG_VISIBLE >= 500 */
! 130: #define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
! 131: #if __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE >= 500
! 132: #define SA_SIGINFO 0x0040 /* generate siginfo_t */
! 133: #endif
! 134:
! 135: /*
! 136: * Flags for sigprocmask:
! 137: */
! 138: #define SIG_BLOCK 1 /* block specified signal set */
! 139: #define SIG_UNBLOCK 2 /* unblock specified signal set */
! 140: #define SIG_SETMASK 3 /* set specified signal set */
! 141: #endif /* __POSIX_VISIBLE || __XPG_VISIBLE */
! 142:
! 143: #if __BSD_VISIBLE
! 144: typedef void (*sig_t)(int); /* type of signal function */
! 145:
! 146: /*
! 147: * 4.3 compatibility:
! 148: * Signal vector "template" used in sigvec call.
! 149: */
! 150: struct sigvec {
! 151: void (*sv_handler)(int); /* signal handler */
! 152: int sv_mask; /* signal mask to apply */
! 153: int sv_flags; /* see signal options below */
! 154: };
! 155: #define SV_ONSTACK SA_ONSTACK
! 156: #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */
! 157: #define SV_RESETHAND SA_RESETHAND
! 158: #define sv_onstack sv_flags /* isn't compatibility wonderful! */
! 159:
! 160: /*
! 161: * Macro for converting signal number to a mask suitable for
! 162: * sigblock().
! 163: */
! 164: #define sigmask(m) (1 << ((m)-1))
! 165:
! 166: #define BADSIG SIG_ERR
! 167:
! 168: #endif /* __BSD_VISIBLE */
! 169:
! 170: #if __BSD_VISIBLE || __XPG_VISIBLE >= 420
! 171: /*
! 172: * Structure used in sigstack call.
! 173: */
! 174: struct sigstack {
! 175: void *ss_sp; /* signal stack pointer */
! 176: int ss_onstack; /* current status */
! 177: };
! 178:
! 179: /*
! 180: * Structure used in sigaltstack call.
! 181: */
! 182: typedef struct sigaltstack {
! 183: void *ss_sp; /* signal stack base */
! 184: size_t ss_size; /* signal stack length */
! 185: int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
! 186: } stack_t;
! 187: #define SS_ONSTACK 0x0001 /* take signals on alternate stack */
! 188: #define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */
! 189: #define MINSIGSTKSZ 8192 /* minimum allowable stack */
! 190: #define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */
! 191:
! 192: #ifdef _KERNEL
! 193: struct osigaltstack {
! 194: void *ss_sp; /* signal stack base */
! 195: int ss_size; /* signal stack length */
! 196: int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
! 197: };
! 198: #endif
! 199:
! 200: typedef struct sigcontext ucontext_t;
! 201: #endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
! 202:
! 203: /*
! 204: * For historical reasons; programs expect signal's return value to be
! 205: * defined by <sys/signal.h>.
! 206: */
! 207: __BEGIN_DECLS
! 208: void (*signal(int, void (*)(int)))(int);
! 209: __END_DECLS
! 210: #endif /* !_SYS_SIGNAL_H_ */
CVSweb