1 #ifndef _ASMi386_SIGNAL_H
2 #define _ASMi386_SIGNAL_H
4 #include <linux/types.h>
5 #include <linux/linkage.h>
6 #include <linux/time.h>
7 #include <linux/compiler.h>
9 /* Avoid too many header ordering problems. */
13 /* Most things should be clean enough to redefine this at will, if care
14 is taken to make libc match. */
18 #define _NSIG_WORDS (_NSIG / _NSIG_BPW)
20 typedef unsigned long old_sigset_t
; /* at least 32 bits */
23 unsigned long sig
[_NSIG_WORDS
];
27 /* Here we must cater to libcs that poke about in kernel headers. */
30 typedef unsigned long sigset_t
;
32 #endif /* __KERNEL__ */
72 /* These should not be considered constants from userland. */
74 #define SIGRTMAX _NSIG
79 * SA_ONSTACK indicates that a registered stack_t will be used.
80 * SA_RESTART flag to get restarting signals (which were the default long ago)
81 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
82 * SA_RESETHAND clears the handler when the signal is delivered.
83 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
84 * SA_NODEFER prevents the current signal from being masked in the handler.
86 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
87 * Unix names RESETHAND and NODEFER respectively.
89 #define SA_NOCLDSTOP 0x00000001u
90 #define SA_NOCLDWAIT 0x00000002u
91 #define SA_SIGINFO 0x00000004u
92 #define SA_ONSTACK 0x08000000u
93 #define SA_RESTART 0x10000000u
94 #define SA_NODEFER 0x40000000u
95 #define SA_RESETHAND 0x80000000u
97 #define SA_NOMASK SA_NODEFER
98 #define SA_ONESHOT SA_RESETHAND
100 #define SA_RESTORER 0x04000000
103 * sigaltstack controls
108 #define MINSIGSTKSZ 2048
109 #define SIGSTKSZ 8192
111 #include <asm-generic/signal.h>
114 struct old_sigaction
{
115 __sighandler_t sa_handler
;
116 old_sigset_t sa_mask
;
117 unsigned long sa_flags
;
118 __sigrestore_t sa_restorer
;
122 __sighandler_t sa_handler
;
123 unsigned long sa_flags
;
124 __sigrestore_t sa_restorer
;
125 sigset_t sa_mask
; /* mask last for extensibility */
132 /* Here we must cater to libcs that poke about in kernel headers. */
136 __sighandler_t _sa_handler
;
137 void (*_sa_sigaction
)(int, struct siginfo
*, void *);
140 unsigned long sa_flags
;
141 void (*sa_restorer
)(void);
144 #define sa_handler _u._sa_handler
145 #define sa_sigaction _u._sa_sigaction
147 #endif /* __KERNEL__ */
149 typedef struct sigaltstack
{
156 #include <asm/sigcontext.h>
158 #define __HAVE_ARCH_SIG_BITOPS
160 #define sigaddset(set,sig) \
161 (__builtin_constant_p(sig) ? \
162 __const_sigaddset((set),(sig)) : \
163 __gen_sigaddset((set),(sig)))
165 static __inline__
void __gen_sigaddset(sigset_t
*set
, int _sig
)
167 __asm__("btsl %1,%0" : "+m"(*set
) : "Ir"(_sig
- 1) : "cc");
170 static __inline__
void __const_sigaddset(sigset_t
*set
, int _sig
)
172 unsigned long sig
= _sig
- 1;
173 set
->sig
[sig
/ _NSIG_BPW
] |= 1 << (sig
% _NSIG_BPW
);
176 #define sigdelset(set,sig) \
177 (__builtin_constant_p(sig) ? \
178 __const_sigdelset((set),(sig)) : \
179 __gen_sigdelset((set),(sig)))
182 static __inline__
void __gen_sigdelset(sigset_t
*set
, int _sig
)
184 __asm__("btrl %1,%0" : "+m"(*set
) : "Ir"(_sig
- 1) : "cc");
187 static __inline__
void __const_sigdelset(sigset_t
*set
, int _sig
)
189 unsigned long sig
= _sig
- 1;
190 set
->sig
[sig
/ _NSIG_BPW
] &= ~(1 << (sig
% _NSIG_BPW
));
193 static __inline__
int __const_sigismember(sigset_t
*set
, int _sig
)
195 unsigned long sig
= _sig
- 1;
196 return 1 & (set
->sig
[sig
/ _NSIG_BPW
] >> (sig
% _NSIG_BPW
));
199 static __inline__
int __gen_sigismember(sigset_t
*set
, int _sig
)
202 __asm__("btl %2,%1\n\tsbbl %0,%0"
203 : "=r"(ret
) : "m"(*set
), "Ir"(_sig
-1) : "cc");
207 #define sigismember(set,sig) \
208 (__builtin_constant_p(sig) ? \
209 __const_sigismember((set),(sig)) : \
210 __gen_sigismember((set),(sig)))
212 static __inline__
int sigfindinword(unsigned long word
)
214 __asm__("bsfl %1,%0" : "=r"(word
) : "rm"(word
) : "cc");
220 #define ptrace_signal_deliver(regs, cookie) \
222 if (current->ptrace & PT_DTRACE) { \
223 current->ptrace &= ~PT_DTRACE; \
224 (regs)->eflags &= ~TF_MASK; \
228 #endif /* __KERNEL__ */