1 INOTIFY_INIT(3C) Standard C Library Functions INOTIFY_INIT(3C)
2
3
4
5 NAME
6 inotify_init, inotify_init1 - initialize an inotify instance
7
8 SYNOPSIS
9 #include <sys/inotify.h>
10
11 int inotify_init(void);
12
13
14 int inotify_init1(int flags);
15
16
17 DESCRIPTION
18 The inotify_init() and inotify_init1() functions both create an
19 inotify(5) instance that can be operated upon via
20 inotify_add_watch(3C), inotify_rm_watch(3C) and read(2). inotify
21 instances are represented as file descriptors, and should be closed via
22 close(2).
23
24 The only difference between the two functions is their signature;
25 inotify_init() takes no arguments, while inotify_init1() takes a flags
26 argument that can have any of the following values:
27
28
29 IN_CLOEXEC
30 Instance should be closed upon an exec(2); see open(2)'s
31 description of O_CLOEXEC.
32
33
34 IN_NONBLOCK
35 Instance will be set to be non-blocking. A read(2) on an
36 inotify instance that has been initialized with IN_NONBLOCK
37 will return EAGAIN if there are no events enqueued in lieu
38 of blocking.
39
40
41 RETURN VALUES
42 Upon succesful completion, 0 is returned. Otherwise, -1 is returned and
43 errno is set to indicate the error.
44
45 ERRORS
46 The inotify_init() and inotify_init1() functions will fail if:
47
48 EINVAL
49 The flags are invalid (inotify_init1()).
50
51
52 EMFILE
53 There are currently {OPEN_MAX} file descriptors open in the
54 calling process, or the maximum number of inotify instances
55 for the user would be exceeded.
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 inotiy_add_watch(3C), inotify_rm_watch(3C), inotify(5)
69
70
71
72 September 17, 2014 INOTIFY_INIT(3C)