From a875170167f75e63a11f68adc0a15b4e82a6c186 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Tue, 11 May 2010 17:50:50 -0300 Subject: Revert "Monitor: Return before exiting with 'quit'" This reverts commit 0e8d2b5575938b8876a3c4bb66ee13c5d306fb6d. Next commits will do the same thing in a better way. Signed-off-by: Luiz Capitulino --- monitor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'monitor.c') diff --git a/monitor.c b/monitor.c index a1ebc5d4d2..2e202ffb20 100644 --- a/monitor.c +++ b/monitor.c @@ -1020,8 +1020,7 @@ static void do_info_cpu_stats(Monitor *mon) */ static int do_quit(Monitor *mon, const QDict *qdict, QObject **ret_data) { - monitor_suspend(mon); - qemu_system_exit_request(); + exit(0); return 0; } -- cgit 1.4.1 From 39b59d2606b3360458361ab0f5419b3262dbf46d Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Tue, 11 May 2010 18:08:20 -0300 Subject: Monitor: Return before exiting with 'quit' This is a new version of the (now reverted) following commit: 0e8d2b5575938b8876a3c4bb66ee13c5d306fb6d The 'quit' Monitor command (implemented by do_quit()) calls exit() directly, this is problematic under QMP because QEMU exits before having a chance to send the ok response. Clients don't know if QEMU exited because of a problem or because the 'quit' command has been executed. This commit fixes that by making do_quit() use qemu_system_shutdown_request(), so that we exit gracefully. Thanks to Paolo Bonzini for suggesting this solution. Signed-off-by: Luiz Capitulino --- monitor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'monitor.c') diff --git a/monitor.c b/monitor.c index 2e202ffb20..ad50f12edb 100644 --- a/monitor.c +++ b/monitor.c @@ -1020,7 +1020,10 @@ static void do_info_cpu_stats(Monitor *mon) */ static int do_quit(Monitor *mon, const QDict *qdict, QObject **ret_data) { - exit(0); + monitor_suspend(mon); + no_shutdown = 0; + qemu_system_shutdown_request(); + return 0; } -- cgit 1.4.1