This file is indexed.

/usr/share/doc/python-gtk2-tutorial/html/sec-MonitoringIO.html is in python-gtk2-tutorial 2.4-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>19.2. Monitoring IO</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Tutorial"><link rel="up" href="ch-TimeoutsIOAndIdleFunctions.html" title="Chapter 19. Timeouts, IO and Idle Functions"><link rel="previous" href="ch-TimeoutsIOAndIdleFunctions.html" title="Chapter 19. Timeouts, IO and Idle Functions"><link rel="next" href="sec-IdleFunctions.html" title="19.3. Idle Functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">19.2. Monitoring IO</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch-TimeoutsIOAndIdleFunctions.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Timeouts, IO and Idle Functions</th><td width="20%" align="right"> <a accesskey="n" href="sec-IdleFunctions.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec-MonitoringIO"></a>19.2. Monitoring IO</h2></div></div><div></div></div><p>You can check for the ability to read from or write to a file
(either a Python file or a lower level OS file) and then automatically
invoke a callback. This is especially useful for networking applications.
The gobject module function:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  source_id = gobject.io_add_watch(<i class="parameter"><tt>source</tt></i>, <i class="parameter"><tt>condition</tt></i>, <i class="parameter"><tt>callback</tt></i>)
</pre></td></tr></table><p>where the first argument (<i class="parameter"><tt>source</tt></i>) is the
open file (Python file object or lower level file descriptor integer) you
wish to have watched. The <tt class="function">gobject.io_add_watch</tt>()
function uses the lower level file descriptor integer internally but the
function will extract it from the Python file object using the
<tt class="methodname">fileno</tt>() method as needed. The second argument
(<i class="parameter"><tt>condition</tt></i>) specifies what you want to look for. This
may be one of:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  gobject.IO_IN - There is data ready for reading from your file.

  gobject.IO_OUT - The file is ready for writing.

  gobject.IO_PRI - There is urgent data to read.

  gobject.IO_ERR - Error condition.

  gobject.IO_HUP - Hung up (the connection has been broken, usually for
                   pipes and sockets).
</pre></td></tr></table><p>These are defined in the gobject module. As I'm sure you've
figured out already, the third argument is the <i class="parameter"><tt>callback</tt></i>
you wish to have called when the above conditions are satisfied.</p><p>The return value <i class="parameter"><tt>source_id</tt></i> may be used
to stop the monitoring of the file by using the following function:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  gobject.source_remove(<i class="parameter"><tt>source_id</tt></i>)
</pre></td></tr></table><p>The callback function should be similar to:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  def input_callback(<i class="parameter"><tt>source</tt></i>, <i class="parameter"><tt>condition</tt></i>):
</pre></td></tr></table><p>where <i class="parameter"><tt>source</tt></i> and
<i class="parameter"><tt>condition</tt></i> are as specified above. The source value
will be the lower level file descriptor integer and not the Python file
object (i.e. the value that is returned from the Python file method
<tt class="methodname">fileno</tt>()).</p><p>You may also stop the callback function from being called again
by returning zero or <tt class="literal">FALSE</tt> from your callback. If you
want your callback to be called again, it should return
<tt class="literal">TRUE</tt>.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch-TimeoutsIOAndIdleFunctions.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch-TimeoutsIOAndIdleFunctions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sec-IdleFunctions.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 19. Timeouts, IO and Idle Functions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 19.3. Idle Functions</td></tr></table></div></body></html>