Is it possible to have file removed upon process exit?
delphij at delphij.net
Mon Nov 29 08:21:14 UTC 2010
-----BEGIN PGP SIGNED MESSAGE-----
On 11/28/10 20:43, Garrett Cooper wrote:
> On Thu, Nov 25, 2010 at 12:14 PM, Xin LI <delphij at delphij.net> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>> One pretty common way of having an i-node of a file removed when process
>> exit is to unlink() it while holding a descriptor of the file. This
>> approach, however, have a side effect that other processes would not be
>> able to access the file via its name.
>> For certain applications it is sometimes desirable to (e.g. for unix
>> domain sockets) have file removed when the process quit, regardless
>> whether the process is quit cleanly. Is there a clean way to do this?
> Does it have to be nameless and/or unique?
Speaking for uniqueness, I think it's unrelated (not good nor bad) for
the use case. The name should be predictable (e.g. can be configured,
so non-child process can find it), though.
Xin LI <delphij at delphij.net> http://www.delphij.net/
FreeBSD - The Power to Serve! Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)
-----END PGP SIGNATURE-----
More information about the freebsd-hackers