From: Chris Wilson <chris@chris-wilson.co.uk>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t] runner: Add signal sender name when dying
Date: Wed, 18 Sep 2019 11:35:18 +0100 [thread overview]
Message-ID: <20190918103518.22012-1-chris@chris-wilson.co.uk> (raw)
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>
---
runner/executor.c | 29 +++++++++++++++++++++++++++--
1 file 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;
--
2.23.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-09-18 10:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-18 10:35 Chris Wilson [this message]
2019-09-18 10:45 ` [igt-dev] [PATCH i-g-t] runner: Add signal sender name when dying Petri Latvala
2019-09-18 10:49 ` Chris Wilson
2019-09-18 11:23 ` Petri Latvala
2019-09-18 12:41 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190918103518.22012-1-chris@chris-wilson.co.uk \
--to=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
--cc=petri.latvala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox