[comp.unix.wizards] OK to expect O_SYNC?

npl@cbnewsi.att.com (nickolas.landsberg) (05/22/90)

In article <891@nlsun1.oracle.nl> bengsig@oracle.nl (Bjorn Engsig) writes:
>There has been a discussion in comp.databases about the O_SYNC flag, write(),
>etc.  This should be taken up in this group.
>
>Included are abstracts from the discussion (I hope I got the quotations right,
>else please excuse me):
	[ much deleted for brevity ]
>Article <1990May18.010853.19303@virtech.uucp> by cpcahil@virtech.UUCP (Conor P. Cahill) says:
>|
>|No this is not true.  All write() system calls write the data into a unix
>|kernel buffer (assuming they are writing to a file descriptor that is
>|associated with a file fed through the buffer cache (character devices
>|being a not

guy@auspex.auspex.com (Guy Harris) (05/26/90)

>I believe the O_SYNC flag is kept in the file descriptor table of the
>user structure and therefore only applies to that fd (or a dup of it) and
>not to other openings of that file descriptor (by the same process or
>by any other process.

Actually, it's kept in the file table entry, which is pointed to by
entries in the file descriptor table in the user structure.  As such, it
applies to that FD, any FDs duped from it, *and* any FDs inherited by
children of the process in which it was set (and their grandchildren,
etc.).  It doesn't apply to independent "open"s of the same file.