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_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.
87 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
88 * Unix names RESETHAND and NODEFER respectively.
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
98 #define SA_NOMASK SA_NODEFER
99 #define SA_ONESHOT SA_RESETHAND
100 #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
102 #define SA_RESTORER 0x04000000
105 * sigaltstack controls
110 #define MINSIGSTKSZ 2048
111 #define SIGSTKSZ 8192
113 #define SIG_BLOCK 0 /* for blocking signals */
114 #define SIG_UNBLOCK 1 /* for unblocking signals */
115 #define SIG_SETMASK 2 /* for setting the signal mask */
117 /* Type of a signal handler. */
118 typedef void __signalfn_t(int);
119 typedef __signalfn_t __user *__sighandler_t;
121 typedef void __restorefn_t(void);
122 typedef __restorefn_t __user *__sigrestore_t;
124 #define SIG_DFL ((__sighandler_t)0) /* default signal handling */
125 #define SIG_IGN ((__sighandler_t)1) /* ignore signal */
126 #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
129 struct old_sigaction {
130 __sighandler_t sa_handler;
131 old_sigset_t sa_mask;
132 unsigned long sa_flags;
133 __sigrestore_t sa_restorer;
137 __sighandler_t sa_handler;
138 unsigned long sa_flags;
139 __sigrestore_t sa_restorer;
140 sigset_t sa_mask; /* mask last for extensibility */
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__ */
164 typedef struct sigaltstack {
171 #include <asm/sigcontext.h>
173 #define __HAVE_ARCH_SIG_BITOPS
175 static __inline__ void sigaddset(sigset_t *set, int _sig)
177 __asm__("btsl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
180 static __inline__ void sigdelset(sigset_t *set, int _sig)
182 __asm__("btrl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
185 static __inline__ int __const_sigismember(sigset_t *set, int _sig)
187 unsigned long sig = _sig - 1;
188 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
191 static __inline__ int __gen_sigismember(sigset_t *set, int _sig)
194 __asm__("btl %2,%1\n\tsbbl %0,%0"
195 : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
199 #define sigismember(set,sig) \
200 (__builtin_constant_p(sig) ? \
201 __const_sigismember((set),(sig)) : \
202 __gen_sigismember((set),(sig)))
204 static __inline__ int sigfindinword(unsigned long word)
206 __asm__("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc");
211 extern int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
213 #define ptrace_signal_deliver(regs, cookie) \
215 if (current->ptrace & PT_DTRACE) { \
216 current->ptrace &= ~PT_DTRACE; \
217 (regs)->eflags &= ~TF_MASK; \
221 #endif /* __KERNEL__ */