summaryrefslogtreecommitdiff
path: root/src/signal/sigandset.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/signal/sigandset.c')
-rw-r--r--src/signal/sigandset.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/signal/sigandset.c b/src/signal/sigandset.c
new file mode 100644
index 00000000..f62c7fec
--- /dev/null
+++ b/src/signal/sigandset.c
@@ -0,0 +1,17 @@
+#define _GNU_SOURCE
+#include <signal.h>
+#include <errno.h>
+
+#define SST_SIZE (sizeof(sigset_t) / sizeof(long))
+
+int sigandset(sigset_t *dest, sigset_t *left, sigset_t *right)
+{
+ if(!dest || !left || !right) {
+ errno = EINVAL;
+ return -1;
+ }
+ unsigned long i = 0, *d = (void*) dest, *l = (void*) left, *r = (void*) right;
+ for(; i < SST_SIZE; i++) d[i] = l[i] & r[i];
+ return 0;
+}
+