[patch] add IN_ONLYDIR based errors in inotify_add_watch(2)

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

 



Hi,

I noticed that it was undocumented how inotify_add_watch(2) behaves if IN_ONLYDIR is specified and the target is not a directory.

To discover this, I took the example code in inotify(7) and modified it to include the IN_ONLYDIR flag. Running the code against an ordinary file, I saw the following output:


paul@sparkplug:~/git/dCache (development/frontend-inotify-namespace)$ ./inotify-test README
    Press ENTER key to terminate.
    Cannot watch 'README'
    inotify_add_watch: Not a directory
    paul@sparkplug:~/git/dCache (development/frontend-inotify-namespace)$


My machine is "Debian GNU/Linux 9.4 (stretch)". I imagine (but haven't tested) that the same errno is used on other distros.

I've included a patch that adds ENOTDIR as an additional error in the inotify_add_watch(2) man page.

I'm undecided whether or not the section in inotify(7) describing IN_ONLYDIR should also be updated to describe how non-directory targets are handled.

Cheers,

Paul.

diff --git a/man2/inotify_add_watch.2 b/man2/inotify_add_watch.2
index 5bb7c94a7..e9ba038eb 100644
--- a/man2/inotify_add_watch.2
+++ b/man2/inotify_add_watch.2
@@ -113,6 +113,14 @@ Insufficient kernel memory was available.
 .B ENOSPC
 The user limit on the total number of inotify watches was reached or the
 kernel failed to allocate a needed resource.
+.TP
+.B ENOTDIR
+.I mask
+contains
+.B IN_ONLYDIR
+and
+.I pathname
+is not a directory.
 .SH VERSIONS
 Inotify was merged into the 2.6.13 Linux kernel.
 .SH CONFORMING TO

[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux