> My C is somewhat rusty, but doesn't O_EXCL just prevent one
> from creating/opening the file if it already exists?

That's the generally accepted meaning of that flag when passed to open()
but only when used along with O_CREAT and then only with "normal" files
and even then, not always.  And you can't use open() for creating device
nodes (use mknod() for that) and you probably don't want to have to be
doing that in any case...

I just looked at the kernel sources and, as somebody already mentioned,
it appears that O_EXCL is handled above the driver level in the fs code
for block devices in completely general fashion.  It turns out that the
open() flags (including O_EXCL) are made available all the way down to
the driver level but a quick scan of the driver sources indicates that
hardly any of them pay attention to it.

The /var/lock trick is not ideal but it's known technology in common
use with no decent alternatives currently available, AFAIK.

_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Reply via email to