Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!ncar!oddjob!kaon!nucsrl!naim From: naim@eecs.nwu.edu (Naim Abdullah) Newsgroups: comp.unix.wizards Subject: Re: Is write(2) "atomic" ? Message-ID: <11410006@eecs.nwu.edu> Date: 14 Jul 88 07:32:04 GMT References: <11410005@eecs.nwu.edu> Organization: Northwestern U, Evanston IL, USA Lines: 20 Chris Torek pointed out that the fact that concurrent writes may result in loss of data, is due to a bug in 4.2BSD. The bug persists in 4.3BSD (at least in Mt. Xinu's 4.3+NFS). However, I was able to solve the original problem by using O_APPEND when I open(2)'ed the output file. This seems to result in atomic writes. Thanks to haynes@ucscc.ucsc.edu for this suggestion. He also pointed out that the 4.3bsd login(1) opens wtmp using O_APPEND as login faces the same problem of multiple concurrent writers to the same wtmp file (when many people are logging in and out at the same time). I just checked our System V rel 3.1 sources and the system V login fseeks before fwriting to wtmp so I imagine it will suffer from this problem too. Naim Abdullah Dept. of EECS, Northwestern University Internet: naim@eecs.nwu.edu Uucp: {oddjob, chinet, gargoyle}!nucsrl!naim