diff --git a/libc/Makefile b/libc/Makefile
index 2a702cca..a0473580 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -32,10 +32,14 @@ inttypes/strtoumax.o \
inttypes/wcstoimax.o \
inttypes/wcstoumax.o \
signal/sigaddset.o \
+signal/sigandset.o \
signal/sigdelset.o \
signal/sigemptyset.o \
signal/sigfillset.o \
+signal/sigisemptyset.o \
signal/sigismember.o \
+signal/signotset.o \
+signal/sigorset.o \
stdio/clearerr.o \
stdio/dprintf.o \
stdio/fbufsize.o \
diff --git a/libc/include/signal.h b/libc/include/signal.h
index 741c585b..92927af0 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -176,14 +176,18 @@ int raise(int sig);
int sigaction(int, const struct sigaction* __restrict, struct sigaction* __restrict);
int sigaddset(sigset_t*, int);
int sigaltstack(const stack_t* __restrict, stack_t* __restrict);
+int sigandset(sigset_t*, const sigset_t*, const sigset_t*);
int sigdelset(sigset_t*, int);
int sigemptyset(sigset_t*);
int sigfillset(sigset_t*);
/* TODO: sighold (obsolescent XSI). */
/* TODO: sigignore (obsolescent XSI). */
/* TODO: siginterrupt (obsolescent XSI). */
+int sigisemptyset(const sigset_t*);
int sigismember(const sigset_t*, int);
sighandler_t signal(int, sighandler_t);
+int signotset(sigset_t*, const sigset_t*);
+int sigorset(sigset_t*, const sigset_t*, const sigset_t*);
/* TODO: sigpause (obsolescent XSI). */
int sigpending(sigset_t*);
int sigprocmask(int, const sigset_t* __restrict, sigset_t* __restrict);
diff --git a/libc/signal/sigandset.cpp b/libc/signal/sigandset.cpp
new file mode 100644
index 00000000..6351c9c0
--- /dev/null
+++ b/libc/signal/sigandset.cpp
@@ -0,0 +1,34 @@
+/*******************************************************************************
+
+ Copyright(C) Jonas 'Sortie' Termansen 2013.
+
+ This file is part of the Sortix C Library.
+
+ The Sortix C Library is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or (at your
+ option) any later version.
+
+ The Sortix C Library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with the Sortix C Library. If not, see .
+
+ signal/sigandset.cpp
+ Computes the intersection of two signal sets.
+
+*******************************************************************************/
+
+#include
+#include
+
+extern "C"
+int sigandset(sigset_t* set, const sigset_t* left, const sigset_t* right)
+{
+ for ( size_t i = 0; i < sizeof(set->__val) / sizeof(set->__val[0]); i++ )
+ set->__val[i] = left->__val[i] & right->__val[i];
+ return 0;
+}
diff --git a/libc/signal/sigisemptyset.cpp b/libc/signal/sigisemptyset.cpp
new file mode 100644
index 00000000..66f98815
--- /dev/null
+++ b/libc/signal/sigisemptyset.cpp
@@ -0,0 +1,34 @@
+/*******************************************************************************
+
+ Copyright(C) Jonas 'Sortie' Termansen 2013.
+
+ This file is part of the Sortix C Library.
+
+ The Sortix C Library is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or (at your
+ option) any later version.
+
+ The Sortix C Library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with the Sortix C Library. If not, see .
+
+ signal/sigisemptyset.cpp
+ Tests whether this is the empty signal set.
+
+*******************************************************************************/
+
+#include
+#include
+
+extern "C" int sigisemptyset(const sigset_t* set)
+{
+ for ( size_t i = 0; i < sizeof(set->__val) / sizeof(set->__val[0]); i++ )
+ if ( set->__val[i] != 0 )
+ return 1;
+ return 0;
+}
diff --git a/libc/signal/signotset.cpp b/libc/signal/signotset.cpp
new file mode 100644
index 00000000..f2f4bcc4
--- /dev/null
+++ b/libc/signal/signotset.cpp
@@ -0,0 +1,34 @@
+/*******************************************************************************
+
+ Copyright(C) Jonas 'Sortie' Termansen 2013.
+
+ This file is part of the Sortix C Library.
+
+ The Sortix C Library is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or (at your
+ option) any later version.
+
+ The Sortix C Library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with the Sortix C Library. If not, see .
+
+ signal/signotset.cpp
+ Computes the complement of a signal set.
+
+*******************************************************************************/
+
+#include
+#include
+
+extern "C"
+int signotset(sigset_t* dst, const sigset_t* src)
+{
+ for ( size_t i = 0; i < sizeof(dst->__val) / sizeof(dst->__val[0]); i++ )
+ dst->__val[i] = ~src->__val[i];
+ return 0;
+}
diff --git a/libc/signal/sigorset.cpp b/libc/signal/sigorset.cpp
new file mode 100644
index 00000000..ca279d40
--- /dev/null
+++ b/libc/signal/sigorset.cpp
@@ -0,0 +1,34 @@
+/*******************************************************************************
+
+ Copyright(C) Jonas 'Sortie' Termansen 2013.
+
+ This file is part of the Sortix C Library.
+
+ The Sortix C Library is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or (at your
+ option) any later version.
+
+ The Sortix C Library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with the Sortix C Library. If not, see .
+
+ signal/sigorset.cpp
+ Computes the union of two signal sets.
+
+*******************************************************************************/
+
+#include
+#include
+
+extern "C"
+int sigorset(sigset_t* set, const sigset_t* left, const sigset_t* right)
+{
+ for ( size_t i = 0; i < sizeof(set->__val) / sizeof(set->__val[0]); i++ )
+ set->__val[i] = left->__val[i] | right->__val[i];
+ return 0;
+}