On Sat, Nov 27, 2010 at 08:16:54PM +0100, Dirk-Willem van Gulik wrote: > > Op 27 nov 2010, om 20:07 heeft Carlos A. M. dos Santos het volgende > geschreven: > > > On Sat, Nov 27, 2010 at 3:18 PM, Dimitry Andric <[email protected]> wrote: > >> On 2010-11-25 21:14, Xin LI wrote: > >>> > >>> 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? > >> > >> Maybe your process could be the child of a parent which cleans up > >> afterwards? (This is an analogy from real life. ;) > > Another option, depending on the situation is to fopen()/open() the file - > and as soon as that is successfully done by all involved - have the creating > process delete it.
Errr... didn't the original poster also write the following? :) (admittedly, in a part that the follow-uppers skipped) > >>> 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. G'luck, Peter -- Peter Pentchev [email protected] [email protected] [email protected] PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 You have, of course, just begun reading the sentence that you have just finished reading.
signature.asc
Description: Digital signature

