Received: from eggs.gnu.org ([2001:4830:134:3::10]:34465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsYTy-0004LA-Gm for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:58:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsYTw-0008NG-Kg for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:58:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsYTw-0008N2-Dp for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:58:48 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D438E155E3 for ; Fri, 7 Oct 2016 16:58:47 +0000 (UTC) From: Paolo Bonzini Date: Fri, 7 Oct 2016 18:57:49 +0200 Message-Id: <1475859483-32234-26-git-send-email-pbonzini@redhat.com> In-Reply-To: <1475859483-32234-1-git-send-email-pbonzini@redhat.com> References: <1475859483-32234-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 25/39] qemu_kill_report: Report PID name too List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Michal Privoznik From: Michal Privoznik 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 Message-Id: Signed-off-by: Paolo Bonzini --- vl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index f3abd99..6c5a51c 100644 --- a/vl.c +++ b/vl.c @@ -1675,8 +1675,12 @@ 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); + char *shutdown_cmd = qemu_get_pid_name(shutdown_pid); + + error_report("terminating on signal %d from pid " FMT_pid " (%s)", + shutdown_signal, shutdown_pid, + shutdown_cmd ? shutdown_cmd : ""); + g_free(shutdown_cmd); } shutdown_signal = -1; } -- 2.7.4