summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarc <marc@openbsd.org>2003-07-10 21:02:12 +0000
committermarc <marc@openbsd.org>2003-07-10 21:02:12 +0000
commit2c323b514ee4f3da965604f65ffd043f8b313026 (patch)
treec79a0c610ecd2f46adb83d62ffa7807097eebf02
parentsync usage with manpage, add missing -R (diff)
downloadwireguard-openbsd-2c323b514ee4f3da965604f65ffd043f8b313026.tar.xz
wireguard-openbsd-2c323b514ee4f3da965604f65ffd043f8b313026.zip
Add test to ensure that a masked signal with a default action of
terminate process doesn't terminate the process. It will until a libpthread fix is verify and commited.
-rw-r--r--regress/lib/libpthread/sigmask/Makefile5
-rw-r--r--regress/lib/libpthread/sigmask/sigmask.c32
2 files changed, 37 insertions, 0 deletions
diff --git a/regress/lib/libpthread/sigmask/Makefile b/regress/lib/libpthread/sigmask/Makefile
new file mode 100644
index 00000000000..3c031fab6be
--- /dev/null
+++ b/regress/lib/libpthread/sigmask/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2003/07/10 21:02:12 marc Exp $
+
+PROG= sigmask
+
+.include <bsd.regress.mk>
diff --git a/regress/lib/libpthread/sigmask/sigmask.c b/regress/lib/libpthread/sigmask/sigmask.c
new file mode 100644
index 00000000000..51b93486842
--- /dev/null
+++ b/regress/lib/libpthread/sigmask/sigmask.c
@@ -0,0 +1,32 @@
+/* $OpenBSD: sigmask.c,v 1.1 2003/07/10 21:02:12 marc Exp $ */
+/* PUBLIC DOMAIN July 2003 Marco S Hyman <marc@snafu.org> */
+
+#include <sys/time.h>
+
+#include <pthread.h>
+#include <signal.h>
+#include <unistd.h>
+
+#include "test.h"
+
+/*
+ * Test that masked signals with a default action of terminate process
+ * do NOT terminate the process.
+ */
+int main (int argc, char *argv[])
+{
+ sigset_t mask;
+
+ /* mask sigalrm */
+ CHECKe(sigemptyset(&mask));
+ CHECKe(sigaddset(&mask, SIGALRM));
+ CHECKe(pthread_sigmask(SIG_BLOCK, &mask, NULL));
+
+ /* now trigger sigalrm */
+ ualarm(100000, 0);
+
+ /* wait for it -- we shouldn't see it. */
+ CHECKe(sleep(1));
+
+ SUCCEED;
+}