Modernize the initalization of sigproptbl.
Use C99 designators to set the value of each slot and the nitems macro to
check for valid entries. In the process, switch to indexing by signal
number rather than signal-1 for improved clarity.
Obtained from: CheriBSD (a6053c5abf
)
Sponsored by: DARPA, AFRL
Reviewed by: kib
This commit is contained in:
parent
fa1cbf00d7
commit
ed6d876b19
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=305506
@ -198,37 +198,37 @@ SYSCTL_INT(_kern, OID_AUTO, coredump_devctl, CTLFLAG_RW, &coredump_devctl,
|
||||
#define SIGPROP_CANTMASK 0x40 /* non-maskable, catchable */
|
||||
|
||||
static int sigproptbl[NSIG] = {
|
||||
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 */
|
||||
[SIGHUP] = SIGPROP_KILL,
|
||||
[SIGINT] = SIGPROP_KILL,
|
||||
[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 | SIGPROP_CORE,
|
||||
[SIGKILL] = SIGPROP_KILL,
|
||||
[SIGBUS] = SIGPROP_KILL | SIGPROP_CORE,
|
||||
[SIGSEGV] = SIGPROP_KILL | SIGPROP_CORE,
|
||||
[SIGSYS] = SIGPROP_KILL | SIGPROP_CORE,
|
||||
[SIGPIPE] = SIGPROP_KILL,
|
||||
[SIGALRM] = SIGPROP_KILL,
|
||||
[SIGTERM] = SIGPROP_KILL,
|
||||
[SIGURG] = SIGPROP_IGNORE,
|
||||
[SIGSTOP] = SIGPROP_STOP,
|
||||
[SIGTSTP] = SIGPROP_STOP | SIGPROP_TTYSTOP,
|
||||
[SIGCONT] = SIGPROP_IGNORE | SIGPROP_CONT,
|
||||
[SIGCHLD] = SIGPROP_IGNORE,
|
||||
[SIGTTIN] = SIGPROP_STOP | SIGPROP_TTYSTOP,
|
||||
[SIGTTOU] = SIGPROP_STOP | SIGPROP_TTYSTOP,
|
||||
[SIGIO] = SIGPROP_IGNORE,
|
||||
[SIGXCPU] = SIGPROP_KILL,
|
||||
[SIGXFSZ] = SIGPROP_KILL,
|
||||
[SIGVTALRM] = SIGPROP_KILL,
|
||||
[SIGPROF] = SIGPROP_KILL,
|
||||
[SIGWINCH] = SIGPROP_IGNORE,
|
||||
[SIGINFO] = SIGPROP_IGNORE,
|
||||
[SIGUSR1] = SIGPROP_KILL,
|
||||
[SIGUSR2] = SIGPROP_KILL,
|
||||
};
|
||||
|
||||
static void reschedule_signals(struct proc *p, sigset_t block, int flags);
|
||||
@ -611,8 +611,8 @@ static __inline int
|
||||
sigprop(int sig)
|
||||
{
|
||||
|
||||
if (sig > 0 && sig < NSIG)
|
||||
return (sigproptbl[_SIG_IDX(sig)]);
|
||||
if (sig > 0 && sig < nitems(sigproptbl))
|
||||
return (sigproptbl[sig]);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user