1INOTIFY_INIT(2) Linux Programmer's Manual INOTIFY_INIT(2)
2
3
4
6 inotify_init, inotify_init1 - initialize an inotify instance
7
9 #include <sys/inotify.h>
10
11 int inotify_init(void);
12 int inotify_init1(int flags);
13
15 For an overview of the inotify API, see inotify(7).
16
17 inotify_init() initializes a new inotify instance and returns a file
18 descriptor associated with a new inotify event queue.
19
20 If flags is 0, then inotify_init1() is the same as inotify_init(). The
21 following values can be bitwise ORed in flags to obtain different
22 behavior:
23
24 IN_NONBLOCK
25 Set the O_NONBLOCK file status flag on the open file description
26 (see open(2)) referred to by the new file descriptor. Using
27 this flag saves extra calls to fcntl(2) to achieve the same
28 result.
29
30 IN_CLOEXEC
31 Set the close-on-exec (FD_CLOEXEC) flag on the new file descripâ
32 tor. See the description of the O_CLOEXEC flag in open(2) for
33 reasons why this may be useful.
34
36 On success, these system calls return a new file descriptor. On error,
37 -1 is returned, and errno is set to indicate the error.
38
40 EINVAL (inotify_init1()) An invalid value was specified in flags.
41
42 EMFILE The user limit on the total number of inotify instances has been
43 reached.
44
45 EMFILE The per-process limit on the number of open file descriptors has
46 been reached.
47
48 ENFILE The system-wide limit on the total number of open files has been
49 reached.
50
51 ENOMEM Insufficient kernel memory is available.
52
54 inotify_init() first appeared in Linux 2.6.13; library support was
55 added to glibc in version 2.4. inotify_init1() was added in Linux
56 2.6.27; library support was added to glibc in version 2.9.
57
59 These system calls are Linux-specific.
60
62 inotify_add_watch(2), inotify_rm_watch(2), inotify(7)
63
65 This page is part of release 5.07 of the Linux man-pages project. A
66 description of the project, information about reporting bugs, and the
67 latest version of this page, can be found at
68 https://www.kernel.org/doc/man-pages/.
69
70
71
72Linux 2020-04-11 INOTIFY_INIT(2)