autodoc.git
/
traditional_manual
/
chapter_21.html
version
»
Context lines:
10
20
40
80
file
none
3
autodoc.git/traditional_manual/chapter_21.html:52260:
</dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>System.Inotify.Instance</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>add_watch</b></span> </dt>
-
<dd><p><code><code class='datatype'>int</code> <b><span class='method'>add_watch</span>(</b><code class='datatype'>string</code> <code class='argument'>
file
</code>, <code class='datatype'>int</code> <code class='argument'>mask</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>int</code> <b><span class='method'>add_watch</span>(</b><code class='datatype'>string</code> <code class='argument'>
path
</code>, <code class='datatype'>int</code> <code class='argument'>mask</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Add a watch for a certain file or directory and specific events.
-
Adding more than one watch for
one
file
will overwrite the
+
<dd class='body--doc'><p>Add a watch for a certain file or directory and specific events.
</p>
+
<p>
Adding more than one watch for
a
path
will overwrite the
previous watch unless <code>System.Inotify.IN_MASK_ADD</code> is contained in the mask.</p> </dd> <dt class='head--doc'><span id='p-path'></span>Parameter <code class='parameter'>path</code></dt> <dd></dd><dd class='body--doc'><p>Path of the file or directory.</p> </dd> <dt class='head--doc'><span id='p-mask'></span>Parameter <code class='parameter'>mask</code></dt> <dd></dd><dd class='body--doc'><p>Integer mask specifying the event type. This can be a combination of different event types using bitwise OR. See the inotify manpage for possible values and their description. The values defined by the inotify header file are exported by <code>System.Inotify</code> as constants using the same names (e.g. <code>System.Inotify.IN_CREATE</code>).</p> </dd> <dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'><p>Returns a watch descriptor.</p>
+
<dd class='body--doc'><p>Returns a watch descriptor
on success, and <code class='expr'>-1</code>
+
on filesystem-related failures, in which case <code>errno()</code>
+
will indicate the cause
.
These typically indicate time of
+
check, time of use race conditions. For other failures
+
errors are thrown.
</p>
</dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Subdirectories are not watched. If you want to watch subdirectories as well, you need to add watches for them individually.</p> </dd> <dt class='head--doc'>Note</dt>
-
<dd class='body--doc'><p>At creation of a watch for a directory simulated
+
<dd class='body--doc'><p>At creation of a watch for a directory
,
simulated
<code>IN_CREATE</code>-events with cookie <code class='expr'>0x7fffffff</code> will be added for the initial contents of the directory. This is to reduce the risk of losing state changes due to races. Note that is is not known whether these paths are in flux or not. Note also that there may be multiple notifications for content that is created at the moment the watch is created.</p> </dd>
-
+
<dt class='head--doc'>Note</dt>
+
<dd class='body--doc'><p>In old versions of Pike errors were thrown for
+
all failures.</p>
+
</dd>
<dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>rm_watch()</code>, <code>parse_event()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>event_callback</b></span> </dt>