[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] flush stdout after printing usage()
From: |
Lionel Landwerlin |
Subject: |
Re: [Qemu-devel] [PATCH] flush stdout after printing usage() |
Date: |
Wed, 28 Jan 2009 22:51:25 +0100 |
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.
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.