qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: andrewjameswood@ymail.com
To: peter.maydell@linaro.org, qemu-devel@nongnu.org
Cc: Andrew Wood <awood@comms.org.uk>
Subject: [Qemu-devel] [PATCH] Added SIGPWR handler to send ACPI shutdown
Date: Fri, 11 May 2018 21:32:38 +0100	[thread overview]
Message-ID: <20180511203238.22881-1-andrewjameswood@ymail.com> (raw)

From: Andrew Wood <awood@comms.org.uk>

Signed-off-by: Andrew Wood <awood@comms.org.uk>
---
 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)
-- 
2.11.0

             reply	other threads:[~2018-05-11 20:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11 20:32 andrewjameswood [this message]
2018-05-11 20:35 ` [Qemu-devel] [PATCH] Added SIGPWR handler to send ACPI shutdown no-reply
2018-05-11 20:37 ` no-reply
2018-05-14 13:52 ` Stefan Hajnoczi

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=20180511203238.22881-1-andrewjameswood@ymail.com \
    --to=andrewjameswood@ymail.com \
    --cc=awood@comms.org.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).