From 9ad4cb6e6e88b85cb43c41eecc86b928a39ae28b Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 21 Jun 2023 14:24:15 +0200 Subject: [PATCH] return special exit code when children is killed by signal Allows the process parent of procServ to check if the child was terminated abnormally. --- procServ.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/procServ.cc b/procServ.cc index 750a6c1..e5baeea 100644 --- a/procServ.cc +++ b/procServ.cc @@ -799,6 +799,10 @@ void OnPollTimeout() snprintf(buf+strlen(buf), BUFLEN-strlen(buf), " The process was killed by signal %d", WTERMSIG(wstatus)); + // In order to exit as if we were killed, by returning e.g. 137 if + // killed by SIGKILL. + // See: https://tldp.org/LDP/abs/html/exitcodes.html + childExitCode = 128 + WTERMSIG(wstatus); } strncat(buf, NL, BUFLEN-strlen(buf)-1); SendToAll(buf, strlen(buf), NULL);