From patchwork Fri May 11 20:32:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10395343 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 0A11160153 for ; Fri, 11 May 2018 20:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF48E28FBF for ; Fri, 11 May 2018 20:34:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D15B028FC3; Fri, 11 May 2018 20:34:06 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 A311728FBF for ; Fri, 11 May 2018 20:34:05 +0000 (UTC) Received: from localhost ([::1]:42912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHEjq-0001qO-Jg for patchwork-qemu-devel@patchwork.kernel.org; Fri, 11 May 2018 16:34:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHEif-0001UA-AG for qemu-devel@nongnu.org; Fri, 11 May 2018 16:32:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHEia-0004a0-Do for qemu-devel@nongnu.org; Fri, 11 May 2018 16:32:49 -0400 Received: from sonic305-21.consmr.mail.ir2.yahoo.com ([77.238.177.83]:37089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHEia-0004Yk-6k for qemu-devel@nongnu.org; Fri, 11 May 2018 16:32:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s2048; t=1526070762; bh=drjenuGE2LnkV4QAyy5gy9WMtph86MgFYFxvtio65dE=; h=From:To:Cc:Subject:Date:From:Subject; b=T0kRJ8f+IuyzENZ5aYtPIKnInE90A7KPMVBh3FKZbC89M06SZZGXIoEXnTfh0+FwpiLa6F06pL8N2b2Zz59ebWGDvZyawTyFlwBt+6dEZpfQw3DNT15bF1cxQWeLQwohCoCoHGBN9W3egmaCooPDaK9OrHdwB4efdYGzVUWi21JKgJVEVkn3LRGfOkYy/Fn757bg+7brpoRZSF0EgfCqX+h96AukNV7+3XyIo+eP2LOo1HEi0e7sBraZ8HzzR6CHMUSSBA9w+6HnEw3CfQr6OPH4k2YM6i7GuCk9Sa3ju7HdnROFFB8S+K1G7+XX+nJsZFIYyOJsweW24sTo3ECT9g== X-YMail-OSG: 79TMh4sVM1mCVk4ijHo.MYN3UIAwEdNMXclTGR0XiQlUPBvffXkdPHeUny3NeMp Qs8CjHjwfj_liiNOR20FbhBfWmfldsKHWObR9STm0Vw0IgrWqfGCckQLsARe.x_qejyuSRKsnnmt kfvR1A.KjMW2QnxZqeGbJNwu.xOrYZ5gMmuwcdZUBlnwrdYFPNkWQmszLdN10aaEUyNENMWtQseo 1bUakTihNXmGlsjKTYGHcp6_CC0O6YxoLDFee.VRmNYAQzn1ePxpIe8KlNRYGpV46iGlP_jHsmUm 2.cbw_O5PGtCROKU3ZT2ZneHeTE5Q_NDRkUqv8niKAD3e4nPaMa7Gs2oB3_jgn7a159K93hB6P4p Loep97fWqeFr3NfEb4bxaUp5BOtFUufMZbFDOP9azF2VU3wDvWmEmKgsaj0m_Lb4B_5dL1p34z6M LoVQCdtEa6rW8KMzaSvLMM7j7YyQhRpo3FZdZsZB41eZEkMY7Cr3udfQblQbFBT8d82AIym5uZIj wvYJ0yC_u4t8Ap9tRcfD4c0DtGuhKKQ9aG7JKx4yz5LxIhh47got5vOCWcApzLXb8W4H1xlRoSZm lAipHcZKmHR6gCWzIzWKgTEFzhWU6C2iPTu9H9q5YeVi5jf8xjC64bepotppqhDUqGScqLsYMfDy JaxJxbzr4xBfFdxFA Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ir2.yahoo.com with HTTP; Fri, 11 May 2018 20:32:42 +0000 Received: from host109-151-162-242.range109-151.btcentralplus.com (EHLO localhost.localdomain) ([109.151.162.242]) by smtp411.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID e59163596d302a6e66057ea6bc9e2b1c; Fri, 11 May 2018 20:32:41 +0000 (UTC) To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 11 May 2018 21:32:38 +0100 Message-Id: <20180511203238.22881-1-andrewjameswood@ymail.com> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 77.238.177.83 Subject: [Qemu-devel] [PATCH] Added SIGPWR handler to send ACPI shutdown 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: , X-Patchwork-Original-From: andrewjameswood--- via Qemu-devel From: "Denis V. Lunev\" via" Reply-To: andrewjameswood@ymail.com Cc: Andrew Wood Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Andrew Wood Signed-off-by: Andrew Wood --- os-posix.c | 1 + vl.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/os-posix.c b/os-posix.c index b9c2343b1e..68d70f269b 100644 --- a/os-posix.c +++ b/os-posix.c @@ -70,6 +70,7 @@ void os_setup_signal_handling(void) sigaction(SIGINT, &act, NULL); sigaction(SIGHUP, &act, NULL); sigaction(SIGTERM, &act, NULL); + sigaction(SIGPWR, &act, NULL); } /* Find a likely location for support files using the location of the binary. diff --git a/vl.c b/vl.c index fce1fd12d8..55c5e06858 100644 --- a/vl.c +++ b/vl.c @@ -1846,8 +1846,17 @@ void qemu_system_killed(int signal, pid_t pid) /* Cannot call qemu_system_shutdown_request directly because * we are in a signal handler. */ - shutdown_requested = SHUTDOWN_CAUSE_HOST_SIGNAL; - qemu_notify_event(); + if (signal==SIGPWR) + { + + powerdown_requested = 1; + qemu_notify_event(); + } + else + { + shutdown_requested = SHUTDOWN_CAUSE_HOST_SIGNAL; + qemu_notify_event(); + } } void qemu_system_shutdown_request(ShutdownCause reason)