[smartos-discuss] inotify issues

2014-12-10 Thread Youzhong Yang via smartos-discuss
Hello again, I downloaded smartos latest image (joyent_20141127T173954Z) and tested inotify using it. Two issues were observed: 1. ioctl(fd, FIONREAD, ...) does not work as expected. It does not return the number of bytes that are available to be read on an inotify instance. 2. In an OS zone,

Re: [smartos-discuss] inotify issues

2014-12-10 Thread Bryan Cantrill via smartos-discuss
The touch differences can be explained by the touch(1) that you're using: in the global zone, you're using /usr/bin/touch, but in the non-global, I imagine that you're using /opt/local/bin/touch. These two implementations differ, so not a huge surprise that their implementation details differ.

Re: [smartos-discuss] inotify issues

2014-12-10 Thread Youzhong Yang via smartos-discuss
Thanks Bryan. Indeed in the zone /opt/local/bin/touch is used. But I still see the issue: open(filename, O_WRONLY|O_NONBLOCK|O_CREAT|O_NOCTTY, 0666) is a file open operation and should result in no IN_CREATE event if the file exists (O_CREAT - Create the file if it does not exist). I used the

Re: [smartos-discuss] inotify issues

2014-12-10 Thread Youzhong Yang via smartos-discuss
Hi Bryan, I saw the bug in the function inotify_ioctl() and tried to fix it. Now with my new image ioctl(FIONREAD) returns state-ins_size as the bytes available to be read. [root@batfs5901 ~]# /var/tmp/inotify ioctl = 0, errno = 0, bufsize = 64 got 48 bytes - New file yyang created - yyang

Re: [smartos-discuss] inotify issues

2014-12-10 Thread Bryan Cantrill via smartos-discuss
Yes, on looking this, it turns out (to my surprise, actually) that fop_create() is called on extant files (that is, when O_CREAT is set but the file exists). Unfortunately, there's not really an easy answer here; it might be tempting to fire IN_CREATE on the VE_CREATE vnode event (rather than the

Re: [smartos-discuss] inotify issues

2014-12-10 Thread Bryan Cantrill via smartos-discuss
Yeah, that's busted, and I see the bug (we're calculating the size incorrectly); I'll fix that when I fix FIONREAD -- with my apologies... - Bryan On Wed, Dec 10, 2014 at 12:37 PM, Youzhong Yang youzh...@gmail.com wrote: Hi Bryan, I saw the bug in the function inotify_ioctl() and