[RFC] XDG_RUNTIME_DIR

Oswald Buddenhagen ossi at kde.org
Sat Nov 13 17:09:02 PST 2010


On Sat, Nov 13, 2010 at 11:28:08PM +0100, Lennart Poettering wrote:
> On Sat, 13.11.10 23:12, Mikkel Kamstrup Erlandsen (mikkel.kamstrup at gmail.com) wrote:
> > I'd rather like something more deterministic. "When there are no
> > file handles on a file it's deleted" - might be too aggressive, but is
> > definitely clear cut :-)
> 
> Well, except for the point that such a scheme is not really
> implementable on current OSes (neither is there an API to figure ot
> whether any process is referencing a file, and even if we had that
> things would be complex to do right, because you'd need an atomic
> 'delete-unless-referenced' syscall and stuff) and also not applicable to
> stuff like PID files for example.
> 
i deem lsof sufficiently existent and applicable, even if a bit
inefficient as-is (hmm, isn't it possible to poll() /proc?).
and true atomicity would be somewhat overengineered, because in the
cases one can realistically expect, you don't have the situation where
an inode's only reference would be quickly passed between processes. but
you could still add some extra paranoia by polling every 10 minutes - if
a file is not referenced in three consecutive runs *and* the timestamp
didn't change since then, then declare it dead.



More information about the xdg mailing list