From: Andrew Wood <[email protected]>
Signed-off-by: Andrew Wood <[email protected]>
---
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