Messages in this thread | | | Date | Wed, 18 Apr 2012 10:45:17 +0200 | Subject | Inotify and UNIX domain sockets | From | alexandre p <> |
| |
Hello list,
I have a simple daemon program that creates an AF_UNIX socket which it uses for local communication, absolutely nothing fancy. A somewhat minor annoyance with UNIX sockets is that the socket file may be removed at the filesystem level, and the listening process isn't aware of it. To that end I decided to use inotify to watch the socket and kill the daemon if it gets removed.
This doesn't appear to work. Specifically, no inotify event is generated for a *connected* UNIX domain socket on my system. If the socket is unconnected, then a delete event is properly generated, and a regular file with the same name of course works fine. But for a connected socket, nothing (perhaps because the file is not in fact unlinked in this instance, a reference to the inode being maintained by the socket subsystem itself? This is a wild guess.)
The question is, is this by design?
Here at work I'm using a somewhat ancient version of the kernel, so my apologies in advance if this was a known bug at some point that has since been fixed. Unfortunately I cannot test it on a more recent version easily.
Linux devx 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
Best regards,
Alexander
| |