diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-i386/signal.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-i386/signal.h')
-rw-r--r-- | include/asm-i386/signal.h | 237 |
1 files changed, 237 insertions, 0 deletions
diff --git a/include/asm-i386/signal.h b/include/asm-i386/signal.h new file mode 100644 index 000000000000..7ef343b6812d --- /dev/null +++ b/include/asm-i386/signal.h | |||
@@ -0,0 +1,237 @@ | |||
1 | #ifndef _ASMi386_SIGNAL_H | ||
2 | #define _ASMi386_SIGNAL_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/linkage.h> | ||
6 | #include <linux/time.h> | ||
7 | #include <linux/compiler.h> | ||
8 | |||
9 | /* Avoid too many header ordering problems. */ | ||
10 | struct siginfo; | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | /* Most things should be clean enough to redefine this at will, if care | ||
14 | is taken to make libc match. */ | ||
15 | |||
16 | #define _NSIG 64 | ||
17 | #define _NSIG_BPW 32 | ||
18 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) | ||
19 | |||
20 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | ||
21 | |||
22 | typedef struct { | ||
23 | unsigned long sig[_NSIG_WORDS]; | ||
24 | } sigset_t; | ||
25 | |||
26 | #else | ||
27 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
28 | |||
29 | #define NSIG 32 | ||
30 | typedef unsigned long sigset_t; | ||
31 | |||
32 | #endif /* __KERNEL__ */ | ||
33 | |||
34 | #define SIGHUP 1 | ||
35 | #define SIGINT 2 | ||
36 | #define SIGQUIT 3 | ||
37 | #define SIGILL 4 | ||
38 | #define SIGTRAP 5 | ||
39 | #define SIGABRT 6 | ||
40 | #define SIGIOT 6 | ||
41 | #define SIGBUS 7 | ||
42 | #define SIGFPE 8 | ||
43 | #define SIGKILL 9 | ||
44 | #define SIGUSR1 10 | ||
45 | #define SIGSEGV 11 | ||
46 | #define SIGUSR2 12 | ||
47 | #define SIGPIPE 13 | ||
48 | #define SIGALRM 14 | ||
49 | #define SIGTERM 15 | ||
50 | #define SIGSTKFLT 16 | ||
51 | #define SIGCHLD 17 | ||
52 | #define SIGCONT 18 | ||
53 | #define SIGSTOP 19 | ||
54 | #define SIGTSTP 20 | ||
55 | #define SIGTTIN 21 | ||
56 | #define SIGTTOU 22 | ||
57 | #define SIGURG 23 | ||
58 | #define SIGXCPU 24 | ||
59 | #define SIGXFSZ 25 | ||
60 | #define SIGVTALRM 26 | ||
61 | #define SIGPROF 27 | ||
62 | #define SIGWINCH 28 | ||
63 | #define SIGIO 29 | ||
64 | #define SIGPOLL SIGIO | ||
65 | /* | ||
66 | #define SIGLOST 29 | ||
67 | */ | ||
68 | #define SIGPWR 30 | ||
69 | #define SIGSYS 31 | ||
70 | #define SIGUNUSED 31 | ||
71 | |||
72 | /* These should not be considered constants from userland. */ | ||
73 | #define SIGRTMIN 32 | ||
74 | #define SIGRTMAX _NSIG | ||
75 | |||
76 | /* | ||
77 | * SA_FLAGS values: | ||
78 | * | ||
79 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
80 | * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the | ||
81 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
82 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
83 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
84 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
85 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
86 | * | ||
87 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
88 | * Unix names RESETHAND and NODEFER respectively. | ||
89 | */ | ||
90 | #define SA_NOCLDSTOP 0x00000001u | ||
91 | #define SA_NOCLDWAIT 0x00000002u | ||
92 | #define SA_SIGINFO 0x00000004u | ||
93 | #define SA_ONSTACK 0x08000000u | ||
94 | #define SA_RESTART 0x10000000u | ||
95 | #define SA_NODEFER 0x40000000u | ||
96 | #define SA_RESETHAND 0x80000000u | ||
97 | |||
98 | #define SA_NOMASK SA_NODEFER | ||
99 | #define SA_ONESHOT SA_RESETHAND | ||
100 | #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ | ||
101 | |||
102 | #define SA_RESTORER 0x04000000 | ||
103 | |||
104 | /* | ||
105 | * sigaltstack controls | ||
106 | */ | ||
107 | #define SS_ONSTACK 1 | ||
108 | #define SS_DISABLE 2 | ||
109 | |||
110 | #define MINSIGSTKSZ 2048 | ||
111 | #define SIGSTKSZ 8192 | ||
112 | |||
113 | #ifdef __KERNEL__ | ||
114 | |||
115 | /* | ||
116 | * These values of sa_flags are used only by the kernel as part of the | ||
117 | * irq handling routines. | ||
118 | * | ||
119 | * SA_INTERRUPT is also used by the irq handling routines. | ||
120 | * SA_SHIRQ is for shared interrupt support on PCI and EISA. | ||
121 | */ | ||
122 | #define SA_PROBE SA_ONESHOT | ||
123 | #define SA_SAMPLE_RANDOM SA_RESTART | ||
124 | #define SA_SHIRQ 0x04000000 | ||
125 | #endif | ||
126 | |||
127 | #define SIG_BLOCK 0 /* for blocking signals */ | ||
128 | #define SIG_UNBLOCK 1 /* for unblocking signals */ | ||
129 | #define SIG_SETMASK 2 /* for setting the signal mask */ | ||
130 | |||
131 | /* Type of a signal handler. */ | ||
132 | typedef void __signalfn_t(int); | ||
133 | typedef __signalfn_t __user *__sighandler_t; | ||
134 | |||
135 | typedef void __restorefn_t(void); | ||
136 | typedef __restorefn_t __user *__sigrestore_t; | ||
137 | |||
138 | #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ | ||
139 | #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ | ||
140 | #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ | ||
141 | |||
142 | #ifdef __KERNEL__ | ||
143 | struct old_sigaction { | ||
144 | __sighandler_t sa_handler; | ||
145 | old_sigset_t sa_mask; | ||
146 | unsigned long sa_flags; | ||
147 | __sigrestore_t sa_restorer; | ||
148 | }; | ||
149 | |||
150 | struct sigaction { | ||
151 | __sighandler_t sa_handler; | ||
152 | unsigned long sa_flags; | ||
153 | __sigrestore_t sa_restorer; | ||
154 | sigset_t sa_mask; /* mask last for extensibility */ | ||
155 | }; | ||
156 | |||
157 | struct k_sigaction { | ||
158 | struct sigaction sa; | ||
159 | }; | ||
160 | #else | ||
161 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
162 | |||
163 | struct sigaction { | ||
164 | union { | ||
165 | __sighandler_t _sa_handler; | ||
166 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
167 | } _u; | ||
168 | sigset_t sa_mask; | ||
169 | unsigned long sa_flags; | ||
170 | void (*sa_restorer)(void); | ||
171 | }; | ||
172 | |||
173 | #define sa_handler _u._sa_handler | ||
174 | #define sa_sigaction _u._sa_sigaction | ||
175 | |||
176 | #endif /* __KERNEL__ */ | ||
177 | |||
178 | typedef struct sigaltstack { | ||
179 | void __user *ss_sp; | ||
180 | int ss_flags; | ||
181 | size_t ss_size; | ||
182 | } stack_t; | ||
183 | |||
184 | #ifdef __KERNEL__ | ||
185 | #include <asm/sigcontext.h> | ||
186 | |||
187 | #define __HAVE_ARCH_SIG_BITOPS | ||
188 | |||
189 | static __inline__ void sigaddset(sigset_t *set, int _sig) | ||
190 | { | ||
191 | __asm__("btsl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); | ||
192 | } | ||
193 | |||
194 | static __inline__ void sigdelset(sigset_t *set, int _sig) | ||
195 | { | ||
196 | __asm__("btrl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); | ||
197 | } | ||
198 | |||
199 | static __inline__ int __const_sigismember(sigset_t *set, int _sig) | ||
200 | { | ||
201 | unsigned long sig = _sig - 1; | ||
202 | return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); | ||
203 | } | ||
204 | |||
205 | static __inline__ int __gen_sigismember(sigset_t *set, int _sig) | ||
206 | { | ||
207 | int ret; | ||
208 | __asm__("btl %2,%1\n\tsbbl %0,%0" | ||
209 | : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc"); | ||
210 | return ret; | ||
211 | } | ||
212 | |||
213 | #define sigismember(set,sig) \ | ||
214 | (__builtin_constant_p(sig) ? \ | ||
215 | __const_sigismember((set),(sig)) : \ | ||
216 | __gen_sigismember((set),(sig))) | ||
217 | |||
218 | static __inline__ int sigfindinword(unsigned long word) | ||
219 | { | ||
220 | __asm__("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc"); | ||
221 | return word; | ||
222 | } | ||
223 | |||
224 | struct pt_regs; | ||
225 | extern int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); | ||
226 | |||
227 | #define ptrace_signal_deliver(regs, cookie) \ | ||
228 | do { \ | ||
229 | if (current->ptrace & PT_DTRACE) { \ | ||
230 | current->ptrace &= ~PT_DTRACE; \ | ||
231 | (regs)->eflags &= ~TF_MASK; \ | ||
232 | } \ | ||
233 | } while (0) | ||
234 | |||
235 | #endif /* __KERNEL__ */ | ||
236 | |||
237 | #endif | ||