|
INOTIFY_INIT(3C) |
Standard C Library Functions |
INOTIFY_INIT(3C) |
NAME
inotify_init, inotify_init1 - initialize an inotify instance
SYNOPSIS
#include <sys/inotify.h>
int inotify_init(
void);
int inotify_init1(
int flags);
DESCRIPTION
The
inotify_init() and
inotify_init1() functions both create an
inotify(5) instance that can be operated upon via
inotify_add_watch(3C),
inotify_rm_watch(3C) and
read(2).
inotify instances are represented as file descriptors, and should be closed via
close(2).
The only difference between the two functions is their signature;
inotify_init() takes no arguments, while
inotify_init1() takes a
flags argument that can have any of the following values:
IN_CLOEXEC
Instance should be closed upon an exec(2); see open(2)'s description of O_CLOEXEC.
IN_NONBLOCK
Instance will be set to be non-blocking. A read(2) on an inotify instance that has been initialized with IN_NONBLOCK will return EAGAIN if there are no events enqueued in lieu of blocking.
RETURN VALUES
Upon succesful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The
inotify_init() and
inotify_init1() functions will fail if:
EINVAL
The flags are invalid (inotify_init1()).
EMFILE
There are currently {OPEN_MAX} file descriptors open in the calling process, or the maximum number of inotify instances for the user would be exceeded.
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
inotiy_add_watch(3C), inotify_rm_watch(3C), inotify(5)