diff options
author | deischen <deischen@FreeBSD.org> | 1999-12-17 11:46:55 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 1999-12-17 11:46:55 +0000 |
commit | b043dd936dab5596ed1e3dd0aeec575b7e97bc58 (patch) | |
tree | 0e3b42d76b8af28e53dbc1c390b92c0032c457ec /lib/libc_r | |
parent | 539b0dd3efc7c13e067c51b2f7399750af93d51e (diff) | |
download | FreeBSD-src-b043dd936dab5596ed1e3dd0aeec575b7e97bc58.zip FreeBSD-src-b043dd936dab5596ed1e3dd0aeec575b7e97bc58.tar.gz |
Change to work with recent signal changes. The signal being handled is
now added to the signal mask; this test failed because it didn't allow
for this.
Diffstat (limited to 'lib/libc_r')
-rw-r--r-- | lib/libc_r/test/sigsuspend/sigsuspend.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/libc_r/test/sigsuspend/sigsuspend.c b/lib/libc_r/test/sigsuspend/sigsuspend.c index 153c6e0..113b2d6 100644 --- a/lib/libc_r/test/sigsuspend/sigsuspend.c +++ b/lib/libc_r/test/sigsuspend/sigsuspend.c @@ -94,7 +94,7 @@ sigsuspender (void *arg) static void sighandler (int signo) { - sigset_t set; + sigset_t set, suspend_set; pthread_t self; if ((signo >= 0) && (signo <= NSIG)) @@ -110,8 +110,15 @@ sighandler (int signo) fifo_depth++; printf (" -> Suspender thread signal handler caught signal %d\n", signo); + + /* Get the current signal mask. */ sigprocmask (SIG_SETMASK, NULL, &set); - if (memcmp(&set, &suspender_mask, sizeof(set))) + + /* The handler should run with the current signal masked. */ + suspend_set = suspender_mask; + sigaddset(&suspend_set, signo); + + if (memcmp(&set, &suspend_set, sizeof(set))) printf (" >>> FAIL: sigsuspender signal handler running " "with incorrect mask.\n"); } @@ -180,13 +187,14 @@ int main (int argc, char *argv[]) sigaddset (&newset, SIGUSR2); sigprocmask (SIG_SETMASK, &newset, NULL); - /* Install a signal handler for SIGUSR1 and SIGUSR2 */ + /* Install a signal handler for SIGUSR1 */ sigemptyset (&act.sa_mask); sigaddset (&act.sa_mask, SIGUSR1); - sigaddset (&act.sa_mask, SIGUSR2); - act.sa_handler = sighandler; - act.sa_flags = SA_RESTART; sigaction (SIGUSR1, &act, NULL); + + /* Install a signal handler for SIGUSR2 */ + sigemptyset (&act.sa_mask); + sigaddset (&act.sa_mask, SIGUSR2); sigaction (SIGUSR2, &act, NULL); /* |