-
Notifications
You must be signed in to change notification settings - Fork 355
Open
Labels
Description
It would be nice to be able to specify --rewrite TERM:HUP
rather than using signal numbers.
Unfortunately doesn't look like there is a list of signal names available in any common headers. There's sys_siglist
(from string.h
), but the names are like Hangup
and Interrupt
, rather than the short macro names that everyone uses.
From looking at the kill
source, they define an array like this:
static const mapstruct sigtable[] = {
{"ABRT", SIGABRT}, /* IOT */
{"ALRM", SIGALRM},
{"BUS", SIGBUS},
{"CHLD", SIGCHLD}, /* CLD */
{"CONT", SIGCONT},
{"FPE", SIGFPE},
{"HUP", SIGHUP},
{"ILL", SIGILL},
{"INT", SIGINT},
{"KILL", SIGKILL},
{"PIPE", SIGPIPE},
{"POLL", SIGPOLL}, /* IO */
{"PROF", SIGPROF},
{"PWR", SIGPWR},
{"QUIT", SIGQUIT},
{"SEGV", SIGSEGV},
{"STOP", SIGSTOP},
{"SYS", SIGSYS}, /* UNUSED */
{"TERM", SIGTERM},
{"TRAP", SIGTRAP},
{"TSTP", SIGTSTP},
{"TTIN", SIGTTIN},
{"TTOU", SIGTTOU},
{"URG", SIGURG},
{"USR1", SIGUSR1},
{"USR2", SIGUSR2},
{"VTALRM", SIGVTALRM},
{"WINCH", SIGWINCH},
{"XCPU", SIGXCPU},
{"XFSZ", SIGXFSZ}
};
It's not the absolute worst (they're still using the signal macros, so they don't need to worry about signal numbers not matching the ordering in the file (or it being recompiled on a different architecture with different numbers)).
Is it worth it to do something like this in dumb-init? (or is there a better way?)
nikolay and yajo