aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/vl.c b/vl.c
index a5a0f41..a485c58 100644
--- a/vl.c
+++ b/vl.c
@@ -1697,6 +1697,7 @@ static int shutdown_requested;
static int powerdown_requested;
int debug_requested;
int vmstop_requested;
+static int exit_requested;
int qemu_shutdown_requested(void)
{
@@ -1719,6 +1720,12 @@ int qemu_powerdown_requested(void)
return r;
}
+int qemu_exit_requested(void)
+{
+ /* just return it, we'll exit() anyway */
+ return exit_requested;
+}
+
static int qemu_debug_requested(void)
{
int r = debug_requested;
@@ -1789,6 +1796,12 @@ void qemu_system_powerdown_request(void)
qemu_notify_event();
}
+void qemu_system_exit_request(void)
+{
+ exit_requested = 1;
+ qemu_notify_event();
+}
+
#ifdef _WIN32
static void host_main_loop_wait(int *timeout)
{
@@ -1925,6 +1938,8 @@ static int vm_can_run(void)
return 0;
if (debug_requested)
return 0;
+ if (exit_requested)
+ return 0;
return 1;
}
@@ -1977,6 +1992,9 @@ static void main_loop(void)
if ((r = qemu_vmstop_requested())) {
vm_stop(r);
}
+ if (qemu_exit_requested()) {
+ exit(0);
+ }
}
pause_all_vcpus();
}
@@ -2330,11 +2348,9 @@ static void monitor_parse(const char *optarg, const char *mode)
if (strstart(optarg, "chardev:", &p)) {
snprintf(label, sizeof(label), "%s", p);
} else {
- if (monitor_device_index) {
- snprintf(label, sizeof(label), "monitor%d",
- monitor_device_index);
- } else {
- snprintf(label, sizeof(label), "monitor");
+ snprintf(label, sizeof(label), "compat_monitor%d",
+ monitor_device_index);
+ if (monitor_device_index == 0) {
def = 1;
}
opts = qemu_chr_parse_compat(label, optarg);
@@ -3602,6 +3618,10 @@ int main(int argc, char **argv, char **envp)
}
}
+ if (qemu_opts_foreach(&qemu_mon_opts, mon_init_func, NULL, 1) != 0) {
+ exit(1);
+ }
+
if (foreach_device_config(DEV_SERIAL, serial_parse) < 0)
exit(1);
if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0)
@@ -3714,9 +3734,6 @@ int main(int argc, char **argv, char **envp)
text_consoles_set_display(ds);
- if (qemu_opts_foreach(&qemu_mon_opts, mon_init_func, NULL, 1) != 0)
- exit(1);
-
if (gdbstub_dev && gdbserver_start(gdbstub_dev) < 0) {
fprintf(stderr, "qemu: could not open gdbserver on device '%s'\n",
gdbstub_dev);