OSDN Git Service

41fccb7d71559a3ddc6f95157804f488ecf893f2
[linuxjm/LDP_man-pages.git] / original / man2 / inotify_init.2
1 .\" man2/inotify_init.2 - inotify_init man page
2 .\"
3 .\" Copyright (C) 2005 Robert Love
4 .\"
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
21 .\" License along with this manual; if not, write to the Free
22 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" USA.
24 .\"
25 .\" 2005-07-19 Robert Love <rlove@rlove.org> - initial version
26 .\" 2006-02-07 mtk, minor changes
27 .\" 2008-10-10 mtk: add description of inotify_init1()
28 .\"
29 .TH INOTIFY_INIT 2 2012-05-04 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 inotify_init, inotify_init1 \- initialize an inotify instance
32 .SH SYNOPSIS
33 .nf
34 .B #include <sys/inotify.h>
35 .sp
36 .B "int inotify_init(void);"
37 .BI "int inotify_init1(int " flags );
38 .fi
39 .SH DESCRIPTION
40 .BR inotify_init ()
41 initializes a new inotify instance and returns a file descriptor associated
42 with a new inotify event queue.
43
44 If
45 .I flags
46 is 0, then
47 .BR inotify_init1 ()
48 is the same as
49 .BR inotify_init ().
50 The following values can be bitwise ORed in
51 .IR flags
52 to obtain different behavior:
53 .TP 12
54 .B IN_NONBLOCK
55 Set the
56 .BR O_NONBLOCK
57 file status flag on the new open file description.
58 Using this flag saves extra calls to
59 .BR fcntl (2)
60 to achieve the same result.
61 .TP
62 .B IN_CLOEXEC
63 Set the close-on-exec
64 .RB ( FD_CLOEXEC )
65 flag on the new file descriptor.
66 See the description of the
67 .B O_CLOEXEC
68 flag in
69 .BR open (2)
70 for reasons why this may be useful.
71 .SH "RETURN VALUE"
72 On success, these system calls return a new file descriptor.
73 On error, \-1 is returned, and
74 .I errno
75 is set to indicate the error.
76 .SH ERRORS
77 .TP
78 .B EINVAL
79 .RB ( inotify_init1 ())
80 An invalid value was specified in
81 .IR flags .
82 .TP
83 .B EMFILE
84 The user limit on the total number of inotify instances has been reached.
85 .TP
86 .B ENFILE
87 The system limit on the total number of file descriptors has been reached.
88 .TP
89 .B ENOMEM
90 Insufficient kernel memory is available.
91 .SH VERSIONS
92 .BR inotify_init ()
93 first appeared in Linux 2.6.1;
94 library support was added to glibc in version 2.4.
95 .BR inotify_init1 ()
96 was added in Linux 2.6.27;
97 library support was added to glibc in version 2.9.
98 .SH "CONFORMING TO"
99 These system calls are Linux-specific.
100 .SH "SEE ALSO"
101 .BR inotify_add_watch (2),
102 .BR inotify_rm_watch (2),
103 .BR inotify (7)