From patchwork Wed Sep 21 16:27:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Privoznik X-Patchwork-Id: 9343885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A5FFF6077A for ; Wed, 21 Sep 2016 16:45:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A62B72A695 for ; Wed, 21 Sep 2016 16:45:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98B172A7A9; Wed, 21 Sep 2016 16:45:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 302012A695 for ; Wed, 21 Sep 2016 16:45:03 +0000 (UTC) Received: from localhost ([::1]:44201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmkdq-0001ye-A8 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Sep 2016 12:45:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmkND-0003nj-BG for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:27:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmkN7-00019U-UG for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:27:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmkN7-00019D-Ov for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:27:45 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 52D803D968; Wed, 21 Sep 2016 16:27:45 +0000 (UTC) Received: from lisa.brq.redhat.com (dhcp129-142.brq.redhat.com [10.34.129.142]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8LGRe37030743; Wed, 21 Sep 2016 12:27:44 -0400 From: Michal Privoznik To: qemu-devel@nongnu.org Date: Wed, 21 Sep 2016 18:27:35 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 21 Sep 2016 16:27:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 2/2] qemu_kill_report: Report PID name too X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, armbru@redhat.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Eric Blake --- 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 : ""); } + 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