https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283179

            Bug ID: 283179
           Summary: Support O_TMPFILE in open()
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: b...@freebsd.org
          Reporter: vini.ipsma...@gmail.com

Linux supports the creation of unlinked inodes (unnamed temporary regular
files) that can later be linked in the filesystem with linkat():
https://www.mankier.com/2/open#Description-O_TMPFILE

> Create an unnamed temporary regular file. The pathname argument specifies a 
> directory; an unnamed inode will be created in that directory's filesystem. 
> Anything written to the resulting file will be lost when the last file 
> descriptor is closed, unless the file is given a name.

I believe OpenZFS already supports this feature given the history of fixed bug
reports such as <https://github.com/openzfs/zfs/issues/14301>.

Could FreeBSD just expose this feature already supported by OpenZFS?

The main use cases:

> * Improved tmpfile(3) functionality: race-free creation of temporary files 
> that (1) are automatically deleted when closed; (2) can never be reached via 
> any pathname; (3) are not subject to symlink attacks; and (4) do not require 
> the caller to devise unique names.
>
> * Creating a file that is initially invisible, which is then populated with 
> data and adjusted to have appropriate filesystem attributes (fchown(2), 
> fchmod(2), fsetxattr(2), etc.) before being atomically linked into the 
> filesystem in a fully formed state (using linkat(2) as described above).

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to