]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/inotify_add_watch.2
Removed FIXME for IN_ONESHOT, since the bug is now confirmed
[thirdparty/man-pages.git] / man2 / inotify_add_watch.2
1 .\" man2/inotify_add_watch.2 - inotify_add_watch man page
2 .\"
3 .\" Copyright (C) 2005 Robert Love
4 .\" and Copyright, 2006 Michael Kerrisk
5 .\"
6 .\" This is free documentation; you can redistribute it and/or
7 .\" modify it under the terms of the GNU General Public License as
8 .\" published by the Free Software Foundation; either version 2 of
9 .\" the License, or (at your option) any later version.
10 .\"
11 .\" The GNU General Public License's references to "object code"
12 .\" and "executables" are to be interpreted as the output of any
13 .\" document formatting or typesetting system, including
14 .\" intermediate and printed output.
15 .\"
16 .\" This manual is distributed in the hope that it will be useful,
17 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 .\" GNU General Public License for more details.
20 .\"
21 .\" You should have received a copy of the GNU General Public
22 .\" License along with this manual; if not, write to the Free
23 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
24 .\" USA.
25 .\"
26 .\" 2005-07-19 Robert Love <rlove@rlove.org> - initial version
27 .\" 2006-02-07 mtk, various changes
28 .\"
29 .TH INOTIFY_ADD_WATCH 2 2006-02-07 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 inotify_add_watch \- add a watch to an initialized inotify instance
32 .SH SYNOPSIS
33 .B #include <inotify.h>
34 .sp
35 .BI "int inotify_add_watch(int " fd ", const char *" path ", uint32_t " mask );
36 .SH DESCRIPTION
37 .BR inotify_add_watch ()
38 adds a watch on the file at pathname
39 .I path
40 to the inotify instance mapped by the file descriptor
41 .I fd
42 with the event mask given by the bitmask
43 .IR mask .
44 See
45 .BR inotify (7)
46 for a description of the bits that can be set in
47 .IR mask .
48
49 A successful call to
50 .BR inotify_add_watch ()
51 returns the unique watch descriptor associated with
52 .I path
53 for this inotify instance.
54 If
55 .I path
56 was not previously being watched by this inotify instance,
57 then the watch descriptor is newly allocated.
58 If
59 .I path
60 was already being watched, then the descriptor
61 for the existing watch is returned.
62
63 The watch descriptor is returned by later
64 .BR read (2)s
65 from the inotify file descriptor.
66 These reads fetch
67 .I inotify_event
68 structures indicating file system events;
69 the returned watch descriptor identifies
70 the object for which the event occurred.
71 .SH "RETURN VALUE"
72 On success,
73 .BR inotify_add_watch ()
74 returns a non-negative watch descriptor.
75 On error \-1 is returned and
76 .I errno
77 is set appropriately.
78 .SH ERRORS
79 .TP
80 .B EACCESS
81 Read access to the given file is not permitted.
82 .TP
83 .B EBADF
84 The given file descriptor is not valid.
85 .TP
86 .B EFAULT
87 .I path
88 points outside of the process's accessible address space.
89 .TP
90 .B EINVAL
91 The given event mask contains no legal events.
92 .TP
93 .B ENOMEM
94 Insufficient kernel memory was available.
95 .TP
96 .B ENOSPC
97 The user limit on the total number of inotify watches was reached or the
98 kernel failed to allocate a needed resource.
99 .SH "HISTORY"
100 Inotify was merged into the 2.6.13 Linux kernel.
101 .SH "CONFORMING TO"
102 This system call is Linux specific.
103 .SH "BUGS"
104 In kernels before 2.6.16, the
105 .B IN_ONESHOT
106 .I mask
107 flag does not work.
108 .SH "SEE ALSO"
109 .BR inotify_init (2),
110 .BR inotify_rm_watch (2),
111 .BR inotify (7).