Xref: utzoo comp.unix.questions:18651 comp.unix.wizards:19945 comp.lang.c:24774 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!sun-barr!newstop!sun!snafu!lm From: lm@snafu.Sun.COM (Larry McVoy) Newsgroups: comp.unix.questions,comp.unix.wizards,comp.lang.c Subject: Re: what does O_EXCL open flag do? Message-ID: <129748@sun.Eng.Sun.COM> Date: 30 Dec 89 00:13:29 GMT References: <479@dios.hf.intel.com> Sender: news@sun.Eng.Sun.COM Reply-To: lm@sun.UUCP (Larry McVoy) Organization: Sun Microsystems, Mountain View Lines: 16 In article <479@dios.hf.intel.com> martin@clubmed.hf.intel.com (Martin Wilde) writes: >Does anyone know what the O_EXCL flag for the open call is >supposed to do? I have read the POSIX spec, but I don't quite >understand what the flag is for. The only thing that >the POSIX spec says is that if O_EXCL and O_CREAT are set, open() >shall fail if the file exists. What if just O_EXCL is set? Yeah, it's a misnomer. As far as I know, it's only generic use is the one you describe (commonly used to implement a crude form of semaphore). I think that some device drivers may also look at this flag to mean exclusive (i.e, one user). --- What I say is my opinion. I am not paid to speak for Sun, I'm paid to hack. Larry McVoy, Sun Microsystems (415) 336-7627 ...!sun!lm or lm@sun.com