[RFC] XDG_RUNTIME_DIR

Mikkel Kamstrup Erlandsen mikkel.kamstrup at gmail.com
Sun Nov 14 01:41:38 PST 2010


On 13 November 2010 23:28, Lennart Poettering <mzkqt at 0pointer.de> wrote:
> On Sat, 13.11.10 23:12, Mikkel Kamstrup Erlandsen (mikkel.kamstrup at gmail.com) wrote:
>
>> It's not totally clear from the discussions on this list, what kind of
>> items you intend to go in XDG_USER_DIR? As I read it we are mainly
>> talking sockets, fifos, pid-files and such. However what about stuff
>> with non-negligible size - downloads in progress, short lived caches,
>> etc. I unpack tonnes of source packages that I always forget to delete
>> - will XDG_RUNTIME_DIR be suitible for this?
>
> No. $XDG_CACHE_HOME is for that, or /tmp.

Ok, good. I was hoping to hear that. However I think you must make
that crystal clear in the spec, as I'm pretty sure that I head people
talking about using it for stuff like this.

Having a ramdisk at your disposal is a very tempting thing - fx. in
Unity I build a few small Xapian indexes in memory - however, having
them "cached" in a ramdisk would be pretty sweet since I wouldn't have
to rebuild them when my process restarts - I could even make a sort of
contract for 3rd party processes to access these indexes directly in
XDG_RUNTIME_DIR. I'm pretty sure that this would be out of spirit with
the spec - and I would not do it - but I can definitely see that many
people will have a big temptation in it.

> The point of XDG_RUNTIME_DIR is to place stuff there that is needed
> mostly as a communication primitive in one form or another. I.e. it's
> supposed to be a place where servers and clients can easily discover
> each other, without any security hassle in regards to shared
> namespaces. As such it is very much comparable to FHS /var/run, except
> that it is per-user.
>
> http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA

Thanks for the link!

SNIP
>> I heard mention of using it for mmap()ed files - but if the runtime
>> dir is on a tmpfs (and not swapped) that would seem to undermine the
>> value of mmapping it - or am I misunderstanding something?
>
> Hmm? tmpfs and mmap mix very well, not sure what you are intending to
> say. Note that /dev/shm is usually tmpfs as well.

Ok, I haven't thought this completely through. My idea was just that
having a mmap() of something that was already held in memory on a
tmpfs was sorta superfluous, only adding a convenience API to access
it like an array. But on second consideration I realize that there are
numerous other benefits.

But it brings me back to the question about what is "legal" to keep in
XDG_RUNTIME_DIR. Is a file big enough to consider mmap()ing ok?

>> What path do you propose for XDG_RUNTIME_DIR? I can think of many
>> possibilities - ~/.runtime, /var/users/$login/runtime,
>> ~/.runtime/$session_specific_uid..?
>
> systemd implements this as /var/run/user/$USER.

Ok

-- 
Cheers,
Mikkel


More information about the xdg mailing list