]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/inotify_init.2
mmap.2: srcfix: note kernel commit that caused MAP_POPULATE | MAP_NONBLOCK to be...
[thirdparty/man-pages.git] / man2 / inotify_init.2
CommitLineData
4d2b74dd 1.\" Copyright (C) 2005 Robert Love
e5c75695 2.\" and Copyright (C) 2008, Michael Kerrisk <mtk.manpages@gmail.com>
4d2b74dd 3.\"
1dd72f9c 4.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
4d2b74dd
MK
5.\" This is free documentation; you can redistribute it and/or
6.\" modify it under the terms of the GNU General Public License as
7.\" published by the Free Software Foundation; either version 2 of
8.\" the License, or (at your option) any later version.
9.\"
10.\" The GNU General Public License's references to "object code"
11.\" and "executables" are to be interpreted as the output of any
12.\" document formatting or typesetting system, including
13.\" intermediate and printed output.
14.\"
15.\" This manual is distributed in the hope that it will be useful,
16.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18.\" GNU General Public License for more details.
19.\"
20.\" You should have received a copy of the GNU General Public
c715f741
MK
21.\" License along with this manual; if not, see
22.\" <http://www.gnu.org/licenses/>.
6a8d8745 23.\" %%%LICENSE_END
4d2b74dd
MK
24.\"
25.\" 2005-07-19 Robert Love <rlove@rlove.org> - initial version
26.\" 2006-02-07 mtk, minor changes
ef4d5ffd 27.\" 2008-10-10 mtk: add description of inotify_init1()
4d2b74dd 28.\"
e8426ca2 29.TH INOTIFY_INIT 2 2020-04-11 "Linux" "Linux Programmer's Manual"
4d2b74dd 30.SH NAME
ef4d5ffd 31inotify_init, inotify_init1 \- initialize an inotify instance
4d2b74dd 32.SH SYNOPSIS
ef4d5ffd 33.nf
6e969f22 34.B #include <sys/inotify.h>
68e4db0a 35.PP
0daa9e92 36.B "int inotify_init(void);"
ef4d5ffd
MK
37.BI "int inotify_init1(int " flags );
38.fi
4d2b74dd 39.SH DESCRIPTION
41d9a4af
MK
40For an overview of the inotify API, see
41.BR inotify (7).
efeece04 42.PP
4d2b74dd
MK
43.BR inotify_init ()
44initializes a new inotify instance and returns a file descriptor associated
45with a new inotify event queue.
efeece04 46.PP
ef4d5ffd
MK
47If
48.I flags
49is 0, then
50.BR inotify_init1 ()
51is the same as
52.BR inotify_init ().
53The following values can be bitwise ORed in
54.IR flags
55to obtain different behavior:
0019177e 56.TP
ef4d5ffd
MK
57.B IN_NONBLOCK
58Set the
59.BR O_NONBLOCK
7f11e32c
MK
60file status flag on the open file description (see
61.BR open (2))
62referred to by the new file descriptor.
ef4d5ffd 63Using this flag saves extra calls to
ef7db4f5 64.BR fcntl (2)
ef4d5ffd
MK
65to achieve the same result.
66.TP
67.B IN_CLOEXEC
68Set the close-on-exec
51d61866 69.RB ( FD_CLOEXEC )
ef4d5ffd 70flag on the new file descriptor.
c5571b61 71See the description of the
ef4d5ffd
MK
72.B O_CLOEXEC
73flag in
74.BR open (2)
75for reasons why this may be useful.
47297adb 76.SH RETURN VALUE
ef4d5ffd
MK
77On success, these system calls return a new file descriptor.
78On error, \-1 is returned, and
4d2b74dd 79.I errno
ef4d5ffd 80is set to indicate the error.
4d2b74dd
MK
81.SH ERRORS
82.TP
ef4d5ffd
MK
83.B EINVAL
84.RB ( inotify_init1 ())
85An invalid value was specified in
86.IR flags .
87.TP
4d2b74dd
MK
88.B EMFILE
89The user limit on the total number of inotify instances has been reached.
90.TP
78d8b29e
MK
91.B EMFILE
92The per-process limit on the number of open file descriptors has been reached.
93.TP
4d2b74dd 94.B ENFILE
e258766b 95The system-wide limit on the total number of open files has been reached.
4d2b74dd
MK
96.TP
97.B ENOMEM
98Insufficient kernel memory is available.
ff457ccb 99.SH VERSIONS
ef4d5ffd 100.BR inotify_init ()
982ff543 101first appeared in Linux 2.6.13;
80657327 102library support was added to glibc in version 2.4.
ef4d5ffd 103.BR inotify_init1 ()
c95b6ae1 104was added in Linux 2.6.27;
80657327 105library support was added to glibc in version 2.9.
47297adb 106.SH CONFORMING TO
ef4d5ffd 107These system calls are Linux-specific.
47297adb 108.SH SEE ALSO
4d2b74dd 109.BR inotify_add_watch (2),
c13182ef 110.BR inotify_rm_watch (2),
ccd2b351 111.BR inotify (7)