diff options
-rw-r--r-- | include/asm-i386/signal.h | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/include/asm-i386/signal.h b/include/asm-i386/signal.h index cbb47d34aa31..6ba29f145bf8 100644 --- a/include/asm-i386/signal.h +++ b/include/asm-i386/signal.h | |||
@@ -159,14 +159,37 @@ typedef struct sigaltstack { | |||
159 | 159 | ||
160 | #define __HAVE_ARCH_SIG_BITOPS | 160 | #define __HAVE_ARCH_SIG_BITOPS |
161 | 161 | ||
162 | static __inline__ void sigaddset(sigset_t *set, int _sig) | 162 | #define sigaddset(set,sig) \ |
163 | (__builtin_constant_p(sig) ? \ | ||
164 | __const_sigaddset((set),(sig)) : \ | ||
165 | __gen_sigaddset((set),(sig))) | ||
166 | |||
167 | static __inline__ void __gen_sigaddset(sigset_t *set, int _sig) | ||
163 | { | 168 | { |
164 | __asm__("btsl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); | 169 | __asm__("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc"); |
165 | } | 170 | } |
166 | 171 | ||
167 | static __inline__ void sigdelset(sigset_t *set, int _sig) | 172 | static __inline__ void __const_sigaddset(sigset_t *set, int _sig) |
168 | { | 173 | { |
169 | __asm__("btrl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); | 174 | unsigned long sig = _sig - 1; |
175 | set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW); | ||
176 | } | ||
177 | |||
178 | #define sigdelset(set,sig) \ | ||
179 | (__builtin_constant_p(sig) ? \ | ||
180 | __const_sigdelset((set),(sig)) : \ | ||
181 | __gen_sigdelset((set),(sig))) | ||
182 | |||
183 | |||
184 | static __inline__ void __gen_sigdelset(sigset_t *set, int _sig) | ||
185 | { | ||
186 | __asm__("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc"); | ||
187 | } | ||
188 | |||
189 | static __inline__ void __const_sigaddset(sigset_t *set, int _sig) | ||
190 | { | ||
191 | unsigned long sig = _sig - 1; | ||
192 | set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW)); | ||
170 | } | 193 | } |
171 | 194 | ||
172 | static __inline__ int __const_sigismember(sigset_t *set, int _sig) | 195 | static __inline__ int __const_sigismember(sigset_t *set, int _sig) |