adding new O_* flags

Matthew Dillon dillon at apollo.backplane.com
Tue Aug 4 18:53:17 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

    This is hard, because a lot of those flags are also passed to the
    I/O routines (particularly the non-blocking control flags).

    I definitely do not want to use a 64 bit flags field, that will
    generate truely horrible code on i386.

    We may be able to move some of the flags elsewhere.  FMARK, FDEFER,
    and FHASLOCK come to mind.  It might also be possible to do something
    with O_ROOTCRED.

    I think moving FMARK, FDEFER, and FHASLOCK is the best bet.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>





More information about the Kernel mailing list