]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/inotify_init.2
Many pages: Fix style issues reported by `make lint-groff`
[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.\"
e4a74ca8 4.\" SPDX-License-Identifier: GPL-2.0-or-later
4d2b74dd
MK
5.\"
6.\" 2005-07-19 Robert Love <rlove@rlove.org> - initial version
7.\" 2006-02-07 mtk, minor changes
ef4d5ffd 8.\" 2008-10-10 mtk: add description of inotify_init1()
4d2b74dd 9.\"
e8426ca2 10.TH INOTIFY_INIT 2 2020-04-11 "Linux" "Linux Programmer's Manual"
4d2b74dd 11.SH NAME
ef4d5ffd 12inotify_init, inotify_init1 \- initialize an inotify instance
66f137aa
AC
13.SH LIBRARY
14Standard C library
8fc3b2cf 15.RI ( libc ", " \-lc )
4d2b74dd 16.SH SYNOPSIS
ef4d5ffd 17.nf
6e969f22 18.B #include <sys/inotify.h>
68e4db0a 19.PP
0daa9e92 20.B "int inotify_init(void);"
ef4d5ffd
MK
21.BI "int inotify_init1(int " flags );
22.fi
4d2b74dd 23.SH DESCRIPTION
41d9a4af
MK
24For an overview of the inotify API, see
25.BR inotify (7).
efeece04 26.PP
4d2b74dd
MK
27.BR inotify_init ()
28initializes a new inotify instance and returns a file descriptor associated
29with a new inotify event queue.
efeece04 30.PP
ef4d5ffd
MK
31If
32.I flags
33is 0, then
34.BR inotify_init1 ()
35is the same as
36.BR inotify_init ().
37The following values can be bitwise ORed in
1ae6b2c7 38.I flags
ef4d5ffd 39to obtain different behavior:
0019177e 40.TP
ef4d5ffd
MK
41.B IN_NONBLOCK
42Set the
1ae6b2c7 43.B O_NONBLOCK
7f11e32c
MK
44file status flag on the open file description (see
45.BR open (2))
46referred to by the new file descriptor.
ef4d5ffd 47Using this flag saves extra calls to
ef7db4f5 48.BR fcntl (2)
ef4d5ffd
MK
49to achieve the same result.
50.TP
51.B IN_CLOEXEC
52Set the close-on-exec
51d61866 53.RB ( FD_CLOEXEC )
ef4d5ffd 54flag on the new file descriptor.
c5571b61 55See the description of the
ef4d5ffd
MK
56.B O_CLOEXEC
57flag in
58.BR open (2)
59for reasons why this may be useful.
47297adb 60.SH RETURN VALUE
ef4d5ffd
MK
61On success, these system calls return a new file descriptor.
62On error, \-1 is returned, and
4d2b74dd 63.I errno
ef4d5ffd 64is set to indicate the error.
4d2b74dd
MK
65.SH ERRORS
66.TP
ef4d5ffd
MK
67.B EINVAL
68.RB ( inotify_init1 ())
69An invalid value was specified in
70.IR flags .
71.TP
4d2b74dd
MK
72.B EMFILE
73The user limit on the total number of inotify instances has been reached.
74.TP
78d8b29e
MK
75.B EMFILE
76The per-process limit on the number of open file descriptors has been reached.
77.TP
4d2b74dd 78.B ENFILE
e258766b 79The system-wide limit on the total number of open files has been reached.
4d2b74dd
MK
80.TP
81.B ENOMEM
82Insufficient kernel memory is available.
ff457ccb 83.SH VERSIONS
ef4d5ffd 84.BR inotify_init ()
982ff543 85first appeared in Linux 2.6.13;
80657327 86library support was added to glibc in version 2.4.
ef4d5ffd 87.BR inotify_init1 ()
c95b6ae1 88was added in Linux 2.6.27;
80657327 89library support was added to glibc in version 2.9.
47297adb 90.SH CONFORMING TO
ef4d5ffd 91These system calls are Linux-specific.
47297adb 92.SH SEE ALSO
4d2b74dd 93.BR inotify_add_watch (2),
c13182ef 94.BR inotify_rm_watch (2),
ccd2b351 95.BR inotify (7)