static int T_int;
+/*
+ * XXXMLG NetBSD's "default" pthreads implementation has a broken signal
+ * interface.
+ *
+ * Here, if using NetBSD, define SIGACTION() as pthread_sigaction(),
+ * otherwise make it sigaction().
+ */
+#if defined(__NetBSD__)
+#define SIGACTION(a, b, c) pthread_sigaction((a), (b), (c))
+#else
+#define SIGACTION(a, b, c) sigaction((a), (b), (c))
+#endif
+
static void
t_sighandler(int sig) {
T_int = sig;
sa.sa_flags = 0;
sigfillset(&sa.sa_mask);
sa.sa_handler = t_sighandler;
- (void) sigaction(SIGALRM, &sa, NULL);
- (void) sigaction(SIGINT, &sa, NULL);
+ (void)SIGACTION(SIGALRM, &sa, NULL);
+ (void)SIGACTION(SIGINT, &sa, NULL);
/* output start stanza to journal */
T_int = 0;
sa.sa_handler = t_sighandler;
- (void) sigaction(SIGALRM, &sa, NULL);
+ (void)SIGACTION(SIGALRM, &sa, NULL);
alarm(T_timeout);
deadpid = (pid_t) -1;
break;
}
- sa.sa_handler = SIG_IGN;
- (void) sigaction(SIGALRM, &sa, NULL);
alarm(0);
+ sa.sa_handler = SIG_IGN;
+ (void)SIGACTION(SIGALRM, &sa, NULL);
}
else {
t_info("fork failed, errno == %d\n", errno);