summaryrefslogtreecommitdiff
path: root/runner
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-09-23 12:17:40 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-09-23 14:16:26 +0100
commit209a8dc3275db33e548e2d111b1159648c9d7f9e (patch)
treead54bcda130a29c724d244a2e8ddf715c44d3a82 /runner
parentaa534ff47fd2f455c8be9e59eae807695b87fcdd (diff)
runner: Show more elements of the signaler's argv[]
/proc/$pid/cmdline is the entire argv[] including NUL-terminators. Replace the NULs with spaces so we get a better idea of who the signaler was, as often it is a subprocess (such as a child of sudo, or worse java). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'runner')
-rw-r--r--runner/executor.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/runner/executor.c b/runner/executor.c
index f7183293..3e012142 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -609,7 +609,7 @@ static bool kill_child(int sig, pid_t child)
return true;
}
-static const char *get_cmdline(pid_t pid, char *buf, size_t len)
+static const char *get_cmdline(pid_t pid, char *buf, ssize_t len)
{
int fd;
@@ -625,7 +625,12 @@ static const char *get_cmdline(pid_t pid, char *buf, size_t len)
if (len < 0)
return "unknown";
- buf[len] = '\0';
+ /* cmdline is the whole argv[], completed with NUL-terminators */
+ for (size_t i = 0; i < len; i++)
+ if (buf[i] == '\0')
+ buf[i] = ' ';
+
+ buf[len] = '\0'; /* but make sure that we return a valid string! */
return buf;
}
@@ -907,7 +912,7 @@ static int monitor_output(pid_t child,
} else {
/* We're dying, so we're taking them with us */
if (settings->log_level >= LOG_LEVEL_NORMAL) {
- char comm[80];
+ char comm[120];
outf("Abort requested by %s [%d] via %s, terminating children\n",
get_cmdline(siginfo.ssi_pid, comm, sizeof(comm)),