about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/sigset.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/sigset.h')
-rw-r--r--sysdeps/unix/sysv/linux/sigset.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/sigset.h b/sysdeps/unix/sysv/linux/sigset.h
index 752d13adff..62e668773c 100644
--- a/sysdeps/unix/sysv/linux/sigset.h
+++ b/sysdeps/unix/sysv/linux/sigset.h
@@ -54,16 +54,47 @@ typedef struct
 #define __sigword(sig)	(((sig) - 1) / (8 * sizeof (unsigned long int)))
 
 #if defined __GNUC__ && __GNUC__ >= 2
-#define __sigemptyset(set) \
+# define __sigemptyset(set) \
   (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
 		    sigset_t *__set = (set);				      \
 		    while (--__cnt >= 0) __set->__val[__cnt] = 0;	      \
 		    0; }))
-#define __sigfillset(set) \
+# define __sigfillset(set) \
   (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
 		    sigset_t *__set = (set);				      \
 		    while (--__cnt >= 0) __set->__val[__cnt] = ~0UL;	      \
 		    0; }))
+
+# ifdef _GNU_SOURCE
+/* The POSIX does not specify for handling the whole signal set in one
+   command.  This is often wanted and so we define three more functions
+   here.  */
+# define __sigisemptyset(set) \
+  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
+		    const sigset_t *__set = (set);			      \
+		    int __ret = __set->__val[--__cnt];			      \
+		    while (!__ret && --__cnt >= 0)			      \
+			__ret = __set->__val[__cnt];			      \
+		    __ret; }))
+# define __sigandset(dest, left, right) \
+  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
+		    sigset_t *__dest = (dest);				      \
+		    const sigset_t *__left = (left);			      \
+		    const sigset_t *__right = (right);			      \
+		    while (--__cnt >= 0)				      \
+		      __dest->__val[__cnt] = (__left->__val[__cnt]	      \
+					      & __right->__val[__cnt]);	      \
+		    0; }))
+# define __sigorset(dest, left, right) \
+  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
+		    sigset_t *__dest = (dest);				      \
+		    const sigset_t *__left = (left);			      \
+		    const sigset_t *__right = (right);			      \
+		    while (--__cnt >= 0)				      \
+		      __dest->__val[__cnt] = (__left->__val[__cnt]	      \
+					      | __right->__val[__cnt]);	      \
+		    0; }))
+# endif
 #endif
 
 /* These functions needn't check for a bogus signal number -- error