svn commit: r298922 - in head: lib/libc/sys sys/kern

Konstantin Belousov kib at FreeBSD.org
Mon May 2 13:18:18 UTC 2016


Author: kib
Date: Mon May  2 13:18:17 2016
New Revision: 298922
URL: https://svnweb.freebsd.org/changeset/base/298922

Log:
  Issue NOTE_EXTEND when a directory entry is added to or removed from
  the monitored directory as the result of rename(2) operation.  The
  renames staying in the directory are not reported.
  
  Submitted by:	Vladimir Kondratyev <wulf at cicgroup.ru>
  MFC after:	2 weeks

Modified:
  head/lib/libc/sys/kqueue.2
  head/sys/kern/vfs_subr.c

Modified: head/lib/libc/sys/kqueue.2
==============================================================================
--- head/lib/libc/sys/kqueue.2	Mon May  2 13:13:32 2016	(r298921)
+++ head/lib/libc/sys/kqueue.2	Mon May  2 13:18:17 2016	(r298922)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 1, 2016
+.Dd May 2, 2016
 .Dt KQUEUE 2
 .Os
 .Sh NAME
@@ -376,7 +376,13 @@ was called on the file referenced by the
 .It Dv NOTE_WRITE
 A write occurred on the file referenced by the descriptor.
 .It Dv NOTE_EXTEND
-The file referenced by the descriptor was extended.
+For regular file, the file referenced by the descriptor was extended.
+.Pp
+For directory, reports that a directory entry was added or removed,
+as the result of rename operation.
+The
+.Dv NOTE_EXTEND
+event is not reported when a name is changed inside the directory.
 .It Dv NOTE_ATTRIB
 The file referenced by the descriptor had its attributes changed.
 .It Dv NOTE_LINK

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Mon May  2 13:13:32 2016	(r298921)
+++ head/sys/kern/vfs_subr.c	Mon May  2 13:18:17 2016	(r298922)
@@ -4660,6 +4660,7 @@ vop_rename_post(void *ap, int rc)
 			VFS_KNOTE_UNLOCKED(a->a_fdvp, hint);
 			VFS_KNOTE_UNLOCKED(a->a_tdvp, hint);
 		} else {
+			hint |= NOTE_EXTEND;
 			if (a->a_fvp->v_type == VDIR)
 				hint |= NOTE_LINK;
 			VFS_KNOTE_UNLOCKED(a->a_fdvp, hint);


More information about the svn-src-head mailing list