Skip to content

feature: support hardlinking fds into Roots #355

@cyphar

Description

@cyphar

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    api/cffiRelated to the C-FFI API.api/rootRelated to the Root API.api/rustRelated to the Rust API.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions