[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: inotifyd
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2008-05-24 18:10:20
Message-ID: 200805242010.20948.vda.linux () googlemail ! com
[Download RAW message or body]

On Saturday 24 May 2008 14:01, dronnikov@gmail.com wrote:
> Hello!
> 
> Attached is a patch that adds simple inotify daemon to report filesystem changes on \
> modern kernels >= 2.6.13 via an userspace agent.
> 
> It can be used to, say, monitor a device addition/removal, or incoming mail \
> delivery. 
> Should be run as follows:
> # inotifyd /user/space/agent /dir/or/file/being/watched[:mask] ...
> 
> When a filesystem event matching the mask is occured on specified file (or \
> directory) the userspace agent is spawned and is given the following parameters:
> 1. actual event(s)
> 2. file (or directory) which is changed
> 3. name of touched subfile (if any), in case of watching a directory
> 
> Please, do comment. Is such a daemon relevant to BB?

                struct inotify_event *ie;
                // read out all pending events
                xioctl(pfd.fd, FIONREAD, &len);
                ie = buf = (len <= BUFSIZ) ? bb_common_bufsiz1 : xmalloc(len);
                len = full_read(pfd.fd, buf, len);
                // process events. N.B. events may vary in length
                while (len > 0) {
                        int i;
...
                        // next event
                        i = sizeof(struct inotify_event) + ie->len;
                        len -= i;
                        ie += i;
                }


Looks like ie += i tries to move ie pointer by i bytes, but
actually will move it by i*sizeof(*ie) bytes. Is it a bug?
--
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic