OSDN Git Service

(split) LDP: Update original to v3.37.
[linuxjm/LDP_man-pages.git] / original / man7 / inotify.7
index 1d4ca31..6936293 100644 (file)
@@ -23,7 +23,7 @@
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
 .\"
-.TH INOTIFY 7 2008-11-18 "Linux" "Linux Programmer's Manual"
+.TH INOTIFY 7 2011-12-07 "Linux" "Linux Programmer's Manual"
 .SH NAME
 inotify \- monitoring file system events
 .SH DESCRIPTION
@@ -126,6 +126,9 @@ allows the resulting pair of
 and
 .B IN_MOVE_TO
 events to be connected by the application.
+For all other event types,
+.I cookie
+is set to 0.
 
 The
 .I name
@@ -239,7 +242,7 @@ Two additional convenience macros are
 which equates to
 IN_MOVED_FROM|IN_MOVED_TO,
 and
-.B IN_CLOSE
+.BR IN_CLOSE ,
 which equates to
 IN_CLOSE_WRITE|IN_CLOSE_NOWRITE.
 .PP
@@ -254,6 +257,22 @@ when calling
 .BR IN_DONT_FOLLOW " (since Linux 2.6.15)"
 Don't dereference \fIpathname\fP if it is a symbolic link.
 .TP
+.BR IN_EXCL_UNLINK " (since Linux 2.6.36)"
+.\" commit 8c1934c8d70b22ca8333b216aec6c7d09fdbd6a6
+By default, when watching events on the children of a directory,
+events are generated for children even after they have been unlinked
+from the directory.
+This can result in large numbers of uninteresting events for
+some applications (e.g., if watching
+.IR /tmp ,
+in which many applications create temporary files whose
+names are immediately unlinked).
+Specifying
+.B IN_EXCL_UNLINK
+changes the default behavior,
+so that events are not generated for children after
+they have been unlinked from the watched directory.
+.TP
 .B IN_MASK_ADD
 Add (OR) events to watch mask for this pathname if
 it already exists (instead of replacing mask).
@@ -377,10 +396,30 @@ The
 .BR ioctl (2)
 returns the number of bytes available to read from an
 inotify file descriptor.
-
+.SS Limitations and caveats
 Inotify monitoring of directories is not recursive:
 to monitor subdirectories under a directory,
 additional watches must be created.
+This can take a significant amount time for large directory trees.
+
+The inotify API provides no information about the user or process that
+triggered the inotify event.
+
+Note that the event queue can overflow.
+In this case, events are lost.
+Robust applications should handle the possibility of
+lost events gracefully.
+
+The inotify API identifies affected files by filename.
+However, by the time an application processes an inotify event,
+the filename may already have been deleted or renamed.
+
+If monitoring an entire directory subtree,
+and a new subdirectory is created in that tree,
+be aware that by the time you create a watch for the new subdirectory,
+new files may already have been created in the subdirectory.
+Therefore, you may want to scan the contents of the subdirectory
+immediately after adding the watch.
 .SH "BUGS"
 In kernels before 2.6.16, the
 .B IN_ONESHOT