Print this page
3484 enhance and document tail follow support
Reviewed by: Joshua M. Clulow <jmc@joyent.com>

@@ -21,10 +21,13 @@
 /*
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
 
 /*
  * File Events Notification
  * ------------------------
  *

@@ -1963,11 +1966,13 @@
                 event  |= FILE_ACCESS;
         }
         if (op & FOP_ATTRIB_MASK) {
                 event  |= FILE_ATTRIB;
         }
-
+        if (op & FOP_TRUNC_MASK) {
+                event  |= FILE_TRUNC;
+        }
         if (event) {
                 port_fop_sendevent(vp,  event, NULL, NULL);
         }
 }
 

@@ -2145,10 +2150,13 @@
         int             retval;
         vnode_t         *vp = (vnode_t *)vf->fa_fnode->fn_available;
         int             events = 0;
 
         retval = vnext_setattr(vf, vap, flags, cr, ct);
+        if (vap->va_mask & AT_SIZE) {
+                events |= FOP_FILE_TRUNC;
+        }
         if (vap->va_mask & (AT_SIZE|AT_MTIME)) {
                 events |= FOP_FILE_SETATTR_MTIME;
         }
         if (vap->va_mask & AT_ATIME) {
                 events |= FOP_FILE_SETATTR_ATIME;

@@ -2320,12 +2328,12 @@
                 break;
         case    VE_RMDIR:
                         port_fop_sendevent(vp, FILE_DELETE, dvp, name);
                 break;
         case    VE_CREATE:
-                        port_fop_sendevent(vp, FILE_MODIFIED|FILE_ATTRIB,
-                            NULL, NULL);
+                        port_fop_sendevent(vp,
+                            FILE_MODIFIED|FILE_ATTRIB|FILE_TRUNC, NULL, NULL);
                 break;
         case    VE_LINK:
                         port_fop_sendevent(vp, FILE_ATTRIB, NULL, NULL);
                 break;