void qemu_system_wakeup_enable(WakeupReason reason, bool enabled);
void qemu_register_wakeup_notifier(Notifier *notifier);
void qemu_register_wakeup_support(void);
+void qemu_system_shutdown_request_with_code(ShutdownCause reason,
+ int exit_code);
void qemu_system_shutdown_request(ShutdownCause reason);
void qemu_system_powerdown_request(void);
void qemu_register_powerdown_notifier(Notifier *notifier);
static ShutdownCause reset_requested;
static ShutdownCause shutdown_requested;
+static int shutdown_exit_code = EXIT_SUCCESS;
static int shutdown_signal;
static pid_t shutdown_pid;
static int powerdown_requested;
qemu_notify_event();
}
+void qemu_system_shutdown_request_with_code(ShutdownCause reason,
+ int exit_code)
+{
+ shutdown_exit_code = exit_code;
+ qemu_system_shutdown_request(reason);
+}
+
void qemu_system_shutdown_request(ShutdownCause reason)
{
trace_qemu_system_shutdown_request(reason);
if (shutdown_action == SHUTDOWN_ACTION_PAUSE) {
vm_stop(RUN_STATE_SHUTDOWN);
} else {
- if (request == SHUTDOWN_CAUSE_GUEST_PANIC &&
+ if (shutdown_exit_code != EXIT_SUCCESS) {
+ *status = shutdown_exit_code;
+ } else if (request == SHUTDOWN_CAUSE_GUEST_PANIC &&
panic_action == PANIC_ACTION_EXIT_FAILURE) {
*status = EXIT_FAILURE;
}