On Fri, 2005-04-01 at 16:25 +0200, Martin Schlemmer wrote:
> On Wed, 2005-03-16 at 16:28 -0500, John McCutchan wrote:
> > Hey,
> >
> > Inotify has changed (for the final time - no, really) it's user space
> > interface. Robert Love sent patches out this afternoon, and here is an
> > update for gamin.
> >
> > In short, inotify now expects a fd instead of a path.
> >
> > old way,
> > wd = ioctl(devfd, "/foo/bar", INOTIFY_WATCH, mask);
> >
> > new way,
> > fd = open("/foo/bar", O_RDONLY);
> > if (fd < 0)
> > return
> > wd = ioctl(devfd, fd, INOTIFY_WATCH, mask);
> > close(fd); // <---- Close the fd immediately after requesting the watch.
> >
> > This interface has made the kernel guys happy, so this should be the
> > last interface change.
> >
>
> Probably missing something here, but with latest cvs gamin, and latest
> inotify patch (seems like it does the fd thing) from rml's kernel.org
> site, its not working. If you need help debugging, let me know what you
> need.
>
Ok, its a problem with the inotify backend. Attached is a patch from
Todor Penev <tpenev gmail com> (applies against CVS) to fix this.
Basically gam_inotify_add_rm_handler overrides the global 'fd' variable
used to open the device node ...
--
Martin Schlemmer
--- gamin-0.0.26.orig/server/gam_inotify.c 2005-03-28 20:25:10.000000000 +0200
+++ gamin-0.0.26/server/gam_inotify.c 2005-04-03 01:16:14.000000000 +0200
@@ -118,17 +117,17 @@ gam_inotify_add_rm_handler(const char *p
}
{
- int fd = open(path, O_RDONLY);
+ int file_fd = open(path, O_RDONLY);
- if (fd < 0) {
+ if (file_fd < 0) {
G_UNLOCK(inotify);
return;
}
- iwr.fd = fd;
+ iwr.fd = file_fd;
iwr.mask = 0xffffffff; // all events
wd = ioctl(fd, INOTIFY_WATCH, &iwr);
- close (fd);
+ close (file_fd);
}
if (wd < 0) {
Attachment:
signature.asc
Description: This is a digitally signed message part