|
INOTIFY_ADD_WATCH(3C) |
Standard C Library Functions |
INOTIFY_ADD_WATCH(3C) |
NAME
inotify_add_watch - add a watch to an inotify instance
SYNOPSIS
#include <sys/inotify.h>
int inotify_add_watch(
int fd,
const char *pathname,
uint32_t mask);
DESCRIPTION
The
inotify_add_watch() function adds a watch for the file or directory specified by
pathname to the inotify instance specified by
fd for the events specified by
mask. See
inotify(5) for details on the meaning of
mask, how it affects the interpretation of
pathname, and how events for the watched file or directory are subsequently retrieved via
read(2).
RETURN VALUES
Upon succesful completion,
inotify_add_watch() returns the watch descriptor associated with the new watch. If an error occurs, -1 is returned and errno is set to indicate the error.
ERRORS
inotify_add_watch() will fail if:
EACCES
pathname could not be opened for reading.
EBADF
The fd argument is not a valid open file descriptor.
EFAULT
The memory associated with pathname was not mapped.
EINVAL
The fd argument does not correspond to an inotify(5) instance as initialized with inotify_init(3C) or inotify_init1(3C).
ENOSPC
The number of watches on the specified instance would exceed the maximum number of watches per inotify(5) instance.
ENOTDIR
pathname does not correspond to a directory and IN_ONLYDIR was specified in mask.
NOTES
While the
inotify(5) facility is implemented for purposes of offering compatibility for Linux-borne applications, native applications may opt to use it instead of (or in addition to) the
PORT_SOURCE_FILE capability of event ports. See
inotify(5) for details and restrictions.
SEE ALSO
inotify_init(3C), inotify_init1(3C), port_create(3C), port_associate(3C), port_get(3C), inotify(5)