Path: utzoo!attcan!uunet!husc6!purdue!umd5!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.unix.wizards
Subject: Re: Is write(2) "atomic" ?
Message-ID: <12424@mimsy.UUCP>
Date: 12 Jul 88 21:18:45 GMT
References: <11410005@eecs.nwu.edu> <23801@bu-cs.BU.EDU>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 13

In article <23801@bu-cs.BU.EDU> bzs@bu-cs.BU.EDU (Barry Shein) writes:
>I think the result is indeterminate (undefined), a few experiments
>here on various systems came up with some even stranger results ....

It is certainly not well-defined.  4BSD makes writes to regular files
and block special files atomic by locking the inode across the write()
call.  Character devices like terminals tend to be written atomically
only when the number of characters written fits in a cblock.  Appending
by lseek/write (rather than FAPPEND) has a race between the lseek and
the write, and so forth.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris