From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KWUBm-00035u-Qm for qemu-devel@nongnu.org; Fri, 22 Aug 2008 06:48:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KWUBi-00032A-AP for qemu-devel@nongnu.org; Fri, 22 Aug 2008 06:48:17 -0400 Received: from [199.232.76.173] (port=54771 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWUBh-00031p-RT for qemu-devel@nongnu.org; Fri, 22 Aug 2008 06:48:13 -0400 Received: from lizzard.sbs.de ([194.138.37.39]:15400) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KWUBf-0003jj-CO for qemu-devel@nongnu.org; Fri, 22 Aug 2008 06:48:12 -0400 Received: from mail1.sbs.de (localhost [127.0.0.1]) by lizzard.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m7MAm3FT008376 for ; Fri, 22 Aug 2008 12:48:03 +0200 Received: from [139.25.109.167] (mchn012c.ww002.siemens.net [139.25.109.167] (may be forged)) by mail1.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m7MAm24b026731 for ; Fri, 22 Aug 2008 12:48:03 +0200 Message-ID: <48AE9963.5040603@siemens.com> Date: Fri, 22 Aug 2008 12:48:03 +0200 From: Jan Kiszka MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [5055] Handle terminating signals (Gerd Hoffmann) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Anthony Liguori wrote: > Revision: 5055 > http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5055 > Author: aliguori > Date: 2008-08-21 20:08:03 +0000 (Thu, 21 Aug 2008) > > Log Message: > ----------- > Handle terminating signals (Gerd Hoffmann) > > This patch makes qemu handle signals better. It sets the request_shutdown > flag, making the main_loop exit and qemu taking the usual exit route, with > atexit handlers being called and so on, instead of qemu just being killed > by the signal. > > To avoid calling vm_start() from the signal handler main_loop() got an > additional check so qemu_system_shutdown_request() works even when the > vm is in stopped state. > > Signed-off-by: Gerd Hoffmann > Signed-off-by: Anthony Liguori > ... > Modified: trunk/vl.c > =================================================================== > --- trunk/vl.c 2008-08-21 19:33:09 UTC (rev 5054) > +++ trunk/vl.c 2008-08-21 20:08:03 UTC (rev 5055) > @@ -7621,6 +7621,8 @@ > timeout = 0; > } > } else { > + if (shutdown_requested) > + break; > timeout = 10; > } > #ifdef CONFIG_PROFILER Could we define the policy that no patch is merged which introduces new compiler warnings? Fix below remove the one caused by the hunk above, but it still leaves some doubts for the semi-informed reader because the "if (shutdown_requested)" block under vm_running also checks for no_shutdown. Please confirm that leaving it out here was by intention. Jan -------- Always return EXCP_INTERRUPT when leaving main_loop due to shutdown_requested. Signed-off-by: Jan Kiszka --- vl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: b/vl.c =================================================================== --- a/vl.c +++ b/vl.c @@ -7624,8 +7624,10 @@ static int main_loop(void) timeout = 0; } } else { - if (shutdown_requested) + if (shutdown_requested) { + ret = EXCP_INTERRUPT; break; + } timeout = 10; } #ifdef CONFIG_PROFILER