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