what does O_EXCL open flag do?

Larry McVoy lm at snafu.Sun.COM
Sat Dec 30 11:13:29 AEST 1989


In article <479 at dios.hf.intel.com> martin at 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 at sun.com



More information about the Comp.unix.wizards mailing list