O_SYNC option in SVR3 open system call
John P. Nelson
jpn at teddy.UUCP
Fri Nov 14 06:18:25 AEST 1986
>> O_SYNC When opening a regular file, this flag affects subsequent
>> writes.
>>
>> Does anybody out there knows if this wait is for real or is the same BSD
>> idea of the "fflush" in which blocks are merely "scheduled" and the call
>> returns as if they were actually written to the device.
>
>The wait is for real. But what is this "same BSD idea of the 'fflush'"?
I assume that the original author meant fsync(2), not fflush(3). Fsync
takes a UNIX descriptor, and causes all blocks associated with a file
to be scheduled for write, but unfortunately, does not wait for the
physical writes to complete (the blocks may still be queued in the driver
at the time that fsync returns). This means that there is no truly reliable
way to assure that a file is synced (say, before say deleting a backup).
The original question was, does the System V O_SYNC wait for PHYSICAL I/O
to complete, or does it just avoid having any unwritten buffers in the
buffer pool (NOT necessarily the same thing!).
More information about the Comp.unix.questions
mailing list