svn commit: r287236 - head/bin/df

Garrett Cooper yaneurabeya at gmail.com
Sat Aug 29 07:23:43 UTC 2015


> On Aug 28, 2015, at 09:00, Allan Jude <allanjude at freebsd.org> wrote:

…

>> Libxo (iirc) doesn't install atexit handlers, which means that you need to use exit (or a reason facsimile) in order for it to flush its file streams.
>> 
>> This is unintuitive though. I wish it did the right thing as part of initializing the streams..
> 
> This has nothing to do with libxo. libxo has an optional atexit handler,
> but as long as you call xo_finish(), then everything is flushed and the
> xo handle is closed. xo_finish() is indeed called the line before this
> change.

(Just wanted to clarify/correct what I said earlier :)..)

Yes. Some of the details I was remembering were a bit correct from dealing with the bugs with usr.bin/w, but I was also blurred/said some incorrect things (as others have pointed out):

- As you said, there’s an optional atexit handler in libxo (xo_finish_atexit).
- xo_finish_atexit and xo_finish both call xo_finish_h with the NULL on r287124.
- xo_finish_h writes out data, flushes its streams via xo_flush_h, then closes them out.

exit definitely flushes file descriptors, but it doesn’t do everything that xo_finish does (for obvious reasons). This is where the statement I made was incorrect. As Warner said later on, exit flushes file descriptors (along with _exit/_Exit, with caveats noted in the POSIX spec: http://pubs.opengroup.org/onlinepubs/9699919799/functions/_exit.html ).

Thanks :),
-NGie


More information about the svn-src-head mailing list