summaryrefslogtreecommitdiff
path: root/runner
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-09-18 11:33:07 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-09-20 16:37:05 +0100
commit0085875518027990bb58f28fa10f59d5a6833c04 (patch)
tree2d992444826689fb96189754e4572d5c6dbe63f0 /runner
parent531d3d02d5e7a2a84d61b92b28fa01b822afc399 (diff)
runner: Add signal sender name when dying
We want to know who sent us the fatal signal, for there are plenty of fingers to go around. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'runner')
-rw-r--r--runner/executor.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/runner/executor.c b/runner/executor.c
index c1cfcce83..f7183293d 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -609,6 +609,26 @@ static bool kill_child(int sig, pid_t child)
return true;
}
+static const char *get_cmdline(pid_t pid, char *buf, size_t len)
+{
+ int fd;
+
+ if (snprintf(buf, len, "/proc/%d/cmdline", pid) > len)
+ return "unknown";
+
+ fd = open(buf, O_RDONLY);
+ if (fd < 0)
+ return "unknown";
+
+ len = read(fd, buf, len - 1);
+ close(fd);
+ if (len < 0)
+ return "unknown";
+
+ buf[len] = '\0';
+ return buf;
+}
+
/*
* Returns:
* =0 - Success
@@ -886,9 +906,14 @@ 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)
- outf("Abort requested via %s, terminating children\n",
+ if (settings->log_level >= LOG_LEVEL_NORMAL) {
+ char comm[80];
+
+ outf("Abort requested by %s [%d] via %s, terminating children\n",
+ get_cmdline(siginfo.ssi_pid, comm, sizeof(comm)),
+ siginfo.ssi_pid,
strsignal(siginfo.ssi_signo));
+ }
aborting = true;
timeout = 2;