All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Privoznik <mprivozn@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, armbru@redhat.com, peter.maydell@linaro.org,
	berrange@redhat.com
Subject: [Qemu-devel] [PATCH v3 2/2] qemu_kill_report: Report PID name too
Date: Wed, 21 Sep 2016 18:27:35 +0200	[thread overview]
Message-ID: <d861a4b0eaf8640e9861970ed4c60a9dbb2af68b.1474475100.git.mprivozn@redhat.com> (raw)
In-Reply-To: <cover.1474475100.git.mprivozn@redhat.com>
In-Reply-To: <cover.1474475100.git.mprivozn@redhat.com>

When qemu is being killed, its last words are:

2016-08-31T11:48:15.293587Z qemu-system-x86_64: terminating on signal 15 from pid 11180

That's nice, but what process is 11180? What if I told you we can
do better:

2016-08-31T11:48:15.293587Z qemu-system-x86_64: terminating on signal 15 from pid 11180 (/usr/sbin/libvirtd)

And that's exactly what this patch does.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 vl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/vl.c b/vl.c
index fca0487..c6890d6 100644
--- a/vl.c
+++ b/vl.c
@@ -1600,6 +1600,7 @@ static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers =
 static int reset_requested;
 static int shutdown_requested, shutdown_signal = -1;
 static pid_t shutdown_pid;
+static char *shutdown_cmd;
 static int powerdown_requested;
 static int debug_requested;
 static int suspend_requested;
@@ -1636,9 +1637,11 @@ static void qemu_kill_report(void)
              */
             error_report("terminating on signal %d", shutdown_signal);
         } else {
-            error_report("terminating on signal %d from pid " FMT_pid,
-                         shutdown_signal, shutdown_pid);
+            error_report("terminating on signal %d from pid " FMT_pid " (%s)",
+                         shutdown_signal, shutdown_pid,
+                         shutdown_cmd ? shutdown_cmd : "<unknown process>");
         }
+        g_free(shutdown_cmd);
         shutdown_signal = -1;
     }
 }
@@ -1809,6 +1812,7 @@ void qemu_system_killed(int signal, pid_t pid)
 {
     shutdown_signal = signal;
     shutdown_pid = pid;
+    shutdown_cmd = qemu_get_pid_name(pid);
     no_shutdown = 0;
 
     /* Cannot call qemu_system_shutdown_request directly because
-- 
2.8.4

  parent reply	other threads:[~2016-09-21 16:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 16:27 [Qemu-devel] [PATCH v3 0/2] Produce better termination message Michal Privoznik
2016-09-21 16:27 ` [Qemu-devel] [PATCH v3 1/2] util: Introduce qemu_get_pid_name Michal Privoznik
2016-09-21 16:32   ` Paolo Bonzini
2016-09-21 16:27 ` Michal Privoznik [this message]
2016-09-21 16:46 ` [Qemu-devel] [PATCH v3 0/2] Produce better termination message no-reply
2016-09-21 17:47 ` no-reply
2016-09-22 16:43 ` Paolo Bonzini
2016-09-26  9:02   ` Michal Privoznik
2016-09-26  9:07     ` Paolo Bonzini

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=d861a4b0eaf8640e9861970ed4c60a9dbb2af68b.1474475100.git.mprivozn@redhat.com \
    --to=mprivozn@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.