1 #ifndef _ASM_X86_SIGNAL_H
2 #define _ASM_X86_SIGNAL_H
5 #include <linux/types.h>
6 #include <linux/time.h>
7 #include <linux/compiler.h>
9 /* Avoid too many header ordering problems. */
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. */
26 #define _NSIG_WORDS (_NSIG / _NSIG_BPW)
28 typedef unsigned long old_sigset_t
; /* at least 32 bits */
31 unsigned long sig
[_NSIG_WORDS
];
35 typedef sigset_t compat_sigset_t
;
39 /* Here we must cater to libcs that poke about in kernel headers. */
42 typedef unsigned long sigset_t
;
44 #endif /* __KERNEL__ */
45 #endif /* __ASSEMBLY__ */
85 /* These should not be considered constants from userland. */
87 #define SIGRTMAX _NSIG
92 * SA_ONSTACK indicates that a registered stack_t will be used.
93 * SA_RESTART flag to get restarting signals (which were the default long ago)
94 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
95 * SA_RESETHAND clears the handler when the signal is delivered.
96 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
97 * SA_NODEFER prevents the current signal from being masked in the handler.
99 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
100 * Unix names RESETHAND and NODEFER respectively.
102 #define SA_NOCLDSTOP 0x00000001u
103 #define SA_NOCLDWAIT 0x00000002u
104 #define SA_SIGINFO 0x00000004u
105 #define SA_ONSTACK 0x08000000u
106 #define SA_RESTART 0x10000000u
107 #define SA_NODEFER 0x40000000u
108 #define SA_RESETHAND 0x80000000u
110 #define SA_NOMASK SA_NODEFER
111 #define SA_ONESHOT SA_RESETHAND
113 #define SA_RESTORER 0x04000000
115 #define MINSIGSTKSZ 2048
116 #define SIGSTKSZ 8192
118 #include <asm-generic/signal-defs.h>
123 extern void do_notify_resume(struct pt_regs
*, void *, __u32
);
124 # endif /* __KERNEL__ */
128 struct old_sigaction
{
129 __sighandler_t sa_handler
;
130 old_sigset_t sa_mask
;
131 unsigned long sa_flags
;
132 __sigrestore_t sa_restorer
;
136 __sighandler_t sa_handler
;
137 unsigned long sa_flags
;
138 __sigrestore_t sa_restorer
;
139 sigset_t sa_mask
; /* mask last for extensibility */
146 # else /* __KERNEL__ */
147 /* Here we must cater to libcs that poke about in kernel headers. */
151 __sighandler_t _sa_handler
;
152 void (*_sa_sigaction
)(int, struct siginfo
*, void *);
155 unsigned long sa_flags
;
156 void (*sa_restorer
)(void);
159 #define sa_handler _u._sa_handler
160 #define sa_sigaction _u._sa_sigaction
162 # endif /* ! __KERNEL__ */
166 __sighandler_t sa_handler
;
167 unsigned long sa_flags
;
168 __sigrestore_t sa_restorer
;
169 sigset_t sa_mask
; /* mask last for extensibility */
176 #endif /* !__i386__ */
178 typedef struct sigaltstack
{
185 #include <asm/sigcontext.h>
189 #define __HAVE_ARCH_SIG_BITOPS
191 #define sigaddset(set,sig) \
192 (__builtin_constant_p(sig) \
193 ? __const_sigaddset((set), (sig)) \
194 : __gen_sigaddset((set), (sig)))
196 static inline void __gen_sigaddset(sigset_t
*set
, int _sig
)
198 asm("btsl %1,%0" : "+m"(*set
) : "Ir"(_sig
- 1) : "cc");
201 static inline void __const_sigaddset(sigset_t
*set
, int _sig
)
203 unsigned long sig
= _sig
- 1;
204 set
->sig
[sig
/ _NSIG_BPW
] |= 1 << (sig
% _NSIG_BPW
);
207 #define sigdelset(set, sig) \
208 (__builtin_constant_p(sig) \
209 ? __const_sigdelset((set), (sig)) \
210 : __gen_sigdelset((set), (sig)))
213 static inline void __gen_sigdelset(sigset_t
*set
, int _sig
)
215 asm("btrl %1,%0" : "+m"(*set
) : "Ir"(_sig
- 1) : "cc");
218 static inline void __const_sigdelset(sigset_t
*set
, int _sig
)
220 unsigned long sig
= _sig
- 1;
221 set
->sig
[sig
/ _NSIG_BPW
] &= ~(1 << (sig
% _NSIG_BPW
));
224 static inline int __const_sigismember(sigset_t
*set
, int _sig
)
226 unsigned long sig
= _sig
- 1;
227 return 1 & (set
->sig
[sig
/ _NSIG_BPW
] >> (sig
% _NSIG_BPW
));
230 static inline int __gen_sigismember(sigset_t
*set
, int _sig
)
233 asm("btl %2,%1\n\tsbbl %0,%0"
234 : "=r"(ret
) : "m"(*set
), "Ir"(_sig
-1) : "cc");
238 #define sigismember(set, sig) \
239 (__builtin_constant_p(sig) \
240 ? __const_sigismember((set), (sig)) \
241 : __gen_sigismember((set), (sig)))
243 static inline int sigfindinword(unsigned long word
)
245 asm("bsfl %1,%0" : "=r"(word
) : "rm"(word
) : "cc");
253 #undef __HAVE_ARCH_SIG_BITOPS
255 #endif /* !__i386__ */
257 #endif /* __KERNEL__ */
258 #endif /* __ASSEMBLY__ */
260 #endif /* _ASM_X86_SIGNAL_H */