The rootfd and cwdfd always having to be the same fd with openat2(2) is quite inconvenient and it makes implementing things like symlink-follow O_CREAT support not really possible in a nice way (i.e., without completely re-doing lookups an unbounded number of times), and some other problems are almost intractable without this interface.
Options are to have one bit (RESOLVE_WITH_ROOTFD) that must be used with RESOLVE_IN_ROOT or RESOLVE_BENEATH, or just have two new versions of those flags (RESOLVE_IN_ROOTFD, RESOLVE_BENEATH_ROOTFD or RESOLVE_BENEATHFD).
The rootfd and cwdfd always having to be the same fd with
openat2(2)is quite inconvenient and it makes implementing things like symlink-followO_CREATsupport not really possible in a nice way (i.e., without completely re-doing lookups an unbounded number of times), and some other problems are almost intractable without this interface.Options are to have one bit (
RESOLVE_WITH_ROOTFD) that must be used withRESOLVE_IN_ROOTorRESOLVE_BENEATH, or just have two new versions of those flags (RESOLVE_IN_ROOTFD,RESOLVE_BENEATH_ROOTFDorRESOLVE_BENEATHFD).