From 01ac2c4500cb0c7934640e6d2e5f99b08483bdf4 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 16 Nov 2021 03:06:36 +0000 Subject: [PATCH] procd: service_stop_all: also kill inittab actions Also send SIGKILL to all actions spawned by inittab. Signed-off-by: Daniel Golle --- inittab.c | 14 ++++++++++++++ procd.h | 1 + service/service.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/inittab.c b/inittab.c index b2ffc9a..128268a 100644 --- a/inittab.c +++ b/inittab.c @@ -123,6 +123,9 @@ static void child_exit(struct uloop_process *proc, int ret) DEBUG(4, "pid:%d, exitcode:%d\n", proc->pid, ret); proc->pid = 0; + if (a->respawn < 0) + return; + if (!dev_exist(a->id)) { DEBUG(4, "Skipping respawn: device '%s' does not exist anymore\n", a->id); return; @@ -293,6 +296,17 @@ void procd_inittab_run(const char *handler) } } +void procd_inittab_kill(void) +{ + struct init_action *a; + + list_for_each_entry(a, &actions, list) { + a->respawn = -1; + if (a->proc.pid) + kill(a->proc.pid, SIGKILL); + } +} + void procd_inittab(void) { #define LINE_LEN 128 diff --git a/procd.h b/procd.h index caaf3e4..fd29a12 100644 --- a/procd.h +++ b/procd.h @@ -43,6 +43,7 @@ void procd_signal(void); void procd_signal_preinit(void); void procd_inittab(void); void procd_inittab_run(const char *action); +void procd_inittab_kill(void); void procd_bcast_event(char *event, struct blob_attr *msg); struct trigger; diff --git a/service/service.c b/service/service.c index 5c66fb2..bb3e121 100644 --- a/service/service.c +++ b/service/service.c @@ -676,7 +676,7 @@ service_stop_all(void) service_avl_stop_all(&containers, &term_timeout); service_avl_stop_all(&services, &term_timeout); - /* ToDo: inittab */ + procd_inittab_kill(); sleep(term_timeout); } -- 2.30.2