+ } else {
+ /*
+ * If we get here, the signal must be caught.
+ */
+#ifdef DIAGNOSTIC
+ if (action == SIG_IGN || (p->p_sigmask & mask))
+ panic("psig action");
+#endif
+ /*
+ * Set the new mask value and also defer further
+ * occurences of this signal.
+ *
+ * Special case: user has done a sigpause. Here the
+ * current mask is not of interest, but rather the
+ * mask from before the sigpause is what we want
+ * restored after the signal processing is completed.
+ */
+ (void) splhigh();
+ if (ps->ps_flags & SAS_OLDMASK) {
+ returnmask = ps->ps_oldmask;
+ ps->ps_flags &= ~SAS_OLDMASK;
+ } else
+ returnmask = p->p_sigmask;
+ p->p_sigmask |= ps->ps_catchmask[sig] | mask;
+ (void) spl0();
+ p->p_stats->p_ru.ru_nsignals++;
+ sendsig(action, sig, returnmask, 0);
+ }
+}
+
+/*
+ * Kill the current process for stated reason.
+ */
+killproc(p, why)
+ struct proc *p;
+ char *why;
+{
+
+ log(LOG_ERR, "pid %d was killed: %s\n", p->p_pid, why);
+ uprintf("sorry, pid %d was killed: %s\n", p->p_pid, why);
+ psignal(p, SIGKILL);
+}
+
+/*
+ * Force the current process to exit with the specified
+ * signal, dumping core if appropriate. We bypass the normal
+ * tests for masked and caught signals, allowing unrecoverable
+ * failures to terminate the process without changing signal state.
+ * Mark the accounting record with the signal termination.
+ * If dumping core, save the signal number for the debugger.
+ * Calls exit and does not return.
+ */
+sigexit(p, sig)
+ register struct proc *p;
+ int sig;
+{
+
+ p->p_acflag |= AXSIG;
+ if (sigprop[sig] & SA_CORE) {
+ p->p_sigacts->ps_sig = sig;
+ if (coredump(p) == 0)
+ sig |= WCOREFLAG;
+ }
+ exit1(p, W_EXITCODE(0, sig));
+ /* NOTREACHED */