Merge master.kernel.org:/home/rmk/linux-2.6-arm
[wrt350n-kernel.git] / include / asm-i386 / signal.h
blobc3e8adec5918695f0a11fe531c53a231bf876823
1 #ifndef _ASMi386_SIGNAL_H
2 #define _ASMi386_SIGNAL_H
4 #include <linux/types.h>
5 #include <linux/time.h>
6 #include <linux/compiler.h>
8 /* Avoid too many header ordering problems. */
9 struct siginfo;
11 #ifdef __KERNEL__
13 #include <linux/linkage.h>
15 /* Most things should be clean enough to redefine this at will, if care
16 is taken to make libc match. */
18 #define _NSIG 64
19 #define _NSIG_BPW 32
20 #define _NSIG_WORDS (_NSIG / _NSIG_BPW)
22 typedef unsigned long old_sigset_t; /* at least 32 bits */
24 typedef struct {
25 unsigned long sig[_NSIG_WORDS];
26 } sigset_t;
28 #else
29 /* Here we must cater to libcs that poke about in kernel headers. */
31 #define NSIG 32
32 typedef unsigned long sigset_t;
34 #endif /* __KERNEL__ */
36 #define SIGHUP 1
37 #define SIGINT 2
38 #define SIGQUIT 3
39 #define SIGILL 4
40 #define SIGTRAP 5
41 #define SIGABRT 6
42 #define SIGIOT 6
43 #define SIGBUS 7
44 #define SIGFPE 8
45 #define SIGKILL 9
46 #define SIGUSR1 10
47 #define SIGSEGV 11
48 #define SIGUSR2 12
49 #define SIGPIPE 13
50 #define SIGALRM 14
51 #define SIGTERM 15
52 #define SIGSTKFLT 16
53 #define SIGCHLD 17
54 #define SIGCONT 18
55 #define SIGSTOP 19
56 #define SIGTSTP 20
57 #define SIGTTIN 21
58 #define SIGTTOU 22
59 #define SIGURG 23
60 #define SIGXCPU 24
61 #define SIGXFSZ 25
62 #define SIGVTALRM 26
63 #define SIGPROF 27
64 #define SIGWINCH 28
65 #define SIGIO 29
66 #define SIGPOLL SIGIO
68 #define SIGLOST 29
70 #define SIGPWR 30
71 #define SIGSYS 31
72 #define SIGUNUSED 31
74 /* These should not be considered constants from userland. */
75 #define SIGRTMIN 32
76 #define SIGRTMAX _NSIG
79 * SA_FLAGS values:
81 * SA_ONSTACK indicates that a registered stack_t will be used.
82 * SA_RESTART flag to get restarting signals (which were the default long ago)
83 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
84 * SA_RESETHAND clears the handler when the signal is delivered.
85 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
86 * SA_NODEFER prevents the current signal from being masked in the handler.
88 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
89 * Unix names RESETHAND and NODEFER respectively.
91 #define SA_NOCLDSTOP 0x00000001u
92 #define SA_NOCLDWAIT 0x00000002u
93 #define SA_SIGINFO 0x00000004u
94 #define SA_ONSTACK 0x08000000u
95 #define SA_RESTART 0x10000000u
96 #define SA_NODEFER 0x40000000u
97 #define SA_RESETHAND 0x80000000u
99 #define SA_NOMASK SA_NODEFER
100 #define SA_ONESHOT SA_RESETHAND
102 #define SA_RESTORER 0x04000000
105 * sigaltstack controls
107 #define SS_ONSTACK 1
108 #define SS_DISABLE 2
110 #define MINSIGSTKSZ 2048
111 #define SIGSTKSZ 8192
113 #include <asm-generic/signal.h>
115 #ifdef __KERNEL__
116 struct old_sigaction {
117 __sighandler_t sa_handler;
118 old_sigset_t sa_mask;
119 unsigned long sa_flags;
120 __sigrestore_t sa_restorer;
123 struct sigaction {
124 __sighandler_t sa_handler;
125 unsigned long sa_flags;
126 __sigrestore_t sa_restorer;
127 sigset_t sa_mask; /* mask last for extensibility */
130 struct k_sigaction {
131 struct sigaction sa;
133 #else
134 /* Here we must cater to libcs that poke about in kernel headers. */
136 struct sigaction {
137 union {
138 __sighandler_t _sa_handler;
139 void (*_sa_sigaction)(int, struct siginfo *, void *);
140 } _u;
141 sigset_t sa_mask;
142 unsigned long sa_flags;
143 void (*sa_restorer)(void);
146 #define sa_handler _u._sa_handler
147 #define sa_sigaction _u._sa_sigaction
149 #endif /* __KERNEL__ */
151 typedef struct sigaltstack {
152 void __user *ss_sp;
153 int ss_flags;
154 size_t ss_size;
155 } stack_t;
157 #ifdef __KERNEL__
158 #include <asm/sigcontext.h>
160 #define __HAVE_ARCH_SIG_BITOPS
162 #define sigaddset(set,sig) \
163 (__builtin_constant_p(sig) ? \
164 __const_sigaddset((set),(sig)) : \
165 __gen_sigaddset((set),(sig)))
167 static __inline__ void __gen_sigaddset(sigset_t *set, int _sig)
169 __asm__("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
172 static __inline__ void __const_sigaddset(sigset_t *set, int _sig)
174 unsigned long sig = _sig - 1;
175 set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
178 #define sigdelset(set,sig) \
179 (__builtin_constant_p(sig) ? \
180 __const_sigdelset((set),(sig)) : \
181 __gen_sigdelset((set),(sig)))
184 static __inline__ void __gen_sigdelset(sigset_t *set, int _sig)
186 __asm__("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
189 static __inline__ void __const_sigdelset(sigset_t *set, int _sig)
191 unsigned long sig = _sig - 1;
192 set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
195 static __inline__ int __const_sigismember(sigset_t *set, int _sig)
197 unsigned long sig = _sig - 1;
198 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
201 static __inline__ int __gen_sigismember(sigset_t *set, int _sig)
203 int ret;
204 __asm__("btl %2,%1\n\tsbbl %0,%0"
205 : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
206 return ret;
209 #define sigismember(set,sig) \
210 (__builtin_constant_p(sig) ? \
211 __const_sigismember((set),(sig)) : \
212 __gen_sigismember((set),(sig)))
214 static __inline__ int sigfindinword(unsigned long word)
216 __asm__("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc");
217 return word;
220 struct pt_regs;
222 #define ptrace_signal_deliver(regs, cookie) \
223 do { \
224 if (current->ptrace & PT_DTRACE) { \
225 current->ptrace &= ~PT_DTRACE; \
226 (regs)->eflags &= ~TF_MASK; \
228 } while (0)
230 #endif /* __KERNEL__ */
232 #endif