[capsicum] unlinkfd

Christoph Hellwig hch at infradead.org
Mon Mar 5 18:42:35 UTC 2018


On Mon, Mar 05, 2018 at 06:15:08PM +0200, Konstantin Belousov wrote:
> It is not clear from the FreeBSD PR, how unlinkat() is supposed to work.
> Do you mean that unlinkat(AT_EMPTY_PATH) removes the name entry for
> given fd, which was used for open(2) ?

It removes the current name for the open fd, including tracking renames
that might have happened since open.

> If yes, this is not possible to
> implement in the current FreeBSD VFS.
> 
> Also, does linkat(AT_EMPTY_PATH) supposed to link the inode referenced
> only by the file descriptor ? I believe this feature is objected to.

linkat(..., AT_EMPTY_PATH) in Linux creates a new link to inode
reference by the fd.  It is a privileged operation, and requires
the inode to already have a non-zero link count, or be opened using
the Linux-specific O_TMPFILE flag, which creates and open by unlinked
file.


More information about the freebsd-hackers mailing list