From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmNBq-0006m7-OP for qemu-devel@nongnu.org; Wed, 04 Jul 2012 06:52:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SmNBh-00088H-Vw for qemu-devel@nongnu.org; Wed, 04 Jul 2012 06:52:10 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:50573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmNBh-00087b-IF for qemu-devel@nongnu.org; Wed, 04 Jul 2012 06:52:01 -0400 Message-ID: <4FF4204D.3080607@adacore.com> Date: Wed, 04 Jul 2012 12:51:57 +0200 From: Fabien Chouteau MIME-Version: 1.0 References: <1341322722-32691-1-git-send-email-chouteau@adacore.com> <4FF3068A.50804@redhat.com> <4FF30AC2.9030905@adacore.com> <4FF415F1.70502@redhat.com> <4FF41AA4.30107@adacore.com> <4FF41BC2.9020902@redhat.com> In-Reply-To: <4FF41BC2.9020902@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Use clean shutdown request for ctrl-a x List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Paolo Bonzini , aliguori@us.ibm.com, qemu-devel@nongnu.org, Peter Maydell On 07/04/2012 12:32 PM, Kevin Wolf wrote: > Am 04.07.2012 12:27, schrieb Fabien Chouteau: >> On 07/04/2012 12:07 PM, Kevin Wolf wrote: >>> Am 03.07.2012 17:07, schrieb Fabien Chouteau: >>>> On 07/03/2012 04:49 PM, Paolo Bonzini wrote: >>>>> Il 03/07/2012 16:00, Peter Maydell ha scritto: >>>>>> I was just talking on #qemu this morning about the equivalent question >>>>>> of whether the ARM semihosting exit function ought to be doing a >>>>>> qemu_system_shutdown_request rather than a plain exit()... >>>>>> >>>>>> The interesting question for the qemu-char case is whether the code that >>>>>> feeds this magic byte to us is expecting it to have immediate effect >>>>>> or is happy to continue execution and let us shut down with a slight >>>>>> delay. >>>>> >>>>> And also whether it is supposed to obey -no-shutdown... >>>> >>>> I didn't know this option... >>>> >>>> My 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. >>>> >>>> We can create a new shutdown function that will override the >>>> -no-shutdown option to keep a consistent behavior with ctrl-a x. >>>> >>>> void qemu_system_force_shutdown(void) >>>> { >>>> no_shutdown = 0; >>>> qemu_system_shutdown_request(); >>>> } >>> >>> The same thing already exists in qemu_system_killed(). It could use the >>> same new function if you added it. Or you could reuse the existing code >>> in the ctrl-a x handler by sending SIGTERM. >>> >> >> This function will change the behavior of ctrl-a x by printing "qemu: >> terminating on signal 0". > > True (on signal 15 actually if you send SIGTERM). So using a new > qemu_system_force_shutdown() in both places is fine with me. > OK, patch on the way... Thanks, -- Fabien Chouteau