Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is subject to the terms and conditions of the GNU General Public |
| 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. |
| 5 | * |
| 6 | * Copyright (C) 1995, 96, 97, 98, 99, 2003 by Ralf Baechle |
| 7 | * Copyright (C) 1999 Silicon Graphics, Inc. |
| 8 | */ |
| 9 | #ifndef _ASM_SIGNAL_H |
| 10 | #define _ASM_SIGNAL_H |
| 11 | |
| 12 | #include <linux/config.h> |
| 13 | #include <linux/types.h> |
| 14 | |
| 15 | #define _NSIG 128 |
| 16 | #define _NSIG_BPW (sizeof(unsigned long) * 8) |
| 17 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) |
| 18 | |
| 19 | typedef struct { |
| 20 | unsigned long sig[_NSIG_WORDS]; |
| 21 | } sigset_t; |
| 22 | |
| 23 | typedef unsigned long old_sigset_t; /* at least 32 bits */ |
| 24 | |
| 25 | #define SIGHUP 1 /* Hangup (POSIX). */ |
| 26 | #define SIGINT 2 /* Interrupt (ANSI). */ |
| 27 | #define SIGQUIT 3 /* Quit (POSIX). */ |
| 28 | #define SIGILL 4 /* Illegal instruction (ANSI). */ |
| 29 | #define SIGTRAP 5 /* Trace trap (POSIX). */ |
| 30 | #define SIGIOT 6 /* IOT trap (4.2 BSD). */ |
| 31 | #define SIGABRT SIGIOT /* Abort (ANSI). */ |
| 32 | #define SIGEMT 7 |
| 33 | #define SIGFPE 8 /* Floating-point exception (ANSI). */ |
| 34 | #define SIGKILL 9 /* Kill, unblockable (POSIX). */ |
| 35 | #define SIGBUS 10 /* BUS error (4.2 BSD). */ |
| 36 | #define SIGSEGV 11 /* Segmentation violation (ANSI). */ |
| 37 | #define SIGSYS 12 |
| 38 | #define SIGPIPE 13 /* Broken pipe (POSIX). */ |
| 39 | #define SIGALRM 14 /* Alarm clock (POSIX). */ |
| 40 | #define SIGTERM 15 /* Termination (ANSI). */ |
| 41 | #define SIGUSR1 16 /* User-defined signal 1 (POSIX). */ |
| 42 | #define SIGUSR2 17 /* User-defined signal 2 (POSIX). */ |
| 43 | #define SIGCHLD 18 /* Child status has changed (POSIX). */ |
| 44 | #define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ |
| 45 | #define SIGPWR 19 /* Power failure restart (System V). */ |
| 46 | #define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ |
| 47 | #define SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ |
| 48 | #define SIGIO 22 /* I/O now possible (4.2 BSD). */ |
| 49 | #define SIGPOLL SIGIO /* Pollable event occurred (System V). */ |
| 50 | #define SIGSTOP 23 /* Stop, unblockable (POSIX). */ |
| 51 | #define SIGTSTP 24 /* Keyboard stop (POSIX). */ |
| 52 | #define SIGCONT 25 /* Continue (POSIX). */ |
| 53 | #define SIGTTIN 26 /* Background read from tty (POSIX). */ |
| 54 | #define SIGTTOU 27 /* Background write to tty (POSIX). */ |
| 55 | #define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ |
| 56 | #define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ |
| 57 | #define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ |
| 58 | #define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ |
| 59 | |
| 60 | /* These should not be considered constants from userland. */ |
| 61 | #define SIGRTMIN 32 |
| 62 | #define SIGRTMAX _NSIG |
| 63 | |
| 64 | /* |
| 65 | * SA_FLAGS values: |
| 66 | * |
| 67 | * SA_ONSTACK indicates that a registered stack_t will be used. |
| 68 | * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the |
| 69 | * SA_RESTART flag to get restarting signals (which were the default long ago) |
| 70 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. |
| 71 | * SA_RESETHAND clears the handler when the signal is delivered. |
| 72 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. |
| 73 | * SA_NODEFER prevents the current signal from being masked in the handler. |
| 74 | * |
| 75 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single |
| 76 | * Unix names RESETHAND and NODEFER respectively. |
| 77 | */ |
| 78 | #define SA_ONSTACK 0x08000000 |
| 79 | #define SA_RESETHAND 0x80000000 |
| 80 | #define SA_RESTART 0x10000000 |
| 81 | #define SA_SIGINFO 0x00000008 |
| 82 | #define SA_NODEFER 0x40000000 |
| 83 | #define SA_NOCLDWAIT 0x00010000 |
| 84 | #define SA_NOCLDSTOP 0x00000001 |
| 85 | |
| 86 | #define SA_NOMASK SA_NODEFER |
| 87 | #define SA_ONESHOT SA_RESETHAND |
| 88 | #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ |
| 89 | |
| 90 | #define SA_RESTORER 0x04000000 /* Only for o32 */ |
| 91 | |
| 92 | /* |
| 93 | * sigaltstack controls |
| 94 | */ |
| 95 | #define SS_ONSTACK 1 |
| 96 | #define SS_DISABLE 2 |
| 97 | |
| 98 | #define MINSIGSTKSZ 2048 |
| 99 | #define SIGSTKSZ 8192 |
| 100 | |
Ralf Baechle | e50c0a8 | 2005-05-31 11:49:19 +0000 | [diff] [blame] | 101 | #ifdef __KERNEL__ |
| 102 | |
| 103 | /* |
| 104 | * These values of sa_flags are used only by the kernel as part of the |
| 105 | * irq handling routines. |
| 106 | * |
| 107 | * SA_INTERRUPT is also used by the irq handling routines. |
| 108 | * SA_SHIRQ flag is for shared interrupt support on PCI and EISA. |
| 109 | */ |
| 110 | #define SA_SAMPLE_RANDOM SA_RESTART |
| 111 | |
| 112 | #ifdef CONFIG_TRAD_SIGNALS |
| 113 | #define sig_uses_siginfo(ka) ((ka)->sa.sa_flags & SA_SIGINFO) |
| 114 | #else |
| 115 | #define sig_uses_siginfo(ka) (1) |
| 116 | #endif |
| 117 | |
| 118 | #endif /* __KERNEL__ */ |
| 119 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | #define SIG_BLOCK 1 /* for blocking signals */ |
| 121 | #define SIG_UNBLOCK 2 /* for unblocking signals */ |
| 122 | #define SIG_SETMASK 3 /* for setting the signal mask */ |
| 123 | #define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility: |
| 124 | set only the low 32 bit of the sigset. */ |
Ralf Baechle | e50c0a8 | 2005-05-31 11:49:19 +0000 | [diff] [blame] | 125 | |
| 126 | /* Type of a signal handler. */ |
| 127 | typedef void __signalfn_t(int); |
| 128 | typedef __signalfn_t __user *__sighandler_t; |
| 129 | |
| 130 | /* Fake signal functions */ |
| 131 | #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ |
| 132 | #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ |
| 133 | #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | |
| 135 | struct sigaction { |
| 136 | unsigned int sa_flags; |
| 137 | __sighandler_t sa_handler; |
| 138 | sigset_t sa_mask; |
| 139 | }; |
| 140 | |
| 141 | struct k_sigaction { |
| 142 | struct sigaction sa; |
| 143 | #ifdef CONFIG_BINFMT_IRIX |
| 144 | void (*sa_restorer)(void); |
| 145 | #endif |
| 146 | }; |
| 147 | |
| 148 | /* IRIX compatible stack_t */ |
| 149 | typedef struct sigaltstack { |
| 150 | void *ss_sp; |
| 151 | size_t ss_size; |
| 152 | int ss_flags; |
| 153 | } stack_t; |
| 154 | |
| 155 | #ifdef __KERNEL__ |
| 156 | #include <asm/sigcontext.h> |
| 157 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) |
| 159 | |
| 160 | #endif /* __KERNEL__ */ |
| 161 | |
| 162 | #endif /* _ASM_SIGNAL_H */ |