pcp
[Top] [All Lists]

Re: Unix Domain Sockets

To: "Frank Ch. Eigler" <fche@xxxxxxxxxx>
Subject: Re: Unix Domain Sockets
From: Dave Brolley <brolley@xxxxxxxxxx>
Date: Wed, 05 Jun 2013 17:16:16 -0400
Cc: Nathan Scott <nathans@xxxxxxxxxx>, pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <20130605210000.GC15065@xxxxxxxxxx>
References: <51AD5434.9090200@xxxxxxxxxx> <1004356284.18217432.1370333038213.JavaMail.root@xxxxxxxxxx> <51AE0706.9010507@xxxxxxxxxx> <y0mvc5telx2.fsf@xxxxxxxx> <51AE4DD8.1070406@xxxxxxxxxx> <20130604203516.GB15065@xxxxxxxxxx> <2144455046.18771690.1370384108925.JavaMail.root@xxxxxxxxxx> <51AFA054.8030005@xxxxxxxxxx> <20130605210000.GC15065@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6
On 06/05/2013 05:00 PM, Frank Ch. Eigler wrote:
In this case, according to remove(3) (which calls unlink(3) in
this case) and Unix(7), the object's name is removed from the directory
listing, but the object continues to exist and the socket remains
available until it is closed. [...]
Does this mean that *new* clients can connect to the unix-domain
socket even after it's unlinked?  That'd be very strange, and would
seem to make it unnecessary to have all these unix-domain sockets sit
around in a filesystem for longer than a split second.
This is what I understood, although I haven't yet got to the point of trying to connect from clients yet. netstat does still show the socket is listening even though it's been unlinked. In re-reading unlink(2), perhaps you're right. It says that process that already have the handle may continue to use the socket. This would seem to exclude new clients.


2) Rework the permissions of /var/run/pcp so that they are 'drwxrwxr-x.
2 root pcp'. In this case, the object is visible in /var/run/pcp and can
be successfully removed at shutdown time.
This is plausible to me.
This along with an unlink before binding *and* at shutdown would seem optimal. That way if the socket really is still in use at startup time, it will stay that way, otherwise the stray object will be cleaned up.

Dave

<Prev in Thread] Current Thread [Next in Thread>