inotify in FC5 ?
John Ellson
ellson at research.att.com
Mon Jan 30 16:56:39 UTC 2006
Dave Jones wrote:
> On Mon, Jan 30, 2006 at 11:33:46AM -0500, John Ellson wrote:
> > Can somebody point me to latest docs on inotify? Is this inotify.txt
> > from the kernel-docs rpm supposed to be current?
>
> If you're using the latest rpm from rawhide, it's pulling from the
> latest version in the kernel.org tree, so yes.
>
> > I tried to use it from a test program but I get:
> >
> > test.o: In function `main':test.c:(.text+0x43): warning: warning:
> > inotify_add_watch is not implemented and will always fail
> > :test.c:(.text+0x15): warning: warning: inotify_init is not implemented
> > and will always fail
>
> Hmm, odd. Can you send your test program ?
>
> > I'm hoping this is just me doing something wrong. Hasn't inotify been
> > in Rawhide for some time now?
>
> It's even in FC4. It was merged in 2.6.14
>
> Dave
>
>
>
>
I'm just trying to learn inotify(), so I'm sure this code has other
problems, but this
is what I'm trying now that results in the errors.
--------------------------------------------------------------------
#include <stdio.h>
#include <stdbool.h>
#include <sys/inotify.h>
#include <sys/select.h>
int main(int argc, char *argv[])
{
int fd, wd, ret, sel;
#define BUF_LEN 1024
char buf[BUF_LEN];
size_t len;
fd_set set[2];
fd = inotify_init();
FD_SET(fd, set);
wd = inotify_add_watch(fd, "/home/ellson/hello.dot", IN_MODIFY |
IN_DELETE);
while (true) {
sel = select(1, set, NULL, NULL, NULL);
len = read(fd, buf, BUF_LEN);
fprintf(stderr, "I woke up\n");
}
ret = inotify_rm_watch(fd, wd);
}
More information about the fedora-devel-list
mailing list