Date: Sat, 29 Aug 2015 00:23:41 -0700 From: Garrett Cooper <yaneurabeya@gmail.com> To: Allan Jude <allanjude@freebsd.org> Cc: "O'Connor, Daniel" <darius@dons.net.au>, Alexey Dokuchaev <danfe@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, Xin LI <delphij@freebsd.org> Subject: Re: svn commit: r287236 - head/bin/df Message-ID: <DB526748-7E17-468A-90BA-61CC2CCA79E9@gmail.com> In-Reply-To: <55E0859A.50504@freebsd.org> References: <201508280044.t7S0ixfW038766@repo.freebsd.org> <20150828044312.GA88538@FreeBSD.org> <CAGHfRMDw0=-ze4cd7mAoHO_n%2Bt8NdYsR0On2YE5=s_gQ4=xveg@mail.gmail.com> <20150828060458.GA20642@FreeBSD.org> <E8E510CD-EF49-489D-8DD2-1EFEBE0E470A@dons.net.au> <CD4128C8-BC71-4FC6-B4FD-9EFBA835AB39@gmail.com> <55E0859A.50504@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Aug 28, 2015, at 09:00, Allan Jude <allanjude@freebsd.org> wrote: =85 >> 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. >>=20 >> This is unintuitive though. I wish it did the right thing as part of = initializing the streams.. >=20 > 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=92s 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=92t 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=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DB526748-7E17-468A-90BA-61CC2CCA79E9>