How to open a device for exclusive access?

Dave Johnson dave-gnhlug at davej.org
Mon Jul 16 09:00:39 EDT 2007


Ben Scott writes:
> On 7/15/07, Steven W. Orr <steveo at syslang.net> wrote:
> > ... my particular problem would be
> > solved if the char device I was trying to open would only honor O_EXCL.
> 
>   My C is somewhat rusty, but doesn't O_EXCL just prevent one from
> creating/opening the file if it already exists?

For regular files yes, but char and block drivers can do whatever they
want with the open flags.  Some drivers use O_EXCL for exclusive
access to a device.

-- 
Dave



More information about the gnhlug-discuss mailing list