diff options
| author | cvs2svn <admin@example.com> | 2018-11-07 01:08:50 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2018-11-07 01:08:50 +0000 |
| commit | 2035faf3f8aa95b888d9416c3cc7328c0ea18beb (patch) | |
| tree | f08a08d357c5d30455c569890f747c1d9b241316 /src/regress/lib/libc/sigthr | |
| parent | be03b61c1b8f59ccdd34dbe5f6c6b30de697d28b (diff) | |
| download | openbsd-bluhm_20181106.tar.gz openbsd-bluhm_20181106.tar.bz2 openbsd-bluhm_20181106.zip | |
This commit was manufactured by cvs2git to create tag 'bluhm_20181106'.bluhm_20181106
Diffstat (limited to 'src/regress/lib/libc/sigthr')
| -rw-r--r-- | src/regress/lib/libc/sigthr/Makefile | 5 | ||||
| -rw-r--r-- | src/regress/lib/libc/sigthr/sigthr_test.c | 66 |
2 files changed, 0 insertions, 71 deletions
diff --git a/src/regress/lib/libc/sigthr/Makefile b/src/regress/lib/libc/sigthr/Makefile deleted file mode 100644 index 8ae4643e1e..0000000000 --- a/src/regress/lib/libc/sigthr/Makefile +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2015/10/22 05:30:18 guenther Exp $ | ||
| 2 | |||
| 3 | PROG=sigthr_test | ||
| 4 | |||
| 5 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/sigthr/sigthr_test.c b/src/regress/lib/libc/sigthr/sigthr_test.c deleted file mode 100644 index c2eaa1f779..0000000000 --- a/src/regress/lib/libc/sigthr/sigthr_test.c +++ /dev/null | |||
| @@ -1,66 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> | ||
| 3 | * | ||
| 4 | * Public domain. | ||
| 5 | * | ||
| 6 | * Verify that SIGTHR can't be blocked or caught by applications. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <err.h> | ||
| 10 | #include <errno.h> | ||
| 11 | #include <stdio.h> | ||
| 12 | #include <stdlib.h> | ||
| 13 | #include <string.h> | ||
| 14 | #include <signal.h> | ||
| 15 | |||
| 16 | void sighandler(int sig) { } | ||
| 17 | |||
| 18 | int | ||
| 19 | main(void) | ||
| 20 | { | ||
| 21 | struct sigaction sa; | ||
| 22 | sigset_t set, oset; | ||
| 23 | |||
| 24 | /* | ||
| 25 | * check sigprocmask | ||
| 26 | */ | ||
| 27 | if (sigprocmask(SIG_BLOCK, NULL, &set)) | ||
| 28 | err(1, "sigprocmask"); | ||
| 29 | if (sigismember(&set, SIGTHR)) | ||
| 30 | errx(1, "SIGTHR already blocked"); | ||
| 31 | sigaddset(&set, SIGTHR); | ||
| 32 | if (sigprocmask(SIG_BLOCK, &set, NULL)) | ||
| 33 | err(1, "sigprocmask"); | ||
| 34 | if (sigprocmask(SIG_SETMASK, &set, &oset)) | ||
| 35 | err(1, "sigprocmask"); | ||
| 36 | if (sigismember(&oset, SIGTHR)) | ||
| 37 | errx(1, "SIGTHR blocked with SIG_BLOCK"); | ||
| 38 | if (sigprocmask(SIG_BLOCK, NULL, &oset)) | ||
| 39 | err(1, "sigprocmask"); | ||
| 40 | if (sigismember(&oset, SIGTHR)) | ||
| 41 | errx(1, "SIGTHR blocked with SIG_SETMASK"); | ||
| 42 | |||
| 43 | /* | ||
| 44 | * check sigaction | ||
| 45 | */ | ||
| 46 | if (sigaction(SIGTHR, NULL, &sa) == 0) | ||
| 47 | errx(1, "sigaction(SIGTHR) succeeded"); | ||
| 48 | else if (errno != EINVAL) | ||
| 49 | err(1, "sigaction(SIGTHR) didn't fail with EINVAL"); | ||
| 50 | memset(&sa, 0, sizeof sa); | ||
| 51 | sa.sa_handler = sighandler; | ||
| 52 | sigfillset(&sa.sa_mask); | ||
| 53 | sa.sa_flags = 0; | ||
| 54 | if (sigaction(SIGTHR, &sa, NULL) == 0) | ||
| 55 | errx(1, "sigaction(SIGTHR) succeeded"); | ||
| 56 | else if (errno != EINVAL) | ||
| 57 | err(1, "sigaction(SIGTHR) didn't fail with EINVAL"); | ||
| 58 | if (sigaction(SIGUSR1, &sa, NULL)) | ||
| 59 | err(1, "sigaction(SIGUSR1)"); | ||
| 60 | if (sigaction(SIGUSR1, NULL, &sa)) | ||
| 61 | err(1, "sigaction(SIGUSR1)"); | ||
| 62 | if (sigismember(&sa.sa_mask, SIGTHR)) | ||
| 63 | errx(1, "SIGTHR blocked with sigaction"); | ||
| 64 | |||
| 65 | return 0; | ||
| 66 | } | ||
