From patchwork Mon Mar 14 12:58:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 86734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DB0DFB6F8D for ; Mon, 14 Mar 2011 23:59:38 +1100 (EST) Received: from localhost ([127.0.0.1]:33614 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pz7Mz-0006oP-2g for incoming@patchwork.ozlabs.org; Mon, 14 Mar 2011 08:59:33 -0400 Received: from [140.186.70.92] (port=43256 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pz7MU-0006nN-0R for qemu-devel@nongnu.org; Mon, 14 Mar 2011 08:59:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pz7MR-0001c8-TR for qemu-devel@nongnu.org; Mon, 14 Mar 2011 08:59:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pz7MR-0001bc-L2 for qemu-devel@nongnu.org; Mon, 14 Mar 2011 08:58:59 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2ECwvHa032663 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Mar 2011 08:58:57 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2ECwuTQ031220 for ; Mon, 14 Mar 2011 08:58:57 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 82B5018D3E9; Mon, 14 Mar 2011 14:58:55 +0200 (IST) Date: Mon, 14 Mar 2011 14:58:55 +0200 From: Gleb Natapov To: qemu-devel@nongnu.org Message-ID: <20110314125855.GP10151@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] report that QEMU process was killed by a signal X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Currently when rogue script kills QEMU process (using TERM/INT/HUP signal) it looks indistinguishable from system shutdown. Lets report that QMEU was killed and leave some clues about the killed identity. Signed-off-by: Gleb Natapov --- Gleb. diff --git a/os-posix.c b/os-posix.c index 38c29d1..7e175e8 100644 --- a/os-posix.c +++ b/os-posix.c @@ -61,8 +61,9 @@ void os_setup_early_signal_handling(void) sigaction(SIGPIPE, &act, NULL); } -static void termsig_handler(int signal) +static void termsig_handler(int signal, siginfo_t *info, void *c) { + fprintf(stderr, "Got signal %d from pid %d\n", info->si_signo, info->si_pid); qemu_system_shutdown_request(); } @@ -76,7 +77,8 @@ void os_setup_signal_handling(void) struct sigaction act; memset(&act, 0, sizeof(act)); - act.sa_handler = termsig_handler; + act.sa_sigaction = termsig_handler; + act.sa_flags = SA_SIGINFO; sigaction(SIGINT, &act, NULL); sigaction(SIGHUP, &act, NULL); sigaction(SIGTERM, &act, NULL);