1 INOTIFY_ADD_WATCH(3C)    Standard C Library Functions    INOTIFY_ADD_WATCH(3C)
   2 
   3 
   4 
   5 NAME
   6        inotify_add_watch - add a watch to an inotify instance
   7 
   8 SYNOPSIS
   9        #include <sys/inotify.h>
  10 
  11        int inotify_add_watch(int fd, const char *pathname, uint32_t mask);
  12 
  13 
  14 DESCRIPTION
  15        The inotify_add_watch() function adds a watch for the file or directory
  16        specified by pathname to the inotify instance specified by fd for the
  17        events specified by mask.  See inotify(5) for details on the meaning of
  18        mask, how it affects the interpretation of pathname, and how events for
  19        the watched file or directory are subsequently retrieved via read(2).
  20 
  21 
  22 RETURN VALUES
  23        Upon succesful completion, inotify_add_watch() returns the watch
  24        descriptor associated with the new watch.  If an error occurs, -1 is
  25        returned and errno is set to indicate the error.
  26 
  27 
  28 ERRORS
  29        inotify_add_watch() will fail if:
  30 
  31        EACCES
  32                  pathname could not be opened for reading.
  33 
  34 
  35        EBADF
  36                  The fd argument is not a valid open file descriptor.
  37 
  38 
  39        EFAULT
  40                  The memory associated with pathname was not mapped.
  41 
  42 
  43        EINVAL
  44                  The fd argument does not correspond to an inotify(5) instance
  45                  as initialized with inotify_init(3C) or inotify_init1(3C).
  46 
  47 
  48        ENOSPC
  49                  The number of watches on the specified instance would exceed
  50                  the maximum number of watches per inotify(5) instance.
  51 
  52 
  53        ENOTDIR
  54                  pathname does not correspond to a directory and IN_ONLYDIR
  55                  was specified in mask.
  56 
  57 
  58 
  59 NOTES
  60        While the inotify(5) facility is implemented for purposes of offering
  61        compatibility for Linux-borne applications, native applications may opt
  62        to use it instead of (or in addition to) the PORT_SOURCE_FILE
  63        capability of event ports.  See inotify(5) for details and
  64        restrictions.
  65 
  66 
  67 SEE ALSO
  68        inotify_init(3C), inotify_init1(3C), port_create(3C),
  69        port_associate(3C), port_get(3C), inotify(5)
  70 
  71 
  72 
  73                               September 17, 2014         INOTIFY_ADD_WATCH(3C)