Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IM4xf-0004bM-1v for qemu-devel@nongnu.org; Fri, 17 Aug 2007 12:46:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IM4xd-0004bA-Nq for qemu-devel@nongnu.org; Fri, 17 Aug 2007 12:46:10 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IM4xd-0004b7-Ka for qemu-devel@nongnu.org; Fri, 17 Aug 2007 12:46:09 -0400 Received: from chrom.inf.tu-dresden.de ([141.76.48.24]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IM4xc-0003MQ-8M for qemu-devel@nongnu.org; Fri, 17 Aug 2007 12:46:09 -0400 Received: from kauer by chrom.inf.tu-dresden.de with local (Exim 4.67) (envelope-from ) id 1IM4xM-00056Q-Ab for qemu-devel@nongnu.org; Fri, 17 Aug 2007 18:45:52 +0200 Date: Fri, 17 Aug 2007 18:45:52 +0200 From: Bernhard Kauer Subject: Re: [Qemu-devel] Why not use exit() instead of abort()? Message-ID: <20070817164552.GE15425@chrom.inf.tu-dresden.de> References: <20070805211355.GA2888@chrom.inf.tu-dresden.de> <20070805215121.GB17778@erizo.shearer.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070805215121.GB17778@erizo.shearer.org> 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 On Mon, Aug 06, 2007 at 07:21:21AM +0930, Dan Shearer wrote: > On Sun, Aug 05, 2007 at 11:13:55PM +0200, Bernhard Kauer wrote: > > There are a couple of places in qemu, where abort() is called. > > The most commonly used one is perhaps cpu_abort() which is called > > e.g. when a triple fault occures. > > > > As abort() does not call any atexit() function, cleanup is not > > performed. > > Tiny correction: abort() and _exit don't call atexit(), however > unix-like OSs still cleanup memory and file descriptors and other > transient resources anyway no matter how the program ended. So lack of > cleanup isn't quite as big an issue as it might seem. > > > This leaves for example the terminal in a state where > > the cursor is invisible. > > Non-transient resources such as DSOs and domain sockets are not cleaned > up by the OS, which accounts for the terminal problem you noticed. Well, the problem is here that the function term_exit() is never called, which would restore the terminal state to the old version via a tcsetattr(). > > Are there any reasons not to use exit(1) in cpu_abort()? > > Speed. I used to use abort() or _exit() for speed, ie they didn't hang > around while atexit() waited politely for timeouts. I thought if I told > the program to stop it should stop immediately :-) I would use a 'kill -TERM' for that. Bernhard