1 /* 2 * Copyright (c) 1982, 1986 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)signal.h 7.2 (Berkeley) 07/11/87 7 */ 8 9 #ifndef NSIG 10 #define NSIG 32 11 12 #include <machine/trap.h> /* codes for SIGILL, SIGFPE */ 13 14 #define SIGHUP 1 /* hangup */ 15 #define SIGINT 2 /* interrupt */ 16 #define SIGQUIT 3 /* quit */ 17 #define SIGILL 4 /* illegal instruction (not reset when caught) */ 18 #define SIGTRAP 5 /* trace trap (not reset when caught) */ 19 #define SIGIOT 6 /* IOT instruction */ 20 #define SIGABRT SIGIOT /* compatibility */ 21 #define SIGEMT 7 /* EMT instruction */ 22 #define SIGFPE 8 /* floating point exception */ 23 #define SIGKILL 9 /* kill (cannot be caught or ignored) */ 24 #define SIGBUS 10 /* bus error */ 25 #define SIGSEGV 11 /* segmentation violation */ 26 #define SIGSYS 12 /* bad argument to system call */ 27 #define SIGPIPE 13 /* write on a pipe with no one to read it */ 28 #define SIGALRM 14 /* alarm clock */ 29 #define SIGTERM 15 /* software termination signal from kill */ 30 #define SIGURG 16 /* urgent condition on IO channel */ 31 #define SIGSTOP 17 /* sendable stop signal not from tty */ 32 #define SIGTSTP 18 /* stop signal from tty */ 33 #define SIGCONT 19 /* continue a stopped process */ 34 #define SIGCHLD 20 /* to parent on child stop or exit */ 35 #define SIGCLD SIGCHLD /* compatibility */ 36 #define SIGTTIN 21 /* to readers pgrp upon background tty read */ 37 #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ 38 #define SIGIO 23 /* input/output possible signal */ 39 #define SIGXCPU 24 /* exceeded CPU time limit */ 40 #define SIGXFSZ 25 /* exceeded file size limit */ 41 #define SIGVTALRM 26 /* virtual time alarm */ 42 #define SIGPROF 27 /* profiling time alarm */ 43 #define SIGWINCH 28 /* window size changes */ 44 #define SIGUSR1 30 /* user defined signal 1 */ 45 #define SIGUSR2 31 /* user defined signal 2 */ 46 47 #ifndef KERNEL 48 int (*signal())(); 49 #endif 50 51 /* 52 * Signal vector "template" used in sigvec call. 53 */ 54 struct sigvec { 55 int (*sv_handler)(); /* signal handler */ 56 int sv_mask; /* signal mask to apply */ 57 int sv_flags; /* see signal options below */ 58 }; 59 #define SV_ONSTACK 0x0001 /* take signal on signal stack */ 60 #define SV_INTERRUPT 0x0002 /* do not restart system on signal return */ 61 #define sv_onstack sv_flags /* isn't compatibility wonderful! */ 62 63 /* 64 * Structure used in sigstack call. 65 */ 66 struct sigstack { 67 char *ss_sp; /* signal stack pointer */ 68 int ss_onstack; /* current status */ 69 }; 70 71 /* 72 * Information pushed on stack when a signal is delivered. 73 * This is used by the kernel to restore state following 74 * execution of the signal handler. It is also made available 75 * to the handler to allow it to properly restore state if 76 * a non-standard exit is performed. 77 */ 78 struct sigcontext { 79 int sc_onstack; /* sigstack state to restore */ 80 int sc_mask; /* signal mask to restore */ 81 int sc_sp; /* sp to restore */ 82 int sc_fp; /* fp to restore */ 83 int sc_ap; /* ap to restore */ 84 int sc_pc; /* pc to restore */ 85 int sc_ps; /* psl to restore */ 86 }; 87 88 #define BADSIG (int (*)())-1 89 #define SIG_DFL (int (*)())0 90 #define SIG_IGN (int (*)())1 91 92 #ifdef KERNEL 93 #define SIG_CATCH (int (*)())2 94 #define SIG_HOLD (int (*)())3 95 #endif 96 #endif 97 98 /* 99 * Macro for converting signal number to a mask suitable for 100 * sigblock(). 101 */ 102 #define sigmask(m) (1 << ((m)-1)) 103