From d8e8035081a1a859c7323d19b1c98ad12f824413 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Fri, 24 May 2019 07:13:27 +1000 Subject: [PATCH] Add KILL support to term-signal setting. Also have renamed termsignal to term-signal for consistency, but the old name remains supported. --- NEWS | 2 ++ doc/manpages/dinit-service.5 | 6 +++--- src/dasynq/dasynq-select.h | 1 + src/load-service.cc | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 0f6cc43..a0c3cd5 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ preceding release. * Fix for crash due to SIGALRM on OpenBSD. * Fixes for compiling with Musl C library. * Fix dinitctl "enable" and "disable" commands when path to service directory is absolute. + * "termsignal" setting renamed "term-signal" and now supports "KILL" signal. "termsignal" + is still supported for compatibility with existing service descriptions. * Other minor fixes. == Version 0.5.0: diff --git a/doc/manpages/dinit-service.5 b/doc/manpages/dinit-service.5 index 4128822..99d27da 100644 --- a/doc/manpages/dinit-service.5 +++ b/doc/manpages/dinit-service.5 @@ -214,13 +214,13 @@ specified, the socket will be owned by the user id of the Dinit process. Specifies the group of the activation socket. See discussion of \fBsocket\-uid\fR. .TP -\fBtermsignal\fR = {HUP | INT | QUIT | USR1 | USR2} +\fBterm\-signal\fR = {HUP | INT | QUIT | USR1 | USR2 | KILL} Specifies an additional signal to send to the process when requesting it to terminate (applies to 'process' services only). SIGTERM is always -sent along with the specified signal, unless the \fBnosigterm\fR option is +sent along with the specified signal, unless the \fBno\-sigterm\fR option is specified via the \fBoptions\fR parameter. .TP -\fBready-notification\fR = {\fBpipefd:\fR\fIfd-number\fR | \fBpipevar:\fR\fIenv-var-name\fR} +\fBready\-notification\fR = {\fBpipefd:\fR\fIfd-number\fR | \fBpipevar:\fR\fIenv-var-name\fR} Specifies the mechanism, if any, by which a process service will notify that it is ready (successfully started). If not specified, a process service is considered started as soon as it has begun execution. The two options are: diff --git a/src/dasynq/dasynq-select.h b/src/dasynq/dasynq-select.h index 4c96e2c..e0ce78a 100644 --- a/src/dasynq/dasynq-select.h +++ b/src/dasynq/dasynq-select.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/src/load-service.cc b/src/load-service.cc index 97d8b7a..d4b653a 100644 --- a/src/load-service.cc +++ b/src/load-service.cc @@ -30,6 +30,7 @@ static int signal_name_to_number(std::string &signame) if (signame == "QUIT") return SIGQUIT; if (signame == "USR1") return SIGUSR1; if (signame == "USR2") return SIGUSR2; + if (signame == "KILL") return SIGKILL; return -1; } @@ -549,7 +550,8 @@ service_record * dirload_service_set::load_service(const char * name) } } } - else if (setting == "termsignal") { + else if (setting == "term-signal" || setting == "termsignal") { + // Note: "termsignal" supported for legacy reasons. string signame = read_setting_value(i, end, nullptr); int signo = signal_name_to_number(signame); if (signo == -1) { -- 2.25.1