4 * Regression test for siglongjmp out of a signal handler back into
7 * Written by Christian Limpach <cl@NetBSD.org>, December 2003.
17 #include <sys/resource.h>
20 void handler(int, siginfo_t
*, void *);
21 static sigjmp_buf env
;
30 handler(int sig
, siginfo_t
*info
, void *ctx
)
36 main(int argc
, char **argv
)
43 rlim
.rlim_cur
= rlim
.rlim_max
= 0;
44 (void)setrlimit(RLIMIT_CORE
, &rlim
);
46 pthread_create(&t
, NULL
, thread
, NULL
);
49 sigaddset(&nset
, SIGUSR1
);
50 pthread_sigmask(SIG_SETMASK
, &nset
, NULL
);
52 act
.sa_sigaction
= handler
;
53 sigemptyset(&act
.sa_mask
);
54 sigaddset(&act
.sa_mask
, SIGUSR2
);
56 sigaction(SIGSEGV
, &act
, NULL
);
58 if (sigsetjmp(env
, 1) == 0)
61 pthread_sigmask(0, NULL
, &nset
);
63 if (sigismember(&nset
, SIGSEGV
))
64 errx(1, "SIGSEGV set");
65 if (sigismember(&nset
, SIGUSR2
))
66 errx(1, "SIGUSR2 set");
67 if (!sigismember(&nset
, SIGUSR1
))
68 errx(1, "SIGUSR1 not set");