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


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 




  27 #ifndef _SYS_PORT_IMPL_H
  28 #define _SYS_PORT_IMPL_H
  29 
  30 
  31 #ifdef  __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 /*
  36  * Note:
  37  * The contents of this file are private to the implementation of the
  38  * Solaris system and event ports subsystem and are subject to change
  39  * at any time without notice.
  40  */
  41 
  42 #include <sys/poll_impl.h>
  43 #include <sys/port.h>
  44 #include <sys/port_kernel.h>
  45 #include <sys/vnode.h>
  46 #include <sys/fem.h>


 294 #define FOP_FILE_WRITE          0x00000004
 295 #define FOP_FILE_MAP            0x00000008
 296 #define FOP_FILE_IOCTL          0x00000010
 297 #define FOP_FILE_CREATE         0x00000020
 298 #define FOP_FILE_MKDIR          0x00000040
 299 #define FOP_FILE_SYMLINK        0x00000080
 300 #define FOP_FILE_LINK           0x00000100
 301 #define FOP_FILE_RENAME         0x00000200
 302 #define FOP_FILE_REMOVE         0x00000400
 303 #define FOP_FILE_RMDIR          0x00000800
 304 #define FOP_FILE_READDIR        0x00001000
 305 #define FOP_FILE_RENAMESRC      0x00002000
 306 #define FOP_FILE_RENAMEDST      0x00004000
 307 #define FOP_FILE_REMOVEFILE     0x00008000
 308 #define FOP_FILE_REMOVEDIR      0x00010000
 309 #define FOP_FILE_SETSECATTR     0x00020000
 310 #define FOP_FILE_SETATTR_ATIME  0x00040000
 311 #define FOP_FILE_SETATTR_MTIME  0x00080000
 312 #define FOP_FILE_SETATTR_CTIME  0x00100000
 313 #define FOP_FILE_LINK_SRC       0x00200000

 314 
 315 /*
 316  * File modification event.
 317  */
 318 #define FOP_MODIFIED_MASK       (FOP_FILE_WRITE|FOP_FILE_CREATE \
 319                                 |FOP_FILE_REMOVE|FOP_FILE_LINK \
 320                                 |FOP_FILE_RENAMESRC|FOP_FILE_RENAMEDST \
 321                                 |FOP_FILE_MKDIR|FOP_FILE_RMDIR \
 322                                 |FOP_FILE_SYMLINK|FOP_FILE_SETATTR_MTIME)
 323 
 324 /*
 325  * File access event
 326  */
 327 #define FOP_ACCESS_MASK         (FOP_FILE_READ|FOP_FILE_READDIR \
 328                                 |FOP_FILE_MAP|FOP_FILE_SETATTR_ATIME)
 329 
 330 /*
 331  * File attrib event
 332  */
 333 #define FOP_ATTRIB_MASK         (FOP_FILE_WRITE|FOP_FILE_CREATE \
 334                                 |FOP_FILE_REMOVE|FOP_FILE_LINK \
 335                                 |FOP_FILE_RENAMESRC|FOP_FILE_RENAMEDST \
 336                                 |FOP_FILE_MKDIR|FOP_FILE_RMDIR \
 337                                 |FOP_FILE_SYMLINK|FOP_FILE_SETATTR_CTIME \
 338                                 |FOP_FILE_LINK_SRC|FOP_FILE_SETSECATTR)
 339 
 340 
 341 /*





 342  * valid watchable events
 343  */
 344 #define FILE_EVENTS_MASK        (FILE_ACCESS|FILE_MODIFIED|FILE_ATTRIB \
 345                                 |FILE_NOFOLLOW)
 346 /* --- End file events --- */
 347 
 348 /*
 349  * port_kstat_t contains the event port kernel values which are
 350  * exported to kstat.
 351  * Currently only the number of active ports is exported.
 352  */
 353 typedef struct port_kstat {
 354         kstat_named_t   pks_ports;
 355 } port_kstat_t;
 356 
 357 /* misc functions */
 358 int     port_alloc_event_block(port_t *, int, int, struct port_kevent **);
 359 void    port_push_eventq(port_queue_t *);
 360 int     port_remove_done_event(struct port_kevent *);
 361 struct  port_kevent *port_get_kevent(list_t *, struct port_kevent *);
 362 void    port_block(port_queue_t *);
 363 void    port_unblock(port_queue_t *);
 364 
 365 /* PORT_SOURCE_FD cache management */


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  29  */
  30 
  31 #ifndef _SYS_PORT_IMPL_H
  32 #define _SYS_PORT_IMPL_H
  33 
  34 
  35 #ifdef  __cplusplus
  36 extern "C" {
  37 #endif
  38 
  39 /*
  40  * Note:
  41  * The contents of this file are private to the implementation of the
  42  * Solaris system and event ports subsystem and are subject to change
  43  * at any time without notice.
  44  */
  45 
  46 #include <sys/poll_impl.h>
  47 #include <sys/port.h>
  48 #include <sys/port_kernel.h>
  49 #include <sys/vnode.h>
  50 #include <sys/fem.h>


 298 #define FOP_FILE_WRITE          0x00000004
 299 #define FOP_FILE_MAP            0x00000008
 300 #define FOP_FILE_IOCTL          0x00000010
 301 #define FOP_FILE_CREATE         0x00000020
 302 #define FOP_FILE_MKDIR          0x00000040
 303 #define FOP_FILE_SYMLINK        0x00000080
 304 #define FOP_FILE_LINK           0x00000100
 305 #define FOP_FILE_RENAME         0x00000200
 306 #define FOP_FILE_REMOVE         0x00000400
 307 #define FOP_FILE_RMDIR          0x00000800
 308 #define FOP_FILE_READDIR        0x00001000
 309 #define FOP_FILE_RENAMESRC      0x00002000
 310 #define FOP_FILE_RENAMEDST      0x00004000
 311 #define FOP_FILE_REMOVEFILE     0x00008000
 312 #define FOP_FILE_REMOVEDIR      0x00010000
 313 #define FOP_FILE_SETSECATTR     0x00020000
 314 #define FOP_FILE_SETATTR_ATIME  0x00040000
 315 #define FOP_FILE_SETATTR_MTIME  0x00080000
 316 #define FOP_FILE_SETATTR_CTIME  0x00100000
 317 #define FOP_FILE_LINK_SRC       0x00200000
 318 #define FOP_FILE_TRUNC          0x00400000
 319 
 320 /*
 321  * File modification event.
 322  */
 323 #define FOP_MODIFIED_MASK       (FOP_FILE_WRITE|FOP_FILE_CREATE \
 324                                 |FOP_FILE_REMOVE|FOP_FILE_LINK \
 325                                 |FOP_FILE_RENAMESRC|FOP_FILE_RENAMEDST \
 326                                 |FOP_FILE_MKDIR|FOP_FILE_RMDIR \
 327                                 |FOP_FILE_SYMLINK|FOP_FILE_SETATTR_MTIME)
 328 
 329 /*
 330  * File access event
 331  */
 332 #define FOP_ACCESS_MASK         (FOP_FILE_READ|FOP_FILE_READDIR \
 333                                 |FOP_FILE_MAP|FOP_FILE_SETATTR_ATIME)
 334 
 335 /*
 336  * File attrib event
 337  */
 338 #define FOP_ATTRIB_MASK         (FOP_FILE_WRITE|FOP_FILE_CREATE \
 339                                 |FOP_FILE_REMOVE|FOP_FILE_LINK \
 340                                 |FOP_FILE_RENAMESRC|FOP_FILE_RENAMEDST \
 341                                 |FOP_FILE_MKDIR|FOP_FILE_RMDIR \
 342                                 |FOP_FILE_SYMLINK|FOP_FILE_SETATTR_CTIME \
 343                                 |FOP_FILE_LINK_SRC|FOP_FILE_SETSECATTR)
 344 
 345 
 346 /*
 347  * File trunc event
 348  */
 349 #define FOP_TRUNC_MASK          (FOP_FILE_TRUNC|FOP_FILE_CREATE)
 350 
 351 /*
 352  * valid watchable events
 353  */
 354 #define FILE_EVENTS_MASK        (FILE_ACCESS|FILE_MODIFIED|FILE_ATTRIB \
 355                                 |FILE_NOFOLLOW|FILE_TRUNC)
 356 /* --- End file events --- */
 357 
 358 /*
 359  * port_kstat_t contains the event port kernel values which are
 360  * exported to kstat.
 361  * Currently only the number of active ports is exported.
 362  */
 363 typedef struct port_kstat {
 364         kstat_named_t   pks_ports;
 365 } port_kstat_t;
 366 
 367 /* misc functions */
 368 int     port_alloc_event_block(port_t *, int, int, struct port_kevent **);
 369 void    port_push_eventq(port_queue_t *);
 370 int     port_remove_done_event(struct port_kevent *);
 371 struct  port_kevent *port_get_kevent(list_t *, struct port_kevent *);
 372 void    port_block(port_queue_t *);
 373 void    port_unblock(port_queue_t *);
 374 
 375 /* PORT_SOURCE_FD cache management */