qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Added SIGPWR handler to send ACPI shutdown
@ 2018-05-11 20:32 andrewjameswood
  2018-05-11 20:35 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: andrewjameswood @ 2018-05-11 20:32 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Andrew Wood

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-14 13:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-11 20:32 [Qemu-devel] [PATCH] Added SIGPWR handler to send ACPI shutdown andrewjameswood
2018-05-11 20:35 ` no-reply
2018-05-11 20:37 ` no-reply
2018-05-14 13:52 ` Stefan Hajnoczi

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).