From 98975d54d405c45edf7bab2205d6ffb75ed90438 Mon Sep 17 00:00:00 2001 From: Michel Stam Date: Thu, 2 Oct 2014 11:56:20 +0000 Subject: [PATCH] Kill processes on shutdown Procd as it currently is does not kill the running processes during shutdown. As this might cause undesired behaviour, this should be implemented. Implementation was taken from busybox 1.19.4 Signed-off-by: Michel Stam --- state.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/state.c b/state.c index bba5966..b941634 100644 --- a/state.c +++ b/state.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include "procd.h" #include "syslog.h" @@ -75,6 +77,14 @@ static void state_enter(void) break; case STATE_HALT: + LOG("- SIGTERM processes -\n"); + kill(-1, SIGTERM); + sync(); + sleep(1); + LOG("- SIGKILL processes -\n"); + kill(-1, SIGKILL); + sync(); + sleep(1); LOG("- reboot -\n"); reboot(reboot_event); break; -- 2.11.0