O_SYNC option in SVR3 open system call
Jim Webb
jrw at hropus.UUCP
Wed Nov 12 08:18:18 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.
And this has been an (albeit undocumented) flag in all vax and 3bx versions of
AT&T System V.
Not to go into too much detail (my hands would get probably get crushed
instead of just slapped ;-) but the kernel has two write routines, one that
just schedules the disk block to be written and another that waits for the
actually writing before returning. If O_SYNC is set, then the former is
called.
To find out whether your version of UNIX supports this, grep for SYNC in
/usr/include/sys/file.h. That will give you the octal value of the flag,
if it is available. Then, I guess to see if the kernel recognizes it,
time writes with and without the O_SYNC flag set. The latter writes should
be a good bit faster.
--
Jim Webb "Out of phase--get help" ...!ihnp4!hropus!jrw
"Use the Force, Read the Source"
More information about the Comp.unix.questions
mailing list