]> git.baikalelectronics.ru Git - kernel.git/commit
inotify: start watch descriptor count at 1
authorEric Paris <eparis@redhat.com>
Mon, 17 Aug 2009 01:51:55 +0000 (21:51 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 17 Aug 2009 20:37:37 +0000 (13:37 -0700)
commit9e38add13247846b8b42ddd45731694f099c9108
treec9c112a0aa290895a416b5bfc3f58aa328bc74e8
parent178a3555f876ee7fce70d2b41e479117d278bb54
inotify: start watch descriptor count at 1

The inotify_add_watch man page specifies that inotify_add_watch() will
return a non-negative integer.  However, historically the inotify
watches started at 1, not at 0.

Turns out that the inotifywait program provided by the inotify-tools
package doesn't properly handle a 0 watch descriptor.  In cbb36f45 we
changed from starting at 1 to starting at 0.  This patch starts at 1,
just like in previous kernels, but also just like in previous kernels
it's possible for it to wrap back to 0.  This preserves the kernel
functionality exactly like it was before the patch (neither method broke
the spec)

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/notify/inotify/inotify_user.c