1 /* 2 * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)signal.h 7.24 (Berkeley) 02/11/92 8 */ 9 10 #ifndef _SYS_SIGNAL_H_ 11 #define _SYS_SIGNAL_H_ 12 13 #define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */ 14 15 #ifndef _ANSI_SOURCE 16 #include <machine/signal.h> /* sigcontext; codes for SIGILL, SIGFPE */ 17 #endif 18 19 #define SIGHUP 1 /* hangup */ 20 #define SIGINT 2 /* interrupt */ 21 #define SIGQUIT 3 /* quit */ 22 #define SIGILL 4 /* illegal instruction (not reset when caught) */ 23 #ifndef _POSIX_SOURCE 24 #define SIGTRAP 5 /* trace trap (not reset when caught) */ 25 #endif 26 #define SIGABRT 6 /* abort() */ 27 #ifndef _POSIX_SOURCE 28 #define SIGIOT SIGABRT /* compatibility */ 29 #define SIGEMT 7 /* EMT instruction */ 30 #endif 31 #define SIGFPE 8 /* floating point exception */ 32 #define SIGKILL 9 /* kill (cannot be caught or ignored) */ 33 #ifndef _POSIX_SOURCE 34 #define SIGBUS 10 /* bus error */ 35 #endif 36 #define SIGSEGV 11 /* segmentation violation */ 37 #ifndef _POSIX_SOURCE 38 #define SIGSYS 12 /* bad argument to system call */ 39 #endif 40 #define SIGPIPE 13 /* write on a pipe with no one to read it */ 41 #define SIGALRM 14 /* alarm clock */ 42 #define SIGTERM 15 /* software termination signal from kill */ 43 #ifndef _POSIX_SOURCE 44 #define SIGURG 16 /* urgent condition on IO channel */ 45 #endif 46 #define SIGSTOP 17 /* sendable stop signal not from tty */ 47 #define SIGTSTP 18 /* stop signal from tty */ 48 #define SIGCONT 19 /* continue a stopped process */ 49 #define SIGCHLD 20 /* to parent on child stop or exit */ 50 #define SIGTTIN 21 /* to readers pgrp upon background tty read */ 51 #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ 52 #ifndef _POSIX_SOURCE 53 #define SIGIO 23 /* input/output possible signal */ 54 #define SIGXCPU 24 /* exceeded CPU time limit */ 55 #define SIGXFSZ 25 /* exceeded file size limit */ 56 #define SIGVTALRM 26 /* virtual time alarm */ 57 #define SIGPROF 27 /* profiling time alarm */ 58 #define SIGWINCH 28 /* window size changes */ 59 #define SIGINFO 29 /* information request */ 60 #endif 61 #define SIGUSR1 30 /* user defined signal 1 */ 62 #define SIGUSR2 31 /* user defined signal 2 */ 63 64 #define SIG_DFL (void (*)())0 65 #define SIG_IGN (void (*)())1 66 #define SIG_ERR (void (*)())-1 67 68 #ifndef _ANSI_SOURCE 69 typedef unsigned int sigset_t; 70 71 /* 72 * Signal vector "template" used in sigaction call. 73 */ 74 struct sigaction { 75 void (*sa_handler)(); /* signal handler */ 76 sigset_t sa_mask; /* signal mask to apply */ 77 int sa_flags; /* see signal options below */ 78 }; 79 #ifndef _POSIX_SOURCE 80 #define SA_ONSTACK 0x0001 /* take signal on signal stack */ 81 #define SA_RESTART 0x0002 /* restart system on signal return */ 82 #ifdef COMPAT_SUNOS 83 #define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */ 84 #endif 85 #endif 86 #define SA_NOCLDSTOP 0x0004 /* do not generate SIGCHLD on child stop */ 87 88 /* 89 * Flags for sigprocmask: 90 */ 91 #define SIG_BLOCK 1 /* block specified signal set */ 92 #define SIG_UNBLOCK 2 /* unblock specified signal set */ 93 #define SIG_SETMASK 3 /* set specified signal set */ 94 95 #ifndef _POSIX_SOURCE 96 #ifndef KERNEL 97 #include <sys/cdefs.h> 98 #endif 99 typedef void (*sig_t) __P((int)); /* type of signal function */ 100 101 /* 102 * 4.3 compatibility: 103 * Signal vector "template" used in sigvec call. 104 */ 105 struct sigvec { 106 void (*sv_handler)(); /* signal handler */ 107 int sv_mask; /* signal mask to apply */ 108 int sv_flags; /* see signal options below */ 109 }; 110 111 #define SV_ONSTACK SA_ONSTACK 112 #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */ 113 #define sv_onstack sv_flags /* isn't compatibility wonderful! */ 114 115 /* 116 * Structure used in sigaltstack call. 117 */ 118 struct sigaltstack { 119 char *ss_base; /* signal stack base */ 120 int ss_len; /* signal stack length */ 121 int ss_onstack; /* current status */ 122 }; 123 124 /* 125 * Structure used in sigstack call. 126 */ 127 struct sigstack { 128 char *ss_sp; /* signal stack pointer */ 129 int ss_onstack; /* current status */ 130 }; 131 132 /* 133 * Macro for converting signal number to a mask suitable for 134 * sigblock(). 135 */ 136 #define sigmask(m) (1 << ((m)-1)) 137 138 #define BADSIG SIG_ERR 139 140 #endif /* !_POSIX_SOURCE */ 141 #endif /* !_ANSI_SOURCE */ 142 143 /* 144 * For historical reasons; programs expect signal's return value to be 145 * defined by <sys/signal.h>. 146 */ 147 __BEGIN_DECLS 148 void (*signal __P((int, void (*) __P((int))))) __P((int)); 149 __END_DECLS 150 #endif /* !_SYS_SIGNAL_H_ */ 151