From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoXUk-0001tS-Ai for qemu-devel@nongnu.org; Tue, 10 Jul 2012 06:16:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoXUc-0002M1-Jj for qemu-devel@nongnu.org; Tue, 10 Jul 2012 06:16:37 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:54699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoXUc-0002Lp-AW for qemu-devel@nongnu.org; Tue, 10 Jul 2012 06:16:30 -0400 Message-ID: <4FFC00F0.8070101@adacore.com> Date: Tue, 10 Jul 2012 12:16:16 +0200 From: Fabien Chouteau MIME-Version: 1.0 References: <1341399884-2135-1-git-send-email-chouteau@adacore.com> <4FFAB01B.2050504@adacore.com> <4FFACC1F.70807@suse.de> In-Reply-To: <4FFACC1F.70807@suse.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: =?ISO-8859-1?Q?Andreas_F=E4rber?= Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com, qemu-devel@nongnu.org, =?ISO-8859-1?Q?Herv=E9_Pouss?= =?ISO-8859-1?Q?ineau?= , pbonzini@redhat.com On 07/09/2012 02:18 PM, Andreas F=E4rber wrote: > Am 09.07.2012 12:19, schrieb Fabien Chouteau: >> Any comment? >> >> 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 curren= t >>> 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, Mu= xDriver *d, int ch) >>> { >>> const char *term =3D "QEMU: Terminated\n\r"; >>> chr->chr_write(chr,(uint8_t *)term,strlen(term)); >>> - exit(0); >>> + qemu_system_force_shutdown(); >>> break; >>> } >>> case 's': >=20 > FWIW there was a recent patch by Herv=E9 that exposed further occurrenc= es > of exit(), probably all would need to be reviewed and fixed. >=20 There's a lot of exit() in Qemu (~660 with a quick grep), but it doesn't always make sense to change them all. In my opinion this one is a clean user request to shutdown the system, as opposed to an error state that requires exit(). --=20 Fabien Chouteau