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
|