Not receiving MOVE_TO events with inotify

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

I tried the inotify feature and I found I do not receive MOVE_TO events.
I use linux 2.6.13 from Debian, ext3 filesystem.

I set a watch on /tmp. When I move /tmp/file_a to /tmp/file_b I
receive only one event on file_a (I assume it is move_from, I did not
decode it).

Attaching a small C program that I used to print events that occur on /tmp.

Thanks

Michal Suchanek


--
Support the freedom of music!
Maybe it's a weird genre  .. but weird is *not* illegal.
Maybe next time they will send a special forces commando to your picnic ..
.. because they think you are weird.
   http://www.music-versus-guns.org          http://en.policejnistat.cz
#include <linux/inotify.h>
#include <sys/syscall.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>

static inline _syscall0(int, inotify_init);

static inline _syscall3(int, inotify_add_watch, int, fd, const char *, path, __u32, mask);

static inline _syscall2(int, inotify_rm_watch, int, fd, int, wd);

#define BUFSIZE 4096

typedef struct inotify_event ine;

int main (int argc, char ** argv)
{
  int fd = inotify_init();
  int wd = inotify_add_watch(fd, "/tmp", IN_ALL_EVENTS);
  static char buf[BUFSIZE];
  size_t len;

  while(1){
    ine * pev;
    len = read(fd, buf, BUFSIZE);
    if(!len) { putchar('.'); sleep(5); continue;}
    pev = (ine *) buf;
    while(buf + len > (char *)pev) {
      fprintf(stderr, "%s(%u): %x\n", pev->len ? pev->name : "(self)" , pev->wd, pev->mask);
      pev = (ine *)((char *)(pev + 1)) + pev->len;
    }
  }
}



[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux