From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoB5V-00037C-OK for qemu-devel@nongnu.org; Mon, 09 Jul 2012 06:21:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoB5T-00039z-RB for qemu-devel@nongnu.org; Mon, 09 Jul 2012 06:21:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoB5T-00039r-Ix for qemu-devel@nongnu.org; Mon, 09 Jul 2012 06:21:03 -0400 Message-ID: <4FFAB070.7050701@redhat.com> Date: Mon, 09 Jul 2012 12:20:32 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1341399884-2135-1-git-send-email-chouteau@adacore.com> <4FFAB01B.2050504@adacore.com> In-Reply-To: <4FFAB01B.2050504@adacore.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2] Use clean shutdown request for ctrl-a x List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fabien Chouteau , qemu-devel@nongnu.org, Blue Swirl Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com Il 09/07/2012 12:19, Fabien Chouteau ha scritto: > Any comment? Looks good to me. Blue, can you apply it while Anthony is on holiday? Paolo > On 07/04/2012 01:04 PM, Fabien Chouteau wrote: >> The goal is to make ctrl-a x to close Qemu in a clean way. The current >> exit(0) skips a lot of cleanup/close functions, for example in block >> drivers. >> >> Signed-off-by: Fabien Chouteau >> --- >> qemu-char.c | 2 +- >> sysemu.h | 1 + >> vl.c | 5 +++++ >> 3 files changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/qemu-char.c b/qemu-char.c >> index c2aaaee..7732846 100644 >> --- a/qemu-char.c >> +++ b/qemu-char.c >> @@ -353,7 +353,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch) >> { >> const char *term = "QEMU: Terminated\n\r"; >> chr->chr_write(chr,(uint8_t *)term,strlen(term)); >> - exit(0); >> + qemu_system_force_shutdown(); >> break; >> } >> case 's': >> diff --git a/sysemu.h b/sysemu.h >> index bc2c788..2b2c354 100644 >> --- a/sysemu.h >> +++ b/sysemu.h >> @@ -50,6 +50,7 @@ void qemu_register_suspend_notifier(Notifier *notifier); >> void qemu_system_wakeup_request(WakeupReason reason); >> void qemu_system_wakeup_enable(WakeupReason reason, bool enabled); >> void qemu_register_wakeup_notifier(Notifier *notifier); >> +void qemu_system_force_shutdown(void); >> void qemu_system_shutdown_request(void); >> void qemu_system_powerdown_request(void); >> void qemu_system_debug_request(void); >> diff --git a/vl.c b/vl.c >> index 1329c30..bd27583 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -1477,6 +1477,11 @@ void qemu_system_killed(int signal, pid_t pid) >> { >> shutdown_signal = signal; >> shutdown_pid = pid; >> + qemu_system_force_shutdown(); >> +} >> + >> +void qemu_system_force_shutdown(void) >> +{ >> no_shutdown = 0; >> qemu_system_shutdown_request(); >> } >> > >