1inotify_init(2) System Calls Manual inotify_init(2)
2
3
4
6 inotify_init, inotify_init1 - initialize an inotify instance
7
9 Standard C library (libc, -lc)
10
12 #include <sys/inotify.h>
13
14 int inotify_init(void);
15 int inotify_init1(int flags);
16
18 For an overview of the inotify API, see inotify(7).
19
20 inotify_init() initializes a new inotify instance and returns a file
21 descriptor associated with a new inotify event queue.
22
23 If flags is 0, then inotify_init1() is the same as inotify_init(). The
24 following values can be bitwise ORed in flags to obtain different be‐
25 havior:
26
27 IN_NONBLOCK
28 Set the O_NONBLOCK file status flag on the open file description
29 (see open(2)) referred to by the new file descriptor. Using
30 this flag saves extra calls to fcntl(2) to achieve the same re‐
31 sult.
32
33 IN_CLOEXEC
34 Set the close-on-exec (FD_CLOEXEC) flag on the new file descrip‐
35 tor. See the description of the O_CLOEXEC flag in open(2) for
36 reasons why this may be useful.
37
39 On success, these system calls return a new file descriptor. On error,
40 -1 is returned, and errno is set to indicate the error.
41
43 EINVAL (inotify_init1()) An invalid value was specified in flags.
44
45 EMFILE The user limit on the total number of inotify instances has been
46 reached.
47
48 EMFILE The per-process limit on the number of open file descriptors has
49 been reached.
50
51 ENFILE The system-wide limit on the total number of open files has been
52 reached.
53
54 ENOMEM Insufficient kernel memory is available.
55
57 Linux.
58
60 inotify_init()
61 Linux 2.6.13, glibc 2.4.
62
63 inotify_init1()
64 Linux 2.6.27, glibc 2.9.
65
67 inotify_add_watch(2), inotify_rm_watch(2), inotify(7)
68
69
70
71Linux man-pages 6.05 2023-03-30 inotify_init(2)