/
usr
/
share
/
doc
/
python2-docs
/
html
/
library
/
/usr/share/doc/python2-docs/html/library
mkdir
upload
Name
Size
Mode
Actions
2to3.html
59507
0644
edit
dl
rm
abc.html
25826
0644
edit
dl
rm
aepack.html
14164
0644
edit
dl
rm
aetools.html
16389
0644
edit
dl
rm
aetypes.html
21021
0644
edit
dl
rm
aifc.html
25064
0644
edit
dl
rm
al.html
18672
0644
edit
dl
rm
allos.html
35297
0644
edit
dl
rm
anydbm.html
18124
0644
edit
dl
rm
archiving.html
10078
0644
edit
dl
rm
argparse.html
263616
0644
edit
dl
rm
array.html
31855
0644
edit
dl
rm
ast.html
38167
0644
edit
dl
rm
asynchat.html
33930
0644
edit
dl
rm
asyncore.html
40631
0644
edit
dl
rm
atexit.html
18455
0644
edit
dl
rm
audioop.html
34252
0644
edit
dl
rm
autogil.html
8733
0644
edit
dl
rm
base64.html
21862
0644
edit
dl
rm
basehttpserver.html
37441
0644
edit
dl
rm
bastion.html
11798
0644
edit
dl
rm
bdb.html
41395
0644
edit
dl
rm
binascii.html
22997
0644
edit
dl
rm
binhex.html
11309
0644
edit
dl
rm
bisect.html
24666
0644
edit
dl
rm
bsddb.html
28589
0644
edit
dl
rm
bz2.html
29048
0644
edit
dl
rm
calendar.html
41762
0644
edit
dl
rm
carbon.html
51998
0644
edit
dl
rm
cd.html
30033
0644
edit
dl
rm
cgi.html
55922
0644
edit
dl
rm
cgihttpserver.html
14026
0644
edit
dl
rm
cgitb.html
12263
0644
edit
dl
rm
chunk.html
15899
0644
edit
dl
rm
cmath.html
28365
0644
edit
dl
rm
cmd.html
29042
0644
edit
dl
rm
code.html
26959
0644
edit
dl
rm
codecs.html
118258
0644
edit
dl
rm
codeop.html
15898
0644
edit
dl
rm
collections.html
147647
0644
edit
dl
rm
colorpicker.html
8035
0644
edit
dl
rm
colorsys.html
11919
0644
edit
dl
rm
commands.html
15516
0644
edit
dl
rm
compileall.html
18621
0644
edit
dl
rm
compiler.html
75897
0644
edit
dl
rm
configparser.html
67751
0644
edit
dl
rm
constants.html
13979
0644
edit
dl
rm
contextlib.html
22777
0644
edit
dl
rm
cookie.html
41854
0644
edit
dl
rm
cookielib.html
91032
0644
edit
dl
rm
copy.html
13004
0644
edit
dl
rm
copy_reg.html
14691
0644
edit
dl
rm
crypt.html
10647
0644
edit
dl
rm
crypto.html
7761
0644
edit
dl
rm
csv.html
76456
0644
edit
dl
rm
ctypes.html
264575
0644
edit
dl
rm
curses.ascii.html
24873
0644
edit
dl
rm
curses.html
167501
0644
edit
dl
rm
curses.panel.html
15824
0644
edit
dl
rm
custominterp.html
8026
0644
edit
dl
rm
datatypes.html
18015
0644
edit
dl
rm
datetime.html
253438
0644
edit
dl
rm
dbhash.html
16825
0644
edit
dl
rm
dbm.html
13507
0644
edit
dl
rm
debug.html
10703
0644
edit
dl
rm
decimal.html
222315
0644
edit
dl
rm
development.html
14828
0644
edit
dl
rm
difflib.html
91975
0644
edit
dl
rm
dircache.html
12299
0644
edit
dl
rm
dis.html
84156
0644
edit
dl
rm
distribution.html
7679
0644
edit
dl
rm
distutils.html
10152
0644
edit
dl
rm
dl.html
17668
0644
edit
dl
rm
doctest.html
185883
0644
edit
dl
rm
docxmlrpcserver.html
17573
0644
edit
dl
rm
dumbdbm.html
15549
0644
edit
dl
rm
dummy_thread.html
10065
0644
edit
dl
rm
dummy_threading.html
8934
0644
edit
dl
rm
easydialogs.html
33124
0644
edit
dl
rm
email-examples.html
47424
0644
edit
dl
rm
email.charset.html
29424
0644
edit
dl
rm
email.encoders.html
12847
0644
edit
dl
rm
email.errors.html
17952
0644
edit
dl
rm
email.generator.html
23141
0644
edit
dl
rm
email.header.html
29108
0644
edit
dl
rm
email.html
55722
0644
edit
dl
rm
email.iterators.html
12623
0644
edit
dl
rm
email.message.html
70189
0644
edit
dl
rm
email.mime.html
31655
0644
edit
dl
rm
email.parser.html
35142
0644
edit
dl
rm
email.utils.html
27076
0644
edit
dl
rm
ensurepip.html
18327
0644
edit
dl
rm
errno.html
40246
0644
edit
dl
rm
exceptions.html
63693
0644
edit
dl
rm
fcntl.html
26245
0644
edit
dl
rm
filecmp.html
23997
0644
edit
dl
rm
fileformats.html
9653
0644
edit
dl
rm
fileinput.html
27071
0644
edit
dl
rm
filesys.html
10866
0644
edit
dl
rm
fl.html
56525
0644
edit
dl
rm
fm.html
13009
0644
edit
dl
rm
fnmatch.html
16258
0644
edit
dl
rm
formatter.html
37371
0644
edit
dl
rm
fpectl.html
16879
0644
edit
dl
rm
fpformat.html
11455
0644
edit
dl
rm
fractions.html
24888
0644
edit
dl
rm
framework.html
36934
0644
edit
dl
rm
frameworks.html
7551
0644
edit
dl
rm
ftplib.html
49577
0644
edit
dl
rm
functions.html
205640
0644
edit
dl
rm
functools.html
29645
0644
edit
dl
rm
future_builtins.html
14477
0644
edit
dl
rm
gc.html
28423
0644
edit
dl
rm
gdbm.html
17805
0644
edit
dl
rm
gensuitemodule.html
12574
0644
edit
dl
rm
getopt.html
25280
0644
edit
dl
rm
getpass.html
11426
0644
edit
dl
rm
gettext.html
84971
0644
edit
dl
rm
gl.html
24342
0644
edit
dl
rm
glob.html
14430
0644
edit
dl
rm
grp.html
11316
0644
edit
dl
rm
gzip.html
20576
0644
edit
dl
rm
hashlib.html
25467
0644
edit
dl
rm
heapq.html
34890
0644
edit
dl
rm
hmac.html
14374
0644
edit
dl
rm
hotshot.html
20147
0644
edit
dl
rm
htmllib.html
27682
0644
edit
dl
rm
htmlparser.html
42433
0644
edit
dl
rm
httplib.html
70932
0644
edit
dl
rm
i18n.html
10047
0644
edit
dl
rm
ic.html
18654
0644
edit
dl
rm
idle.html
42148
0644
edit
dl
rm
imageop.html
16099
0644
edit
dl
rm
imaplib.html
58515
0644
edit
dl
rm
imgfile.html
12732
0644
edit
dl
rm
imghdr.html
12238
0644
edit
dl
rm
imp.html
37603
0644
edit
dl
rm
importlib.html
8926
0644
edit
dl
rm
imputil.html
33563
0644
edit
dl
rm
index.html
79088
0644
edit
dl
rm
inspect.html
56823
0644
edit
dl
rm
internet.html
26138
0644
edit
dl
rm
intro.html
9353
0644
edit
dl
rm
io.html
113701
0644
edit
dl
rm
ipc.html
16598
0644
edit
dl
rm
itertools.html
125397
0644
edit
dl
rm
jpeg.html
13757
0644
edit
dl
rm
json.html
73678
0644
edit
dl
rm
keyword.html
8210
0644
edit
dl
rm
language.html
11687
0644
edit
dl
rm
linecache.html
11416
0644
edit
dl
rm
locale.html
61576
0644
edit
dl
rm
logging.config.html
80045
0644
edit
dl
rm
logging.handlers.html
80194
0644
edit
dl
rm
logging.html
110254
0644
edit
dl
rm
mac.html
23376
0644
edit
dl
rm
macos.html
16129
0644
edit
dl
rm
macosa.html
14080
0644
edit
dl
rm
macostools.html
16898
0644
edit
dl
rm
macpath.html
8386
0644
edit
dl
rm
mailbox.html
171121
0644
edit
dl
rm
mailcap.html
14132
0644
edit
dl
rm
markup.html
19862
0644
edit
dl
rm
marshal.html
19456
0644
edit
dl
rm
math.html
44015
0644
edit
dl
rm
md5.html
15123
0644
edit
dl
rm
mhlib.html
24123
0644
edit
dl
rm
mimetools.html
21206
0644
edit
dl
rm
mimetypes.html
30634
0644
edit
dl
rm
mimewriter.html
16078
0644
edit
dl
rm
mimify.html
15279
0644
edit
dl
rm
miniaeframe.html
13109
0644
edit
dl
rm
misc.html
7236
0644
edit
dl
rm
mm.html
9570
0644
edit
dl
rm
mmap.html
30832
0644
edit
dl
rm
modulefinder.html
18096
0644
edit
dl
rm
modules.html
9017
0644
edit
dl
rm
msilib.html
57853
0644
edit
dl
rm
msvcrt.html
21232
0644
edit
dl
rm
multifile.html
26256
0644
edit
dl
rm
multiprocessing.html
414535
0644
edit
dl
rm
mutex.html
12147
0644
edit
dl
rm
netdata.html
18379
0644
edit
dl
rm
netrc.html
14021
0644
edit
dl
rm
new.html
13177
0644
edit
dl
rm
nis.html
11502
0644
edit
dl
rm
nntplib.html
45689
0644
edit
dl
rm
numbers.html
40636
0644
edit
dl
rm
numeric.html
14292
0644
edit
dl
rm
operator.html
93622
0644
edit
dl
rm
optparse.html
250109
0644
edit
dl
rm
os.html
240195
0644
edit
dl
rm
os.path.html
43402
0644
edit
dl
rm
ossaudiodev.html
45594
0644
edit
dl
rm
othergui.html
9403
0644
edit
dl
rm
parser.html
42558
0644
edit
dl
rm
pdb.html
38603
0644
edit
dl
rm
persistence.html
15676
0644
edit
dl
rm
pickle.html
109684
0644
edit
dl
rm
pickletools.html
11475
0644
edit
dl
rm
pipes.html
19685
0644
edit
dl
rm
pkgutil.html
27367
0644
edit
dl
rm
platform.html
31599
0644
edit
dl
rm
plistlib.html
18344
0644
edit
dl
rm
popen2.html
27601
0644
edit
dl
rm
poplib.html
24320
0644
edit
dl
rm
posix.html
16626
0644
edit
dl
rm
posixfile.html
21387
0644
edit
dl
rm
pprint.html
32207
0644
edit
dl
rm
profile.html
72788
0644
edit
dl
rm
pty.html
10195
0644
edit
dl
rm
pwd.html
12388
0644
edit
dl
rm
pyclbr.html
15812
0644
edit
dl
rm
pydoc.html
13650
0644
edit
dl
rm
pyexpat.html
80886
0644
edit
dl
rm
python.html
12854
0644
edit
dl
rm
py_compile.html
11932
0644
edit
dl
rm
queue.html
26856
0644
edit
dl
rm
quopri.html
12739
0644
edit
dl
rm
random.html
42722
0644
edit
dl
rm
re.html
155985
0644
edit
dl
rm
readline.html
37383
0644
edit
dl
rm
repr.html
21778
0644
edit
dl
rm
resource.html
28286
0644
edit
dl
rm
restricted.html
12366
0644
edit
dl
rm
rexec.html
40566
0644
edit
dl
rm
rfc822.html
46408
0644
edit
dl
rm
rlcompleter.html
14460
0644
edit
dl
rm
robotparser.html
13403
0644
edit
dl
rm
runpy.html
21925
0644
edit
dl
rm
sched.html
19878
0644
edit
dl
rm
scrolledtext.html
9728
0644
edit
dl
rm
select.html
44090
0644
edit
dl
rm
sets.html
40151
0644
edit
dl
rm
sgi.html
10371
0644
edit
dl
rm
sgmllib.html
34464
0644
edit
dl
rm
sha.html
13062
0644
edit
dl
rm
shelve.html
29955
0644
edit
dl
rm
shlex.html
35033
0644
edit
dl
rm
shutil.html
45454
0644
edit
dl
rm
signal.html
34023
0644
edit
dl
rm
simplehttpserver.html
20351
0644
edit
dl
rm
simplexmlrpcserver.html
37794
0644
edit
dl
rm
site.html
26887
0644
edit
dl
rm
smtpd.html
13587
0644
edit
dl
rm
smtplib.html
47054
0644
edit
dl
rm
sndhdr.html
10993
0644
edit
dl
rm
socket.html
116414
0644
edit
dl
rm
socketserver.html
76430
0644
edit
dl
rm
someos.html
16472
0644
edit
dl
rm
spwd.html
11163
0644
edit
dl
rm
sqlite3.html
150014
0644
edit
dl
rm
ssl.html
202453
0644
edit
dl
rm
stat.html
34597
0644
edit
dl
rm
statvfs.html
11326
0644
edit
dl
rm
stdtypes.html
298144
0644
edit
dl
rm
string.html
120219
0644
edit
dl
rm
stringio.html
20061
0644
edit
dl
rm
stringprep.html
17729
0644
edit
dl
rm
strings.html
15905
0644
edit
dl
rm
struct.html
44896
0644
edit
dl
rm
subprocess.html
110447
0644
edit
dl
rm
sun.html
7253
0644
edit
dl
rm
sunau.html
30011
0644
edit
dl
rm
sunaudio.html
19236
0644
edit
dl
rm
symbol.html
8140
0644
edit
dl
rm
symtable.html
25871
0644
edit
dl
rm
sys.html
110996
0644
edit
dl
rm
sysconfig.html
26299
0644
edit
dl
rm
syslog.html
19737
0644
edit
dl
rm
tabnanny.html
11393
0644
edit
dl
rm
tarfile.html
88728
0644
edit
dl
rm
telnetlib.html
27782
0644
edit
dl
rm
tempfile.html
31903
0644
edit
dl
rm
termios.html
17309
0644
edit
dl
rm
test.html
57030
0644
edit
dl
rm
textwrap.html
30135
0644
edit
dl
rm
thread.html
21486
0644
edit
dl
rm
threading.html
86655
0644
edit
dl
rm
time.html
63798
0644
edit
dl
rm
timeit.html
40529
0644
edit
dl
rm
tix.html
50582
0644
edit
dl
rm
tk.html
26568
0644
edit
dl
rm
tkinter.html
84316
0644
edit
dl
rm
token.html
20999
0644
edit
dl
rm
tokenize.html
20607
0644
edit
dl
rm
trace.html
28668
0644
edit
dl
rm
traceback.html
40900
0644
edit
dl
rm
ttk.html
108515
0644
edit
dl
rm
tty.html
9753
0644
edit
dl
rm
turtle.html
230483
0644
edit
dl
rm
types.html
29833
0644
edit
dl
rm
undoc.html
24680
0644
edit
dl
rm
unicodedata.html
20186
0644
edit
dl
rm
unittest.html
225021
0644
edit
dl
rm
unix.html
11223
0644
edit
dl
rm
urllib.html
68266
0644
edit
dl
rm
urllib2.html
113380
0644
edit
dl
rm
urlparse.html
43474
0644
edit
dl
rm
user.html
12707
0644
edit
dl
rm
userdict.html
32069
0644
edit
dl
rm
uu.html
11810
0644
edit
dl
rm
uuid.html
30137
0644
edit
dl
rm
warnings.html
50950
0644
edit
dl
rm
wave.html
24894
0644
edit
dl
rm
weakref.html
38808
0644
edit
dl
rm
webbrowser.html
26565
0644
edit
dl
rm
whichdb.html
9499
0644
edit
dl
rm
windows.html
9817
0644
edit
dl
rm
winsound.html
20466
0644
edit
dl
rm
wsgiref.html
88384
0644
edit
dl
rm
xdrlib.html
33018
0644
edit
dl
rm
xml.dom.html
97877
0644
edit
dl
rm
xml.dom.minidom.html
43230
0644
edit
dl
rm
xml.dom.pulldom.html
13835
0644
edit
dl
rm
xml.etree.elementtree.html
111804
0644
edit
dl
rm
xml.html
18007
0644
edit
dl
rm
xml.sax.handler.html
41877
0644
edit
dl
rm
xml.sax.html
23458
0644
edit
dl
rm
xml.sax.reader.html
44802
0644
edit
dl
rm
xml.sax.utils.html
16087
0644
edit
dl
rm
xmlrpclib.html
69191
0644
edit
dl
rm
zipfile.html
62227
0644
edit
dl
rm
zipimport.html
22769
0644
edit
dl
rm
zlib.html
31230
0644
edit
dl
rm
_winreg.html
64631
0644
edit
dl
rm
__builtin__.html
11069
0644
edit
dl
rm
__future__.html
14688
0644
edit
dl
rm
__main__.html
7512
0644
edit
dl
rm
Edit:
/usr/share/doc/python2-docs/html/library/select.html
(44090B)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>16.1. select — Waiting for I/O completion — Python 2.7.16 documentation</title> <link rel="stylesheet" href="../_static/classic.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/sidebar.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within Python 2.7.16 documentation" href="../_static/opensearch.xml"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="copyright" title="Copyright" href="../copyright.html" /> <link rel="next" title="16.2. threading — Higher-level threading interface" href="threading.html" /> <link rel="prev" title="16. Optional Operating System Services" href="someos.html" /> <link rel="shortcut icon" type="image/png" href="../_static/py.png" /> <link rel="canonical" href="https://docs.python.org/2/library/select.html" /> <script type="text/javascript" src="../_static/copybutton.js"></script> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="threading.html" title="16.2. threading — Higher-level threading interface" accesskey="N">next</a> |</li> <li class="right" > <a href="someos.html" title="16. Optional Operating System Services" accesskey="P">previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="https://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.16 documentation</a> » </li> <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li> <li class="nav-item nav-item-2"><a href="someos.html" accesskey="U">16. Optional Operating System Services</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="module-select"> <span id="select-waiting-for-i-o-completion"></span><h1>16.1. <a class="reference internal" href="#module-select" title="select: Wait for I/O completion on multiple streams."><code class="xref py py-mod docutils literal notranslate"><span class="pre">select</span></code></a> — Waiting for I/O completion<a class="headerlink" href="#module-select" title="Permalink to this headline">¶</a></h1> <p>This module provides access to the <code class="xref c c-func docutils literal notranslate"><span class="pre">select()</span></code> and <code class="xref c c-func docutils literal notranslate"><span class="pre">poll()</span></code> functions available in most operating systems, <code class="xref c c-func docutils literal notranslate"><span class="pre">epoll()</span></code> available on Linux 2.5+ and <code class="xref c c-func docutils literal notranslate"><span class="pre">kqueue()</span></code> available on most BSD. Note that on Windows, it only works for sockets; on other operating systems, it also works for other file types (in particular, on Unix, it works on pipes). It cannot be used on regular files to determine whether a file has grown since it was last read.</p> <p>The module defines the following:</p> <dl class="exception"> <dt id="select.error"> <em class="property">exception </em><code class="descclassname">select.</code><code class="descname">error</code><a class="headerlink" href="#select.error" title="Permalink to this definition">¶</a></dt> <dd><p>The exception raised when an error occurs. The accompanying value is a pair containing the numeric error code from <code class="xref c c-data docutils literal notranslate"><span class="pre">errno</span></code> and the corresponding string, as would be printed by the C function <code class="xref c c-func docutils literal notranslate"><span class="pre">perror()</span></code>.</p> </dd></dl> <dl class="function"> <dt id="select.epoll"> <code class="descclassname">select.</code><code class="descname">epoll</code><span class="sig-paren">(</span><span class="optional">[</span><em>sizehint=-1</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#select.epoll" title="Permalink to this definition">¶</a></dt> <dd><p>(Only supported on Linux 2.5.44 and newer.) Returns an edge polling object, which can be used as Edge or Level Triggered interface for I/O events; see section <a class="reference internal" href="#epoll-objects"><span class="std std-ref">Edge and Level Trigger Polling (epoll) Objects</span></a> below for the methods supported by epolling objects.</p> <div class="versionadded"> <p><span class="versionmodified">New in version 2.6.</span></p> </div> </dd></dl> <dl class="function"> <dt id="select.poll"> <code class="descclassname">select.</code><code class="descname">poll</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#select.poll" title="Permalink to this definition">¶</a></dt> <dd><p>(Not supported by all operating systems.) Returns a polling object, which supports registering and unregistering file descriptors, and then polling them for I/O events; see section <a class="reference internal" href="#poll-objects"><span class="std std-ref">Polling Objects</span></a> below for the methods supported by polling objects.</p> </dd></dl> <dl class="function"> <dt id="select.kqueue"> <code class="descclassname">select.</code><code class="descname">kqueue</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#select.kqueue" title="Permalink to this definition">¶</a></dt> <dd><p>(Only supported on BSD.) Returns a kernel queue object; see section <a class="reference internal" href="#kqueue-objects"><span class="std std-ref">Kqueue Objects</span></a> below for the methods supported by kqueue objects.</p> <div class="versionadded"> <p><span class="versionmodified">New in version 2.6.</span></p> </div> </dd></dl> <dl class="function"> <dt id="select.kevent"> <code class="descclassname">select.</code><code class="descname">kevent</code><span class="sig-paren">(</span><em>ident</em>, <em>filter=KQ_FILTER_READ</em>, <em>flags=KQ_EV_ADD</em>, <em>fflags=0</em>, <em>data=0</em>, <em>udata=0</em><span class="sig-paren">)</span><a class="headerlink" href="#select.kevent" title="Permalink to this definition">¶</a></dt> <dd><p>(Only supported on BSD.) Returns a kernel event object; see section <a class="reference internal" href="#kevent-objects"><span class="std std-ref">Kevent Objects</span></a> below for the methods supported by kevent objects.</p> <div class="versionadded"> <p><span class="versionmodified">New in version 2.6.</span></p> </div> </dd></dl> <dl class="function"> <dt id="select.select"> <code class="descclassname">select.</code><code class="descname">select</code><span class="sig-paren">(</span><em>rlist</em>, <em>wlist</em>, <em>xlist</em><span class="optional">[</span>, <em>timeout</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#select.select" title="Permalink to this definition">¶</a></dt> <dd><p>This is a straightforward interface to the Unix <code class="xref c c-func docutils literal notranslate"><span class="pre">select()</span></code> system call. The first three arguments are sequences of ‘waitable objects’: either integers representing file descriptors or objects with a parameterless method named <a class="reference internal" href="io.html#io.IOBase.fileno" title="io.IOBase.fileno"><code class="xref py py-meth docutils literal notranslate"><span class="pre">fileno()</span></code></a> returning such an integer:</p> <ul class="simple"> <li><em>rlist</em>: wait until ready for reading</li> <li><em>wlist</em>: wait until ready for writing</li> <li><em>xlist</em>: wait for an “exceptional condition” (see the manual page for what your system considers such a condition)</li> </ul> <p>Empty sequences are allowed, but acceptance of three empty sequences is platform-dependent. (It is known to work on Unix but not on Windows.) The optional <em>timeout</em> argument specifies a time-out as a floating point number in seconds. When the <em>timeout</em> argument is omitted the function blocks until at least one file descriptor is ready. A time-out value of zero specifies a poll and never blocks.</p> <p>The return value is a triple of lists of objects that are ready: subsets of the first three arguments. When the time-out is reached without a file descriptor becoming ready, three empty lists are returned.</p> <p id="index-0">Among the acceptable object types in the sequences are Python file objects (e.g. <code class="docutils literal notranslate"><span class="pre">sys.stdin</span></code>, or objects returned by <a class="reference internal" href="functions.html#open" title="open"><code class="xref py py-func docutils literal notranslate"><span class="pre">open()</span></code></a> or <a class="reference internal" href="os.html#os.popen" title="os.popen"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.popen()</span></code></a>), socket objects returned by <a class="reference internal" href="socket.html#socket.socket" title="socket.socket"><code class="xref py py-func docutils literal notranslate"><span class="pre">socket.socket()</span></code></a>. You may also define a <em class="dfn">wrapper</em> class yourself, as long as it has an appropriate <a class="reference internal" href="io.html#io.IOBase.fileno" title="io.IOBase.fileno"><code class="xref py py-meth docutils literal notranslate"><span class="pre">fileno()</span></code></a> method (that really returns a file descriptor, not just a random integer).</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last" id="index-1">File objects on Windows are not acceptable, but sockets are. On Windows, the underlying <code class="xref c c-func docutils literal notranslate"><span class="pre">select()</span></code> function is provided by the WinSock library, and does not handle file descriptors that don’t originate from WinSock.</p> </div> </dd></dl> <dl class="attribute"> <dt id="select.select.PIPE_BUF"> <code class="descclassname">select.</code><code class="descname">PIPE_BUF</code><a class="headerlink" href="#select.select.PIPE_BUF" title="Permalink to this definition">¶</a></dt> <dd><p>Files reported as ready for writing by <a class="reference internal" href="#module-select" title="select: Wait for I/O completion on multiple streams."><code class="xref py py-func docutils literal notranslate"><span class="pre">select()</span></code></a>, <a class="reference internal" href="#select.poll" title="select.poll"><code class="xref py py-func docutils literal notranslate"><span class="pre">poll()</span></code></a> or similar interfaces in this module are guaranteed to not block on a write of up to <a class="reference internal" href="#select.select.PIPE_BUF" title="select.select.PIPE_BUF"><code class="xref py py-const docutils literal notranslate"><span class="pre">PIPE_BUF</span></code></a> bytes. This value is guaranteed by POSIX to be at least 512. Availability: Unix.</p> <div class="versionadded"> <p><span class="versionmodified">New in version 2.7.</span></p> </div> </dd></dl> <div class="section" id="edge-and-level-trigger-polling-epoll-objects"> <span id="epoll-objects"></span><h2>16.1.1. Edge and Level Trigger Polling (epoll) Objects<a class="headerlink" href="#edge-and-level-trigger-polling-epoll-objects" title="Permalink to this headline">¶</a></h2> <blockquote> <div><p><a class="reference external" href="http://linux.die.net/man/4/epoll">http://linux.die.net/man/4/epoll</a></p> <p><em>eventmask</em></p> <table border="1" class="docutils"> <colgroup> <col width="33%" /> <col width="67%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Constant</th> <th class="head">Meaning</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLIN</span></code></td> <td>Available for read</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLOUT</span></code></td> <td>Available for write</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLPRI</span></code></td> <td>Urgent data for read</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLERR</span></code></td> <td>Error condition happened on the assoc. fd</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLHUP</span></code></td> <td>Hang up happened on the assoc. fd</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLET</span></code></td> <td>Set Edge Trigger behavior, the default is Level Trigger behavior</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLONESHOT</span></code></td> <td>Set one-shot behavior. After one event is pulled out, the fd is internally disabled</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLRDNORM</span></code></td> <td>Equivalent to <code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLIN</span></code></td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLRDBAND</span></code></td> <td>Priority data band can be read.</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLWRNORM</span></code></td> <td>Equivalent to <code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLOUT</span></code></td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLWRBAND</span></code></td> <td>Priority data may be written.</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">EPOLLMSG</span></code></td> <td>Ignored.</td> </tr> </tbody> </table> </div></blockquote> <dl class="method"> <dt id="select.epoll.close"> <code class="descclassname">epoll.</code><code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#select.epoll.close" title="Permalink to this definition">¶</a></dt> <dd><p>Close the control file descriptor of the epoll object.</p> </dd></dl> <dl class="method"> <dt id="select.epoll.fileno"> <code class="descclassname">epoll.</code><code class="descname">fileno</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#select.epoll.fileno" title="Permalink to this definition">¶</a></dt> <dd><p>Return the file descriptor number of the control fd.</p> </dd></dl> <dl class="method"> <dt id="select.epoll.fromfd"> <code class="descclassname">epoll.</code><code class="descname">fromfd</code><span class="sig-paren">(</span><em>fd</em><span class="sig-paren">)</span><a class="headerlink" href="#select.epoll.fromfd" title="Permalink to this definition">¶</a></dt> <dd><p>Create an epoll object from a given file descriptor.</p> </dd></dl> <dl class="method"> <dt id="select.epoll.register"> <code class="descclassname">epoll.</code><code class="descname">register</code><span class="sig-paren">(</span><em>fd</em><span class="optional">[</span>, <em>eventmask</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#select.epoll.register" title="Permalink to this definition">¶</a></dt> <dd><p>Register a fd descriptor with the epoll object.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">Registering a file descriptor that’s already registered raises an IOError – contrary to <a class="reference internal" href="#poll-objects"><span class="std std-ref">Polling Objects</span></a>’s register.</p> </div> </dd></dl> <dl class="method"> <dt id="select.epoll.modify"> <code class="descclassname">epoll.</code><code class="descname">modify</code><span class="sig-paren">(</span><em>fd</em>, <em>eventmask</em><span class="sig-paren">)</span><a class="headerlink" href="#select.epoll.modify" title="Permalink to this definition">¶</a></dt> <dd><p>Modify a register file descriptor.</p> </dd></dl> <dl class="method"> <dt id="select.epoll.unregister"> <code class="descclassname">epoll.</code><code class="descname">unregister</code><span class="sig-paren">(</span><em>fd</em><span class="sig-paren">)</span><a class="headerlink" href="#select.epoll.unregister" title="Permalink to this definition">¶</a></dt> <dd><p>Remove a registered file descriptor from the epoll object.</p> </dd></dl> <dl class="method"> <dt id="select.epoll.poll"> <code class="descclassname">epoll.</code><code class="descname">poll</code><span class="sig-paren">(</span><span class="optional">[</span><em>timeout=-1</em><span class="optional">[</span>, <em>maxevents=-1</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#select.epoll.poll" title="Permalink to this definition">¶</a></dt> <dd><p>Wait for events. timeout in seconds (float)</p> </dd></dl> </div> <div class="section" id="polling-objects"> <span id="poll-objects"></span><h2>16.1.2. Polling Objects<a class="headerlink" href="#polling-objects" title="Permalink to this headline">¶</a></h2> <p>The <code class="xref c c-func docutils literal notranslate"><span class="pre">poll()</span></code> system call, supported on most Unix systems, provides better scalability for network servers that service many, many clients at the same time. <code class="xref c c-func docutils literal notranslate"><span class="pre">poll()</span></code> scales better because the system call only requires listing the file descriptors of interest, while <code class="xref c c-func docutils literal notranslate"><span class="pre">select()</span></code> builds a bitmap, turns on bits for the fds of interest, and then afterward the whole bitmap has to be linearly scanned again. <code class="xref c c-func docutils literal notranslate"><span class="pre">select()</span></code> is O(highest file descriptor), while <code class="xref c c-func docutils literal notranslate"><span class="pre">poll()</span></code> is O(number of file descriptors).</p> <dl class="method"> <dt id="select.poll.register"> <code class="descclassname">poll.</code><code class="descname">register</code><span class="sig-paren">(</span><em>fd</em><span class="optional">[</span>, <em>eventmask</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#select.poll.register" title="Permalink to this definition">¶</a></dt> <dd><p>Register a file descriptor with the polling object. Future calls to the <a class="reference internal" href="#select.poll" title="select.poll"><code class="xref py py-meth docutils literal notranslate"><span class="pre">poll()</span></code></a> method will then check whether the file descriptor has any pending I/O events. <em>fd</em> can be either an integer, or an object with a <a class="reference internal" href="io.html#io.IOBase.fileno" title="io.IOBase.fileno"><code class="xref py py-meth docutils literal notranslate"><span class="pre">fileno()</span></code></a> method that returns an integer. File objects implement <code class="xref py py-meth docutils literal notranslate"><span class="pre">fileno()</span></code>, so they can also be used as the argument.</p> <p><em>eventmask</em> is an optional bitmask describing the type of events you want to check for, and can be a combination of the constants <code class="xref py py-const docutils literal notranslate"><span class="pre">POLLIN</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">POLLPRI</span></code>, and <code class="xref py py-const docutils literal notranslate"><span class="pre">POLLOUT</span></code>, described in the table below. If not specified, the default value used will check for all 3 types of events.</p> <table border="1" class="docutils"> <colgroup> <col width="31%" /> <col width="69%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Constant</th> <th class="head">Meaning</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">POLLIN</span></code></td> <td>There is data to read</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">POLLPRI</span></code></td> <td>There is urgent data to read</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">POLLOUT</span></code></td> <td>Ready for output: writing will not block</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">POLLERR</span></code></td> <td>Error condition of some sort</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">POLLHUP</span></code></td> <td>Hung up</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">POLLNVAL</span></code></td> <td>Invalid request: descriptor not open</td> </tr> </tbody> </table> <p>Registering a file descriptor that’s already registered is not an error, and has the same effect as registering the descriptor exactly once.</p> </dd></dl> <dl class="method"> <dt id="select.poll.modify"> <code class="descclassname">poll.</code><code class="descname">modify</code><span class="sig-paren">(</span><em>fd</em>, <em>eventmask</em><span class="sig-paren">)</span><a class="headerlink" href="#select.poll.modify" title="Permalink to this definition">¶</a></dt> <dd><p>Modifies an already registered fd. This has the same effect as <code class="docutils literal notranslate"><span class="pre">register(fd,</span> <span class="pre">eventmask)</span></code>. Attempting to modify a file descriptor that was never registered causes an <a class="reference internal" href="exceptions.html#exceptions.IOError" title="exceptions.IOError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">IOError</span></code></a> exception with errno <code class="xref py py-const docutils literal notranslate"><span class="pre">ENOENT</span></code> to be raised.</p> <div class="versionadded"> <p><span class="versionmodified">New in version 2.6.</span></p> </div> </dd></dl> <dl class="method"> <dt id="select.poll.unregister"> <code class="descclassname">poll.</code><code class="descname">unregister</code><span class="sig-paren">(</span><em>fd</em><span class="sig-paren">)</span><a class="headerlink" href="#select.poll.unregister" title="Permalink to this definition">¶</a></dt> <dd><p>Remove a file descriptor being tracked by a polling object. Just like the <a class="reference internal" href="#select.poll.register" title="select.poll.register"><code class="xref py py-meth docutils literal notranslate"><span class="pre">register()</span></code></a> method, <em>fd</em> can be an integer or an object with a <a class="reference internal" href="io.html#io.IOBase.fileno" title="io.IOBase.fileno"><code class="xref py py-meth docutils literal notranslate"><span class="pre">fileno()</span></code></a> method that returns an integer.</p> <p>Attempting to remove a file descriptor that was never registered causes a <a class="reference internal" href="exceptions.html#exceptions.KeyError" title="exceptions.KeyError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">KeyError</span></code></a> exception to be raised.</p> </dd></dl> <dl class="method"> <dt id="select.poll.poll"> <code class="descclassname">poll.</code><code class="descname">poll</code><span class="sig-paren">(</span><span class="optional">[</span><em>timeout</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#select.poll.poll" title="Permalink to this definition">¶</a></dt> <dd><p>Polls the set of registered file descriptors, and returns a possibly-empty list containing <code class="docutils literal notranslate"><span class="pre">(fd,</span> <span class="pre">event)</span></code> 2-tuples for the descriptors that have events or errors to report. <em>fd</em> is the file descriptor, and <em>event</em> is a bitmask with bits set for the reported events for that descriptor — <code class="xref py py-const docutils literal notranslate"><span class="pre">POLLIN</span></code> for waiting input, <code class="xref py py-const docutils literal notranslate"><span class="pre">POLLOUT</span></code> to indicate that the descriptor can be written to, and so forth. An empty list indicates that the call timed out and no file descriptors had any events to report. If <em>timeout</em> is given, it specifies the length of time in milliseconds which the system will wait for events before returning. If <em>timeout</em> is omitted, negative, or <a class="reference internal" href="constants.html#None" title="None"><code class="xref py py-const docutils literal notranslate"><span class="pre">None</span></code></a>, the call will block until there is an event for this poll object.</p> </dd></dl> </div> <div class="section" id="kqueue-objects"> <span id="id1"></span><h2>16.1.3. Kqueue Objects<a class="headerlink" href="#kqueue-objects" title="Permalink to this headline">¶</a></h2> <dl class="method"> <dt id="select.kqueue.close"> <code class="descclassname">kqueue.</code><code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#select.kqueue.close" title="Permalink to this definition">¶</a></dt> <dd><p>Close the control file descriptor of the kqueue object.</p> </dd></dl> <dl class="method"> <dt id="select.kqueue.fileno"> <code class="descclassname">kqueue.</code><code class="descname">fileno</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#select.kqueue.fileno" title="Permalink to this definition">¶</a></dt> <dd><p>Return the file descriptor number of the control fd.</p> </dd></dl> <dl class="method"> <dt id="select.kqueue.fromfd"> <code class="descclassname">kqueue.</code><code class="descname">fromfd</code><span class="sig-paren">(</span><em>fd</em><span class="sig-paren">)</span><a class="headerlink" href="#select.kqueue.fromfd" title="Permalink to this definition">¶</a></dt> <dd><p>Create a kqueue object from a given file descriptor.</p> </dd></dl> <dl class="method"> <dt id="select.kqueue.control"> <code class="descclassname">kqueue.</code><code class="descname">control</code><span class="sig-paren">(</span><em>changelist</em>, <em>max_events</em><span class="optional">[</span>, <em>timeout=None</em><span class="optional">]</span><span class="sig-paren">)</span> → eventlist<a class="headerlink" href="#select.kqueue.control" title="Permalink to this definition">¶</a></dt> <dd><p>Low level interface to kevent</p> <ul class="simple"> <li>changelist must be an iterable of kevent object or <code class="docutils literal notranslate"><span class="pre">None</span></code></li> <li>max_events must be 0 or a positive integer</li> <li>timeout in seconds (floats possible)</li> </ul> </dd></dl> </div> <div class="section" id="kevent-objects"> <span id="id2"></span><h2>16.1.4. Kevent Objects<a class="headerlink" href="#kevent-objects" title="Permalink to this headline">¶</a></h2> <p><a class="reference external" href="https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2">https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2</a></p> <dl class="attribute"> <dt id="select.kevent.ident"> <code class="descclassname">kevent.</code><code class="descname">ident</code><a class="headerlink" href="#select.kevent.ident" title="Permalink to this definition">¶</a></dt> <dd><p>Value used to identify the event. The interpretation depends on the filter but it’s usually the file descriptor. In the constructor ident can either be an int or an object with a fileno() function. kevent stores the integer internally.</p> </dd></dl> <dl class="attribute"> <dt id="select.kevent.filter"> <code class="descclassname">kevent.</code><code class="descname">filter</code><a class="headerlink" href="#select.kevent.filter" title="Permalink to this definition">¶</a></dt> <dd><p>Name of the kernel filter.</p> <table border="1" class="docutils"> <colgroup> <col width="38%" /> <col width="63%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Constant</th> <th class="head">Meaning</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_READ</span></code></td> <td>Takes a descriptor and returns whenever there is data available to read</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_WRITE</span></code></td> <td>Takes a descriptor and returns whenever there is data available to write</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_AIO</span></code></td> <td>AIO requests</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_VNODE</span></code></td> <td>Returns when one or more of the requested events watched in <em>fflag</em> occurs</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_PROC</span></code></td> <td>Watch for events on a process id</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_NETDEV</span></code></td> <td>Watch for events on a network device [not available on Mac OS X]</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_SIGNAL</span></code></td> <td>Returns whenever the watched signal is delivered to the process</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_TIMER</span></code></td> <td>Establishes an arbitrary timer</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="select.kevent.flags"> <code class="descclassname">kevent.</code><code class="descname">flags</code><a class="headerlink" href="#select.kevent.flags" title="Permalink to this definition">¶</a></dt> <dd><p>Filter action.</p> <table border="1" class="docutils"> <colgroup> <col width="38%" /> <col width="63%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Constant</th> <th class="head">Meaning</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_EV_ADD</span></code></td> <td>Adds or modifies an event</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_EV_DELETE</span></code></td> <td>Removes an event from the queue</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_EV_ENABLE</span></code></td> <td>Permitscontrol() to returns the event</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_EV_DISABLE</span></code></td> <td>Disablesevent</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_EV_ONESHOT</span></code></td> <td>Removes event after first occurrence</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_EV_CLEAR</span></code></td> <td>Reset the state after an event is retrieved</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_EV_SYSFLAGS</span></code></td> <td>internal event</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_EV_FLAG1</span></code></td> <td>internal event</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_EV_EOF</span></code></td> <td>Filter specific EOF condition</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_EV_ERROR</span></code></td> <td>See return values</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="select.kevent.fflags"> <code class="descclassname">kevent.</code><code class="descname">fflags</code><a class="headerlink" href="#select.kevent.fflags" title="Permalink to this definition">¶</a></dt> <dd><p>Filter specific flags.</p> <p><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_READ</span></code> and <code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_WRITE</span></code> filter flags:</p> <table border="1" class="docutils"> <colgroup> <col width="39%" /> <col width="61%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Constant</th> <th class="head">Meaning</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_LOWAT</span></code></td> <td>low water mark of a socket buffer</td> </tr> </tbody> </table> <p><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_VNODE</span></code> filter flags:</p> <table border="1" class="docutils"> <colgroup> <col width="39%" /> <col width="61%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Constant</th> <th class="head">Meaning</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_DELETE</span></code></td> <td><em>unlink()</em> was called</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_WRITE</span></code></td> <td>a write occurred</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_EXTEND</span></code></td> <td>the file was extended</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_ATTRIB</span></code></td> <td>an attribute was changed</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_LINK</span></code></td> <td>the link count has changed</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_RENAME</span></code></td> <td>the file was renamed</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_REVOKE</span></code></td> <td>access to the file was revoked</td> </tr> </tbody> </table> <p><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_PROC</span></code> filter flags:</p> <table border="1" class="docutils"> <colgroup> <col width="39%" /> <col width="61%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Constant</th> <th class="head">Meaning</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_EXIT</span></code></td> <td>the process has exited</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_FORK</span></code></td> <td>the process has called <em>fork()</em></td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_EXEC</span></code></td> <td>the process has executed a new process</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_PCTRLMASK</span></code></td> <td>internal filter flag</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_PDATAMASK</span></code></td> <td>internal filter flag</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_TRACK</span></code></td> <td>follow a process across <em>fork()</em></td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_CHILD</span></code></td> <td>returned on the child process for <em>NOTE_TRACK</em></td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_TRACKERR</span></code></td> <td>unable to attach to a child</td> </tr> </tbody> </table> <p><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_FILTER_NETDEV</span></code> filter flags (not available on Mac OS X):</p> <table border="1" class="docutils"> <colgroup> <col width="39%" /> <col width="61%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Constant</th> <th class="head">Meaning</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_LINKUP</span></code></td> <td>link is up</td> </tr> <tr class="row-odd"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_LINKDOWN</span></code></td> <td>link is down</td> </tr> <tr class="row-even"><td><code class="xref py py-const docutils literal notranslate"><span class="pre">KQ_NOTE_LINKINV</span></code></td> <td>link state is invalid</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="select.kevent.data"> <code class="descclassname">kevent.</code><code class="descname">data</code><a class="headerlink" href="#select.kevent.data" title="Permalink to this definition">¶</a></dt> <dd><p>Filter specific data.</p> </dd></dl> <dl class="attribute"> <dt id="select.kevent.udata"> <code class="descclassname">kevent.</code><code class="descname">udata</code><a class="headerlink" href="#select.kevent.udata" title="Permalink to this definition">¶</a></dt> <dd><p>User defined value.</p> </dd></dl> </div> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h3><a href="../contents.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">16.1. <code class="docutils literal notranslate"><span class="pre">select</span></code> — Waiting for I/O completion</a><ul> <li><a class="reference internal" href="#edge-and-level-trigger-polling-epoll-objects">16.1.1. Edge and Level Trigger Polling (epoll) Objects</a></li> <li><a class="reference internal" href="#polling-objects">16.1.2. Polling Objects</a></li> <li><a class="reference internal" href="#kqueue-objects">16.1.3. Kqueue Objects</a></li> <li><a class="reference internal" href="#kevent-objects">16.1.4. Kevent Objects</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="someos.html" title="previous chapter">16. Optional Operating System Services</a></p> <h4>Next topic</h4> <p class="topless"><a href="threading.html" title="next chapter">16.2. <code class="docutils literal notranslate"><span class="pre">threading</span></code> — Higher-level threading interface</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/library/select.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="threading.html" title="16.2. threading — Higher-level threading interface" >next</a> |</li> <li class="right" > <a href="someos.html" title="16. Optional Operating System Services" >previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="https://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.16 documentation</a> » </li> <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li> <li class="nav-item nav-item-2"><a href="someos.html" >16. Optional Operating System Services</a> »</li> </ul> </div> <div class="footer"> © <a href="../copyright.html">Copyright</a> 1990-2019, Python Software Foundation. <br /> The Python Software Foundation is a non-profit corporation. <a href="https://www.python.org/psf/donations/">Please donate.</a> <br /> Last updated on Mar 27, 2019. <a href="../bugs.html">Found a bug</a>? <br /> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.7.6. </div> </body> </html>
Save
cmd:
run