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