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