-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Unlinked files (such as those created by O_TMPFILE) can be linked back to the filesystem via /proc/self/fd/$n (or linkat(AT_EMPTY_PATH) but this requires privileges and is thus less preferable). There is also a planned extension to renameat2(2) to allow you to also clobber the target file in the same atomic operation.
This is a very useful operation, especially if you use O_TMPFILE to create and populate a temporary file before making it visible to other programs through the filesystem, but is currently not provided by libpathrs.
This is also something that libpathrs really should provide helpers for, because it requires non-trivial usage of /proc/self/fd/$n that cannot be accomplished purely through our APIs (namely the linkat(2) operation needs to do a same-mount-id check for the fd magiclink).