Unix Programming - Unix domain socket and /var/run or /tmp?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > September 2006 > Unix domain socket and /var/run or /tmp?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Unix domain socket and /var/run or /tmp?
skillzero@gmail.com

2006-09-27, 7:30 am

Is there a good reason to bind a Unix domain socket to /var/run/xyz
instead /tmp/xyz? I've always used /tmp in the past because it avoided
issues with /var/run not always being there or not being writable (and
Steven's examples seem to use /tmp), but I notice a lot of things use
/var/run.

Are there advantages to /var/run over /tmp?

Barry Margolin

2006-09-27, 1:21 pm

In article <1159346051.630193.24030@i42g2000cwa.googlegroups.com>,
"skillzero@gmail.com" <skillzero@gmail.com> wrote:

> Is there a good reason to bind a Unix domain socket to /var/run/xyz
> instead /tmp/xyz? I've always used /tmp in the past because it avoided
> issues with /var/run not always being there or not being writable (and
> Steven's examples seem to use /tmp), but I notice a lot of things use
> /var/run.
>
> Are there advantages to /var/run over /tmp?


/var/run is likely to be writable only by the superuser, so any
recommendation to use it is probably directed specifically at system
daemons, not ordinary user applications.

And in this case, you avoid possible race conditions that could occur if
an ordinary user creates a socket in /tmp with the same name the daemon
was going to use.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com