History (re: what's needed is a application barrier() call
History (re: what's needed is a application barrier() call
Posted Sep 10, 2009 16:18 UTC (Thu) by davecb (subscriber, #1574)In reply to: what's needed is a application barrier() call by dlang
Parent article: POSIX v. reality: A position on O_PONIES
Rename was one of the two Unix V6 system calls which were documented as being necessary and sufficient to allow one to do atomicity and locking: the other was open(... O_EXCL|O_CREAT). The latter atomically creates files, the former atomically changes them, including atomically making them cease to exist. I rather expect Thompson and Ritchie would be bemused by some of the discussion to date (;-)
--dave
Posted Sep 10, 2009 20:18 UTC (Thu)
by aegl (subscriber, #37581)
[Link] (1 responses)
Nope. "rename" wasn't in V6 (see http://minnie.tuhs.org/UnixTree/V6/usr/sys/ken/sysent.c.html).
"the other was open(... O_EXCL|O_CREAT)"
V6 open(2) didn't have all those fancy O_* options. You just got the choice of FREAD, FWRITE, or both.
Applications in V6 era typically used "link(2)" as their locking primitive (create a randomly named tempfile, then link that to a statically named lockfile. If the link call succeeds, you own the lock. If you get EEXIST, then someone else does).
Posted Sep 10, 2009 21:03 UTC (Thu)
by davecb (subscriber, #1574)
[Link]
--dave
History (re: what's needed is a application barrier() call
History (re: what's needed is a application barrier() call
the open/rename indeed come later.