HPUX: Do not sigwait on critical signals
authorAndrew Deason <adeason@sinenomine.net>
Tue, 20 Oct 2009 17:43:42 +0000 (12:43 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Wed, 21 Oct 2009 18:05:22 +0000 (11:05 -0700)
On HPUX, it is possible for 'critical' signals such as SEGV, ABRT, etc
to be delivered to the softsig thread when we sigwait(). The current
code marks these as 'fatal' and just exit(0)s when they are received,
preventing us from getting cores in the case of a SEGV, ABRT, etc.

To work around this and keep behavior on other platforms the same, just
do not wait on 'critical' signals on HPUX in the softsig thread.

Reviewed-on: http://gerrit.openafs.org/693
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/util/softsig.c

index bcd04f9..4c202b9 100644 (file)
@@ -57,7 +57,12 @@ softsig_thread(void *arg)
 #if defined(AFS_DARWIN60_ENV) || (defined(AFS_NBSD_ENV) && !defined(AFS_NBSD50_ENV))
     pthread_sigmask (SIG_BLOCK, &ss, NULL);
     sigdelset (&os, SIGUSR1);
-#else /* !defined(AFS_DARWIN60_ENV) && !defined(AFS_NBSD_ENV) */
+#elif !defined(AFS_HPUX_ENV)
+    /* On HPUX, don't wait for 'critical' signals, as things such as
+     * SEGV won't cause a core, then. Some non-HPUX platforms may need
+     * this, though, since apparently if we wait on some signals but not
+     * e.g. SEGV, the softsig thread will still wait around when the
+     * other threads were killed by the SEGV. */
     for (i = 0; i < NSIG; i++) {
        if (!sigismember(&os, i) && i != SIGSTOP && i != SIGKILL) {
            sigaddset(&ss, i);