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