lkml.org 
[lkml]   [2012]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectInotify and UNIX domain sockets
From
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


\
 
 \ /
  Last update: 2012-04-18 22:37    [W:0.022 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site