Re: which OutputStreams are buffered?
 
On Wed, 20 May 2008, Kenneth P. Turvey wrote:
On Wed, 21 May 2008 00:36:47 +0100, Tom Anderson wrote:
Even under some versions of Unix, sync does not guarantee this.
Double wow. Could you expand on that?
Honestly, I can't.  I've run into it before and I cataloged it in my head
with some strange behavior in AIX having to do with signals and
security.  It may have been another AIX quirk, but I don't recall.
It may also have been only for non-root users.  I don't remember the
details.
Fair enough. I'll keep it in mind though!
Oh christ - i just looked up what the Open Group have to say about it [1], 
and according to IEEE Std 1003.1, 2004 Edition, aka POSIX:
"The sync() function shall cause all information in memory that updates 
file systems to be scheduled for writing out to all file systems.
"The writing, although scheduled, is not necessarily complete upon return 
from sync()."
Although that's the all-files sync, and not the just-this-file fsync, 
which says:
"The fsync() function shall request that all data for the open file 
descriptor named by fildes is to be transferred to the storage device 
associated with the file described by fildes. The nature of the transfer 
is implementation-defined. The fsync() function shall not return until the 
system has completed that action or until an error is detected."
Which sounds a bit sketchy, but basically what we want. But then it comes 
back with:
"If _POSIX_SYNCHRONIZED_IO is not defined, the wording relies heavily on 
the conformance document to tell the user what can be expected from the 
system. It is explicitly intended that a null implementation is 
permitted."
Great!
tom
[1] http://www.opengroup.org/onlinepubs/000095399/functions/sync.html
-- 
see im down wid yo sci fi crew