svn commit: r305288 - head/sys/kern
Brooks Davis
brooks at FreeBSD.org
Fri Sep 2 18:22:57 UTC 2016
Author: brooks
Date: Fri Sep 2 18:22:56 2016
New Revision: 305288
URL: https://svnweb.freebsd.org/changeset/base/305288
Log:
Merge from CheriBSD:
Rename sigprop-table constants to SIGPROP_ from SA_ to reduce the
impression of a namespace collision.
Submitted by: rwatson
Reviewed by: jhb, kib (slightly different versions)
Obtained from: CheriBSD (814ec5771cb1cb53deba317c561de62a91ae7684)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D7616
Modified:
head/sys/kern/kern_sig.c
Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c Fri Sep 2 17:24:16 2016 (r305287)
+++ head/sys/kern/kern_sig.c Fri Sep 2 18:22:56 2016 (r305288)
@@ -189,46 +189,46 @@ SYSCTL_INT(_kern, OID_AUTO, coredump_dev
* The array below categorizes the signals and their default actions
* according to the following properties:
*/
-#define SA_KILL 0x01 /* terminates process by default */
-#define SA_CORE 0x02 /* ditto and coredumps */
-#define SA_STOP 0x04 /* suspend process */
-#define SA_TTYSTOP 0x08 /* ditto, from tty */
-#define SA_IGNORE 0x10 /* ignore by default */
-#define SA_CONT 0x20 /* continue if suspended */
-#define SA_CANTMASK 0x40 /* non-maskable, catchable */
+#define SIGPROP_KILL 0x01 /* terminates process by default */
+#define SIGPROP_CORE 0x02 /* ditto and coredumps */
+#define SIGPROP_STOP 0x04 /* suspend process */
+#define SIGPROP_TTYSTOP 0x08 /* ditto, from tty */
+#define SIGPROP_IGNORE 0x10 /* ignore by default */
+#define SIGPROP_CONT 0x20 /* continue if suspended */
+#define SIGPROP_CANTMASK 0x40 /* non-maskable, catchable */
static int sigproptbl[NSIG] = {
- SA_KILL, /* SIGHUP */
- SA_KILL, /* SIGINT */
- SA_KILL|SA_CORE, /* SIGQUIT */
- SA_KILL|SA_CORE, /* SIGILL */
- SA_KILL|SA_CORE, /* SIGTRAP */
- SA_KILL|SA_CORE, /* SIGABRT */
- SA_KILL|SA_CORE, /* SIGEMT */
- SA_KILL|SA_CORE, /* SIGFPE */
- SA_KILL, /* SIGKILL */
- SA_KILL|SA_CORE, /* SIGBUS */
- SA_KILL|SA_CORE, /* SIGSEGV */
- SA_KILL|SA_CORE, /* SIGSYS */
- SA_KILL, /* SIGPIPE */
- SA_KILL, /* SIGALRM */
- SA_KILL, /* SIGTERM */
- SA_IGNORE, /* SIGURG */
- SA_STOP, /* SIGSTOP */
- SA_STOP|SA_TTYSTOP, /* SIGTSTP */
- SA_IGNORE|SA_CONT, /* SIGCONT */
- SA_IGNORE, /* SIGCHLD */
- SA_STOP|SA_TTYSTOP, /* SIGTTIN */
- SA_STOP|SA_TTYSTOP, /* SIGTTOU */
- SA_IGNORE, /* SIGIO */
- SA_KILL, /* SIGXCPU */
- SA_KILL, /* SIGXFSZ */
- SA_KILL, /* SIGVTALRM */
- SA_KILL, /* SIGPROF */
- SA_IGNORE, /* SIGWINCH */
- SA_IGNORE, /* SIGINFO */
- SA_KILL, /* SIGUSR1 */
- SA_KILL, /* SIGUSR2 */
+ SIGPROP_KILL, /* SIGHUP */
+ SIGPROP_KILL, /* SIGINT */
+ SIGPROP_KILL | SIGPROP_CORE, /* SIGQUIT */
+ SIGPROP_KILL | SIGPROP_CORE, /* SIGILL */
+ SIGPROP_KILL | SIGPROP_CORE, /* SIGTRAP */
+ SIGPROP_KILL | SIGPROP_CORE, /* SIGABRT */
+ SIGPROP_KILL | SIGPROP_CORE, /* SIGEMT */
+ SIGPROP_KILL | SIGPROP_CORE, /* SIGFPE */
+ SIGPROP_KILL, /* SIGKILL */
+ SIGPROP_KILL | SIGPROP_CORE, /* SIGBUS */
+ SIGPROP_KILL | SIGPROP_CORE, /* SIGSEGV */
+ SIGPROP_KILL | SIGPROP_CORE, /* SIGSYS */
+ SIGPROP_KILL, /* SIGPIPE */
+ SIGPROP_KILL, /* SIGALRM */
+ SIGPROP_KILL, /* SIGTERM */
+ SIGPROP_IGNORE, /* SIGURG */
+ SIGPROP_STOP, /* SIGSTOP */
+ SIGPROP_STOP | SIGPROP_TTYSTOP, /* SIGTSTP */
+ SIGPROP_IGNORE | SIGPROP_CONT, /* SIGCONT */
+ SIGPROP_IGNORE, /* SIGCHLD */
+ SIGPROP_STOP | SIGPROP_TTYSTOP, /* SIGTTIN */
+ SIGPROP_STOP | SIGPROP_TTYSTOP, /* SIGTTOU */
+ SIGPROP_IGNORE, /* SIGIO */
+ SIGPROP_KILL, /* SIGXCPU */
+ SIGPROP_KILL, /* SIGXFSZ */
+ SIGPROP_KILL, /* SIGVTALRM */
+ SIGPROP_KILL, /* SIGPROF */
+ SIGPROP_IGNORE, /* SIGWINCH */
+ SIGPROP_IGNORE, /* SIGINFO */
+ SIGPROP_KILL, /* SIGUSR1 */
+ SIGPROP_KILL, /* SIGUSR2 */
};
static void reschedule_signals(struct proc *p, sigset_t block, int flags);
@@ -755,7 +755,7 @@ kern_sigaction(struct thread *td, int si
* have to restart the process.
*/
if (ps->ps_sigact[_SIG_IDX(sig)] == SIG_IGN ||
- (sigprop(sig) & SA_IGNORE &&
+ (sigprop(sig) & SIGPROP_IGNORE &&
ps->ps_sigact[_SIG_IDX(sig)] == SIG_DFL)) {
/* never to be seen again */
sigqueue_delete_proc(p, sig);
@@ -923,7 +923,7 @@ siginit(p)
ps = p->p_sigacts;
mtx_lock(&ps->ps_mtx);
for (i = 1; i <= NSIG; i++) {
- if (sigprop(i) & SA_IGNORE && i != SIGCONT) {
+ if (sigprop(i) & SIGPROP_IGNORE && i != SIGCONT) {
SIGADDSET(ps->ps_sigignore, i);
}
}
@@ -940,7 +940,7 @@ sigdflt(struct sigacts *ps, int sig)
mtx_assert(&ps->ps_mtx, MA_OWNED);
SIGDELSET(ps->ps_sigcatch, sig);
- if ((sigprop(sig) & SA_IGNORE) != 0 && sig != SIGCONT)
+ if ((sigprop(sig) & SIGPROP_IGNORE) != 0 && sig != SIGCONT)
SIGADDSET(ps->ps_sigignore, sig);
ps->ps_sigact[_SIG_IDX(sig)] = SIG_DFL;
SIGDELSET(ps->ps_siginfo, sig);
@@ -969,7 +969,7 @@ execsigs(struct proc *p)
while (SIGNOTEMPTY(ps->ps_sigcatch)) {
sig = sig_ffs(&ps->ps_sigcatch);
sigdflt(ps, sig);
- if ((sigprop(sig) & SA_IGNORE) != 0)
+ if ((sigprop(sig) & SIGPROP_IGNORE) != 0)
sigqueue_delete_proc(p, sig);
}
@@ -2154,16 +2154,16 @@ tdsendsignal(struct proc *p, struct thre
intrval = ERESTART;
mtx_unlock(&ps->ps_mtx);
- if (prop & SA_CONT)
+ if (prop & SIGPROP_CONT)
sigqueue_delete_stopmask_proc(p);
- else if (prop & SA_STOP) {
+ else if (prop & SIGPROP_STOP) {
/*
* If sending a tty stop signal to a member of an orphaned
* process group, discard the signal here if the action
* is default; don't stop the process below if sleeping,
* and don't clear any pending SIGCONT.
*/
- if ((prop & SA_TTYSTOP) &&
+ if ((prop & SIGPROP_TTYSTOP) &&
(p->p_pgrp->pg_jobc == 0) &&
(action == SIG_DFL)) {
if (ksi && (ksi->ksi_flags & KSI_INS))
@@ -2188,7 +2188,7 @@ tdsendsignal(struct proc *p, struct thre
* except that stopped processes must be continued by SIGCONT.
*/
if (action == SIG_HOLD &&
- !((prop & SA_CONT) && (p->p_flag & P_STOPPED_SIG)))
+ !((prop & SIGPROP_CONT) && (p->p_flag & P_STOPPED_SIG)))
return (ret);
/*
* SIGKILL: Remove procfs STOPEVENTs and ptrace events.
@@ -2228,7 +2228,7 @@ tdsendsignal(struct proc *p, struct thre
goto runfast;
}
- if (prop & SA_CONT) {
+ if (prop & SIGPROP_CONT) {
/*
* If traced process is already stopped,
* then no further action is necessary.
@@ -2278,7 +2278,7 @@ tdsendsignal(struct proc *p, struct thre
goto out;
}
- if (prop & SA_STOP) {
+ if (prop & SIGPROP_STOP) {
/*
* If traced process is already stopped,
* then no further action is necessary.
@@ -2325,7 +2325,7 @@ tdsendsignal(struct proc *p, struct thre
MPASS(action == SIG_DFL);
- if (prop & SA_STOP) {
+ if (prop & SIGPROP_STOP) {
if (p->p_flag & (P_PPWAIT|P_WEXIT))
goto out;
p->p_flag |= P_STOPPED_SIG;
@@ -2394,7 +2394,7 @@ tdsigwakeup(struct thread *td, int sig,
* priority of the idle thread, since we still allow to signal
* kernel processes.
*/
- if (action == SIG_DFL && (prop & SA_KILL) != 0 &&
+ if (action == SIG_DFL && (prop & SIGPROP_KILL) != 0 &&
td->td_priority > PUSER && !TD_IS_IDLETHREAD(td))
sched_prio(td, PUSER);
if (TD_ON_SLEEPQ(td)) {
@@ -2411,7 +2411,7 @@ tdsigwakeup(struct thread *td, int sig,
* asleep, we are finished; the process should not
* be awakened.
*/
- if ((prop & SA_CONT) && action == SIG_DFL) {
+ if ((prop & SIGPROP_CONT) && action == SIG_DFL) {
thread_unlock(td);
PROC_SUNLOCK(p);
sigqueue_delete(&p->p_sigqueue, sig);
@@ -2427,7 +2427,7 @@ tdsigwakeup(struct thread *td, int sig,
* Don't awaken a sleeping thread for SIGSTOP if the
* STOP signal is deferred.
*/
- if ((prop & SA_STOP) != 0 && (td->td_flags & (TDF_SBDRY |
+ if ((prop & SIGPROP_STOP) != 0 && (td->td_flags & (TDF_SBDRY |
TDF_SERESTART | TDF_SEINTR)) == TDF_SBDRY)
goto out;
@@ -2858,10 +2858,10 @@ issignal(struct thread *td)
* if process is member of an orphaned
* process group, ignore tty stop signals.
*/
- if (prop & SA_STOP) {
+ if (prop & SIGPROP_STOP) {
if (p->p_flag & (P_TRACED|P_WEXIT) ||
(p->p_pgrp->pg_jobc == 0 &&
- prop & SA_TTYSTOP))
+ prop & SIGPROP_TTYSTOP))
break; /* == ignore */
if (TD_SBDRY_INTR(td)) {
KASSERT((td->td_flags & TDF_SBDRY) != 0,
@@ -2881,7 +2881,7 @@ issignal(struct thread *td)
PROC_SUNLOCK(p);
mtx_lock(&ps->ps_mtx);
goto next;
- } else if (prop & SA_IGNORE) {
+ } else if (prop & SIGPROP_IGNORE) {
/*
* Except for SIGCONT, shouldn't get here.
* Default action is to ignore; drop it.
@@ -2897,7 +2897,7 @@ issignal(struct thread *td)
* to take action on an ignored signal other
* than SIGCONT, unless process is traced.
*/
- if ((prop & SA_CONT) == 0 &&
+ if ((prop & SIGPROP_CONT) == 0 &&
(p->p_flag & P_TRACED) == 0)
printf("issignal\n");
break; /* == ignore */
@@ -3059,7 +3059,8 @@ sigexit(td, sig)
* XXX If another thread attempts to single-thread before us
* (e.g. via fork()), we won't get a dump at all.
*/
- if ((sigprop(sig) & SA_CORE) && thread_single(p, SINGLE_NO_EXIT) == 0) {
+ if ((sigprop(sig) & SIGPROP_CORE) &&
+ thread_single(p, SINGLE_NO_EXIT) == 0) {
p->p_sig = sig;
/*
* Log signals which would cause core dumps
More information about the svn-src-all
mailing list