Undocumented feature in Sys5: synchronous write

Michael Uhlenberg uh at pcsbst.UUCP
Tue May 8 23:47:48 AEST 1984


Normally, writes to normal files are cached in the buffer pool and
written out to disk with some delay.
Some database people asked me to introduce a "write-through" system
call, i.e. a write that writes data immediately to disk, thus avoiding
disk consistency problems after a system crash. Looking at the Sys5 code,
I found that the code for doing this is already there: in <sys/file.h>
you have
	#define FSYNC   00020
but an appropriate define
	#define O_SYNC  00020
is missing from <fcntl.h> and also the docu doesn't mention it.
However, you can or 020 to your open mode, and get the desired effect.
-- 
Michael "Es gibt ein neues Uuuuunix" Uhlenberg



More information about the Comp.unix.wizards mailing list