adding new O_* flags
Nicolas Thery
nthery at gmail.com
Sun Aug 2 07:37:52 PDT 2009
Hello,
I'm trying to implement the new POSIX open(2) flags O_DIRECTORY,
O_SEARCH and O_EXEC described here:
http://www.opengroup.org/onlinepubs/9699919799/functions/openat.html#tag_16_414
I noticed that struct file.f_flags that stores the POSIX O_* flags and
some kernel internal ones has only one bit left (0x08000000).
I can see several options:
1/ Do not implement O_DIRECTORY, O_SEARCH and O_EXEC (it doesn't seem
implemented (yet?) elsewhere).
2/ Use the single remaining bit for O_SEARCH and O_EXEC and overlay
O_DIRECTORY with some kernel internal bit. Multiplexing O_SEARCH and
O_EXEC is fine because both involves checking the x permission bit
under the hood. Overlaying O_DIRECTORY is fine too as it is only used
at open() time and does not need to be stored in f_flags.
3/ Extend f_flags to 64 bits, move all the kernel internal bits in the
most significant 32 bits and use the lower 32-bit for POSIX flags.
4/ Add a new internal flags int to struct file and move all kernel
internal bits here.
I favor either (3) or (2).
Do you have a preference?
Cheers,
Nicolas
More information about the Kernel
mailing list