Ideally, I want to have a directory that is not visible in the filesystem and that will be automatically removed when it's last open file descriptor is closed. It's contents would only be accessible through openat()
, fstatat()
, etc.
For regular files, this behaviour is achieved by giving the O_TMPFILE
flag to open()
. However, mkdir()
doesnt have a flags parameter.
Assuming I have the latest linux kernel available, is this possible?
I'm not aware of any way to do this, and don't expect it to be possible. Unlike files, which can have zero or more pathnames (due to hard links and unlinked files), directories have exactly one pathname, and it would probably break some valid application usage if the OS did not meet this expectation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With