Is it possible to have file removed upon process exit?

2010-11-25 Thread Xin LI
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi, 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

Re: Is it possible to have file removed upon process exit?

2010-11-27 Thread Carlos A. M. dos Santos
On Thu, Nov 25, 2010 at 6:14 PM, Xin LI wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > Hi, > > 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 tha

Re: Is it possible to have file removed upon process exit?

2010-11-27 Thread Ryan Stone
On Sat, Nov 27, 2010 at 11:42 AM, Carlos A. M. dos Santos wrote: > > Did you try to use atexit(3) to register a deletion function? > That doesn't help you if the process crashes. The OP wants a solution that works even if the process doesn't exit cleanly.

Re: Is it possible to have file removed upon process exit?

2010-11-27 Thread Dimitry Andric
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 wh

Re: Is it possible to have file removed upon process exit?

2010-11-27 Thread Carlos A. M. dos Santos
On Sat, Nov 27, 2010 at 3:18 PM, Dimitry Andric 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 wa

Re: Is it possible to have file removed upon process exit?

2010-11-27 Thread Dirk-Willem van Gulik
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 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

Re: Is it possible to have file removed upon process exit?

2010-11-27 Thread Kostik Belousov
On Sat, Nov 27, 2010 at 05:07:15PM -0200, Carlos A. M. dos Santos wrote: > On Sat, Nov 27, 2010 at 3:18 PM, Dimitry Andric 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 pr

Re: Is it possible to have file removed upon process exit?

2010-11-27 Thread Peter Pentchev
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 wrote: > >> On 2010-11-25 21:14, Xin LI wrote: > >>> > >>> For certain applications

Re: Is it possible to have file removed upon process exit?

2010-11-28 Thread Garrett Cooper
On Thu, Nov 25, 2010 at 12:14 PM, Xin LI wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > Hi, > > 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 th

Re: Is it possible to have file removed upon process exit?

2010-11-29 Thread Xin LI
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 11/28/10 20:43, Garrett Cooper wrote: > On Thu, Nov 25, 2010 at 12:14 PM, Xin LI wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA256 >> >> Hi, >> >> One pretty common way of having an i-node of a file removed when process >> exit is to u

Re: Is it possible to have file removed upon process exit?

2010-12-13 Thread Garance A Drosehn
On 11/29/10 3:20 AM, Xin LI wrote: On 11/28/10 20:43, Garrett Cooper wrote: On Thu, Nov 25, 2010 at 12:14 PM, Xin LI wrote: -BEGIN PGP SIGNED MESSAGE- For certain applications it is sometimes desirable to (e.g. for unix domain sockets) have file removed when the process quit