Is there an O_TMPFILE equivalent for directories?

Ideally, I want to have a directory that does not appear on the file system and that will be automatically deleted when the last open file descriptor is closed. Content will only be available through openat() , fstatat() , etc.

For regular files, this behavior is achieved if the O_TMPFILE flag is open() . However, mkdir() does not have the flags parameter.

Assuming I have the latest Linux kernel, is this possible?

+5
source share
1 answer

I do not know how to do this, and do not expect this to be possible. Unlike files, which may have zero or more paths (due to hard links and unrelated files), directories have exactly one path name, and this will probably violate the correct use of the application if the OS does not meet this expectation.

+2
source

All Articles