summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/bits/sigset.h
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/bits/sigset.h')
-rw-r--r--libc/sysdeps/linux/common/bits/sigset.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/common/bits/sigset.h b/libc/sysdeps/linux/common/bits/sigset.h
index 7c2ce0ebe..4ef22311a 100644
--- a/libc/sysdeps/linux/common/bits/sigset.h
+++ b/libc/sysdeps/linux/common/bits/sigset.h
@@ -175,7 +175,7 @@ _EXTERN_INLINE int \
NAME (CONST __sigset_t *__set, int __sig) \
{ \
unsigned long __mask = __sigmask (__sig); \
- unsigned long __word = __sigword (__sig); \
+ unsigned __word = __sigword (__sig); \
return BODY; \
}
@@ -186,5 +186,38 @@ __SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), )
# undef __SIGSETFN
# endif
+# ifdef _LIBC
+/* It's far too much PITA to __USE_EXTERN_INLINES from within libc.
+ * Especially since we want to inline only calls with const sig,
+ * but __USE_EXTERN_INLINES will inline all calls!
+ */
+static __always_inline unsigned long
+const_sigismember(const __sigset_t *set, int sig)
+{
+ unsigned long mask = __sigmask(sig);
+ unsigned word = __sigword(sig);
+ return (set->__val[word] & mask);
+}
+# define __sigismember(set, sig) \
+ (__builtin_constant_p(sig) ? (const_sigismember(set, sig) != 0) : __sigismember(set, sig))
+static __always_inline void
+const_sigaddset(__sigset_t *set, int sig)
+{
+ unsigned long mask = __sigmask(sig);
+ unsigned word = __sigword(sig);
+ set->__val[word] |= mask;
+}
+# define __sigaddset(set, sig) \
+ (__builtin_constant_p(sig) ? (const_sigaddset(set, sig), 0) : __sigaddset(set, sig))
+static __always_inline void
+const_sigdelset(__sigset_t *set, int sig)
+{
+ unsigned long mask = __sigmask(sig);
+ unsigned word = __sigword(sig);
+ set->__val[word] &= ~mask;
+}
+# define __sigdelset(set, sig) \
+ (__builtin_constant_p(sig) ? (const_sigdelset(set, sig), 0) : __sigdelset(set, sig))
+# endif
#endif /* ! _SIGSET_H_fns. */