Re: [RFC PATCH] vfs: new open(2) flag to open filesystem node

From: Linus Torvalds
Date: Sun Jul 05 2009 - 20:42:19 EST




On Sun, 5 Jul 2009, Ulrich Drepper wrote:
>
> I am still not sure whether this shouldn't rather be an implementation
> of POSIX's O_SEARCH or whether it is already an O_SEARCH
> implementation.

Umm. That makes no sense at all.

O_SEARCH is only meaningful for directories. For anything else, it's not
at all POSIX - it's expressly defined to be "undefined".

So clearly, O_SEARCH is absolutely the _wrong_ thing to do. Claiming that
"it is POSIX" is pure and utter garbage, because it is _not_ POSIX in any
relevant way. Sure, POSIX allows us to have flying monkeys out of our
butts when you specify O_SEARCH, but where's the advantage? Undefined
behavior is undefined behavior.

It would be clearly and unambiguously _better_ to have another O_xyz flag,
that people can then do

#ifdef O_xyz
.. get some well-defined Linux extension behavior ..
#endif

in their source code, rather than overlead an undefined case with random
crap.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/