On Tue, Jun 11, 2002 at 01:52:29PM +0300, Tzafrir Cohen wrote: > On Tue, 11 Jun 2002, Muli Ben-Yehuda wrote: > > > Is there a way to open a file (get an fd) and then delete it, in one > > atomic operation? > > > > I need to open a temporary file (but with a fixed name, so mkstemp() > > and friends are not an option) > > Why a fixed name? Can it be a symlink?
Because I'm doing it as part of syscalltrack's test suite, and it needs to be a fixed name so that I'll be able to make rules to match on it. We do support pattern matching, so I could use mkstemp() with a fixed template, but I would like to test our '==' operator, not just '=~'. It can be a symlink, I guess. How does this help? > > and then make sure it doesn't remain > > behind if the program should die unexpectedly. This brings up another interesting question: how do I make sure all stray files are cleaned up properly on abnormal program termination? Adding a sighandler for each possible signal is annoying (although doable) - is there a better way? -- Sterday 20 Forelithe 7466 http://vipe.technion.ac.il/~mulix/ http://syscalltrack.sf.net/
msg19966/pgp00000.pgp
Description: PGP signature