1: /* 2: * Copyright (c) 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 1.2 (2.11BSD) 1997/8/28 7: */ 8: 9: #ifndef NSIG 10: #define NSIG 32 11: 12: #define SIGHUP 1 /* hangup */ 13: #define SIGINT 2 /* interrupt */ 14: #define SIGQUIT 3 /* quit */ 15: #define SIGILL 4 /* illegal instruction (not reset when caught) */ 16: #define ILL_RESAD_FAULT 0x0 /* reserved addressing fault */ 17: /* CHME, CHMS, CHMU are not yet given back to users reasonably */ 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: #define SIG_ERR (int (*)())-1 48: #define SIG_DFL (int (*)())0 49: #define SIG_IGN (int (*)())1 50: 51: #ifndef KERNEL 52: int (*signal())(); 53: #endif 54: 55: typedef unsigned long sigset_t; 56: 57: /* 58: * Signal vector "template" used in sigaction call. 59: */ 60: struct sigaction { 61: int (*sa_handler)(); /* signal handler */ 62: sigset_t sa_mask; /* signal mask to apply */ 63: int sa_flags; /* see signal options below */ 64: }; 65: 66: #define SA_ONSTACK 0x0001 /* take signal on signal stack */ 67: #define SA_RESTART 0x0002 /* restart system on signal return */ 68: #define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */ 69: #define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */ 70: 71: /* 72: * Flags for sigprocmask: 73: */ 74: #define SIG_BLOCK 1 /* block specified signal set */ 75: #define SIG_UNBLOCK 2 /* unblock specified signal set */ 76: #define SIG_SETMASK 3 /* set specified signal set */ 77: 78: typedef int (*sig_t)(); /* type of signal function */ 79: 80: /* 81: * Structure used in sigaltstack call. 82: */ 83: struct sigaltstack { 84: char *ss_base; /* signal stack base */ 85: int ss_size; /* signal stack length */ 86: int ss_flags; /* SA_DISABLE and/or SA_ONSTACK */ 87: }; 88: #define MINSIGSTKSZ 128 /* minimum allowable stack */ 89: #define SIGSTKSZ (MINSIGSTKSZ + 384) /* recommended stack size */ 90: 91: /* 92: * 4.3 compatibility: 93: * Signal vector "template" used in sigvec call. 94: */ 95: struct sigvec { 96: int (*sv_handler)(); /* signal handler */ 97: long sv_mask; /* signal mask to apply */ 98: int sv_flags; /* see signal options below */ 99: }; 100: #define SV_ONSTACK SA_ONSTACK /* take signal on signal stack */ 101: #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */ 102: #define sv_onstack sv_flags /* isn't compatibility wonderful! */ 103: 104: /* 105: * 4.3 compatibility: 106: * Structure used in sigstack call. 107: */ 108: struct sigstack { 109: char *ss_sp; /* signal stack pointer */ 110: int ss_onstack; /* current status */ 111: }; 112: 113: /* 114: * Information pushed on stack when a signal is delivered. 115: * This is used by the kernel to restore state following 116: * execution of the signal handler. It is also made available 117: * to the handler to allow it to properly restore state if 118: * a non-standard exit is performed. 119: */ 120: struct sigcontext { 121: int sc_onstack; /* sigstack state to restore */ 122: long sc_mask; /* signal mask to restore */ 123: int sc_sp; /* sp to restore */ 124: int sc_fp; /* fp to restore */ 125: int sc_r1; /* r1 to restore */ 126: int sc_r0; /* r0 to restore */ 127: int sc_pc; /* pc to restore */ 128: int sc_ps; /* psl to restore */ 129: int sc_ovno /* overlay to restore */ 130: }; 131: 132: /* 133: * Macro for converting signal number to a mask suitable for 134: * sigblock(). 135: */ 136: #define sigmask(m) (1L << ((m)-1)) 137: #define sigaddset(set, signo) (*(set) |= 1L << ((signo) - 1), 0) 138: #define sigdelset(set, signo) (*(set) &= ~(1L << ((signo) - 1)), 0) 139: #define sigemptyset(set) (*(set) = (sigset_t)0, (int)0) 140: #define sigfillset(set) (*(set) = ~(sigset_t)0, (int)0) 141: #define sigismember(set, signo) ((*(set) & (1L << ((signo) - 1))) != 0) 142: 143: #ifndef KERNEL 144: extern long sigblock(), sigsetmask(); 145: #define BADSIG SIG_ERR 146: #endif 147: 148: #endif /* NSIG */