Debian Codegraph @

upstream/debian-unstable/man2/inotify_init.2

raw
1 .\" Copyright 2005, Robert Love <[email protected]>
2 .\" Copyright 2008, Michael Kerrisk <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .\"
7 .TH inotify_init 2 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 inotify_init, inotify_init1 \- initialize an inotify instance
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B #include <sys/inotify.h>
16 .P
17 .B "int inotify_init(void);"
18 .BI "int inotify_init1(int " flags );
19 .fi
20 .SH DESCRIPTION
21 For an overview of the inotify API, see
22 .BR inotify (7).
23 .P
24 .BR inotify_init ()
25 initializes a new inotify instance and returns a file descriptor associated
26 with a new inotify event queue.
27 .P
28 If
29 .I flags
30 is 0, then
31 .BR inotify_init1 ()
32 is the same as
33 .BR inotify_init ().
34 The following values can be bitwise ORed in
35 .I flags
36 to obtain different behavior:
37 .TP
38 .B IN_NONBLOCK
39 Set the
40 .B O_NONBLOCK
41 file status flag on the open file description (see
42 .BR open (2))
43 referred to by the new file descriptor.
44 Using this flag saves extra calls to
45 .BR fcntl (2)
46 to achieve the same result.
47 .TP
48 .B IN_CLOEXEC
49 Set the close-on-exec
50 .RB ( FD_CLOEXEC )
51 flag on the new file descriptor.
52 See the description of the
53 .B O_CLOEXEC
54 flag in
55 .BR open (2)
56 for reasons why this may be useful.
57 .SH RETURN VALUE
58 On success, these system calls return a new file descriptor.
59 On error, \-1 is returned, and
60 .I errno
61 is set to indicate the error.
62 .SH ERRORS
63 .TP
64 .B EINVAL
65 .RB ( inotify_init1 ())
66 An invalid value was specified in
67 .IR flags .
68 .TP
69 .B EMFILE
70 The user limit on the total number of inotify instances has been reached.
71 .TP
72 .B EMFILE
73 The per-process limit on the number of open file descriptors has been reached.
74 .TP
75 .B ENFILE
76 The system-wide limit on the total number of open files has been reached.
77 .TP
78 .B ENOMEM
79 Insufficient kernel memory is available.
80 .SH STANDARDS
81 Linux.
82 .SH HISTORY
83 .TP
84 .BR inotify_init ()
85 Linux 2.6.13,
86 glibc 2.4.
87 .TP
88 .BR inotify_init1 ()
89 Linux 2.6.27,
90 glibc 2.9.
91 .SH SEE ALSO
92 .BR inotify_add_watch (2),
93 .BR inotify_rm_watch (2),
94 .BR inotify (7)