From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LSISW-0007CZ-Ez for qemu-devel@nongnu.org; Wed, 28 Jan 2009 17:00:32 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LSISU-0007Az-Kh for qemu-devel@nongnu.org; Wed, 28 Jan 2009 17:00:31 -0500 Received: from [199.232.76.173] (port=38043 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LSISU-0007Aq-D5 for qemu-devel@nongnu.org; Wed, 28 Jan 2009 17:00:30 -0500 Received: from fk-out-0910.google.com ([209.85.128.187]:46928) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LSIST-0005t4-Vb for qemu-devel@nongnu.org; Wed, 28 Jan 2009 17:00:30 -0500 Received: by fk-out-0910.google.com with SMTP id z23so4197943fkz.2 for ; Wed, 28 Jan 2009 14:00:26 -0800 (PST) Message-ID: <4980D569.9060408@codemonkey.ws> Date: Wed, 28 Jan 2009 16:00:09 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] flush stdout after printing usage() References: <20090128184713.GA29581@kos.to> <4980BBC2.3050709@codemonkey.ws> <20090128210639.GB4155@kos.to> <1233179485.6716.7.camel@cocoduo.atr> In-Reply-To: <1233179485.6716.7.camel@cocoduo.atr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 Lionel Landwerlin wrote: > Le mercredi 28 janvier 2009 à 23:06 +0200, Riku Voipio a écrit : > >> On Wed, Jan 28, 2009 at 02:10:42PM -0600, Anthony Liguori wrote: >> >>> Riku Voipio wrote: >>> >>>> testcase: >>>> >>>> qemu-arm|grep cpu >>>> >>>> Without fflush() getting output from piped qemu is a bit random. >>>> >>> It should get flushed upon exit(). Perhaps the problem is that we're >>> using _exit() instead of exit()? >>> > > _exit does not trigger callbacks registred with at_exit. > Yes. The question is why is it being used? What at_exit handler are we trying to avoid. Regards, Anthony Liguori > from the man page : > > The function _exit() is like exit(3), but does not call any functions > registered with atexit(3) or on_exit(3). Whether it flushes standard > I/O buffers and removes temporary files created with tmpfile(3) is > implementation-dependent. On the other hand, _exit() does close open > file descriptors, and this may cause an unknown delay, waiting for > pending output to finish. If the delay is undesired, it may be useful > to call functions like tcflush(3) before calling _exit(). Whether any > pending I/O is canceled, and which pending I/O may be canceled upon > _exit(), is implementation-dependent. > > > > > >