[PATCH v4] linux: Add openat2 (BZ 31664)
Paul Eggert
eggert@cs.ucla.edu
Tue Aug 26 00:26:50 GMT 2025
On 2025-08-25 15:28, Aleksa Sarai wrote:
> CHECK_FIELDS is an extension I proposed to most extensible-struct
> syscalls that would let userspace query which bit patterns are valid
I don't see how such a feature would work in general. If the struct has
N bits, there are 2**N possible bit patterns and there's no way in
general to find out which are valid without using O(2**N) time. One
cannot simply ask "which bits can I turn on?" because that would imply
that some forbidden bit patterns are allowed. For example, a valid call
cannot set both O_DIRECTORY and O_CREAT, but a simple query saying "What
bits can I set?" must yield both those bits.
Even if there's something along these lines that might work in the
future, it's confusing that the read-only argument is 'struct open_how
*' now.
The longstanding tradition in syscalls that get and set state is to have
two arguments, one for getting and one for setting. (I am thinking of
syscalls like sigaction and sigprocmask.) If openat2 is intended for
both getting and setting it should have two arguments, not one.
More information about the Libc-alpha
mailing list