O_SYNC option in SVR3 open system call
Guy Harris
guy at sun.uucp
Tue Nov 11 06:31:44 AEST 1986
> O_SYNC When opening a regular file, this flag affects subsequent
> writes. If set, each write (2) will wait for both the file
> data and file status to be physically updated.
>
> 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'"?
First of all, "fflush" is a part of standard I/O, and if you do an "fflush"
it ends up doing "write" calls, so the notion of a delayed or asynchronous
write is *not* a property of "fflush", but a property of "write". Second,
"fflush" isn't a "BSD idea" at all; it, like a lot of other things in 4BSD,
dates back to V7 (actually, it dates back even further than that) and, as
such, should be called an "AT&T idea". Third, the notion of a delayed or
asynchronous write also considerably predates even 1BSD. Finally, there
*is* a "BSD idea" relating to this; however, it is the idea of an "fsync"
call to flush blocks to the device, and it *does* wait (for real) until the
blocks are actually written to the device.
--
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
guy at sun.com (or guy at sun.arpa)
More information about the Comp.unix.wizards
mailing list