Debian Codegraph @

Doc/library/select.rst

raw
1 :mod:`!select` --- Waiting for I/O completion
2 =============================================
3
4 .. module:: select
5 :synopsis: Wait for I/O completion on multiple streams.
6
7 --------------
8
9 This module provides access to the :c:func:`!select` and :c:func:`!poll` functions
10 available in most operating systems, :c:func:`!devpoll` available on
11 Solaris and derivatives, :c:func:`!epoll` available on Linux 2.5+ and
12 :c:func:`!kqueue` available on most BSD.
13 Note that on Windows, it only works for sockets; on other operating systems,
14 it also works for other file types (in particular, on Unix, it works on pipes).
15 It cannot be used on regular files to determine whether a file has grown since
16 it was last read.
17
18 .. note::
19
20 The :mod:`selectors` module allows high-level and efficient I/O
21 multiplexing, built upon the :mod:`select` module primitives. Users are
22 encouraged to use the :mod:`selectors` module instead, unless they want
23 precise control over the OS-level primitives used.
24
25 .. include:: ../includes/wasm-notavail.rst
26
27 The module defines the following:
28
29
30 .. exception:: error
31
32 A deprecated alias of :exc:`OSError`.
33
34 .. versionchanged:: 3.3
35 Following :pep:`3151`, this class was made an alias of :exc:`OSError`.
36
37
38 .. function:: devpoll()
39
40 Returns a ``/dev/poll``
41 polling object; see section :ref:`devpoll-objects` below for the
42 methods supported by devpoll objects.
43
44 :c:func:`!devpoll` objects are linked to the number of file
45 descriptors allowed at the time of instantiation. If your program
46 reduces this value, :c:func:`!devpoll` will fail. If your program
47 increases this value, :c:func:`!devpoll` may return an
48 incomplete list of active file descriptors.
49
50 The new file descriptor is :ref:`non-inheritable <fd_inheritance>`.
51
52 .. versionadded:: 3.3
53
54 .. versionchanged:: 3.4
55 The new file descriptor is now non-inheritable.
56
57 .. availability:: Solaris.
58
59 .. function:: epoll(sizehint=-1, flags=0)
60
61 Return an edge polling object,
62 which can be used as Edge or Level Triggered interface for I/O
63 events.
64
65 *sizehint* informs epoll about the expected number of events to be
66 registered. It must be positive, or ``-1`` to use the default. It is only
67 used on older systems where :c:func:`!epoll_create1` is not available;
68 otherwise it has no effect (though its value is still checked).
69
70 *flags* is deprecated and completely ignored. However, when supplied, its
71 value must be ``0`` or ``select.EPOLL_CLOEXEC``, otherwise ``OSError`` is
72 raised.
73
74 See the :ref:`epoll-objects` section below for the methods supported by
75 epolling objects.
76
77 ``epoll`` objects support the context management protocol: when used in a
78 :keyword:`with` statement, the new file descriptor is automatically closed
79 at the end of the block.
80
81 The new file descriptor is :ref:`non-inheritable <fd_inheritance>`.
82
83 .. versionchanged:: 3.3
84 Added the *flags* parameter.
85
86 .. versionchanged:: 3.4
87 Support for the :keyword:`with` statement was added.
88 The new file descriptor is now non-inheritable.
89
90 .. deprecated:: 3.4
91 The *flags* parameter. ``select.EPOLL_CLOEXEC`` is used by default now.
92 Use :func:`os.set_inheritable` to make the file descriptor inheritable.
93
94 .. availability:: Linux >= 2.5.44.
95
96
97 .. function:: poll()
98
99 Returns a polling object, which
100 supports registering and unregistering file descriptors, and then polling them
101 for I/O events; see section :ref:`poll-objects` below for the methods supported
102 by polling objects.
103
104 .. availability:: Unix.
105
106
107 .. function:: kqueue()
108
109 Returns a kernel queue object; see section
110 :ref:`kqueue-objects` below for the methods supported by kqueue objects.
111
112 The new file descriptor is :ref:`non-inheritable <fd_inheritance>`.
113
114 .. versionchanged:: 3.4
115 The new file descriptor is now non-inheritable.
116
117 .. availability:: BSD, macOS.
118
119
120 .. function:: kevent(ident, filter=KQ_FILTER_READ, flags=KQ_EV_ADD, fflags=0, data=0, udata=0)
121
122 Returns a kernel event object; see section
123 :ref:`kevent-objects` below for the methods supported by kevent objects.
124
125 .. availability:: BSD, macOS.
126
127
128 .. function:: select(rlist, wlist, xlist, timeout=None)
129
130 This is a straightforward interface to the Unix :c:func:`!select` system call.
131 The first three arguments are iterables of 'waitable objects': either
132 integers representing file descriptors or objects with a parameterless method
133 named :meth:`~io.IOBase.fileno` returning such an integer:
134
135 * *rlist*: wait until ready for reading
136 * *wlist*: wait until ready for writing
137 * *xlist*: wait for an "exceptional condition" (see the manual page for what
138 your system considers such a condition)
139
140 Empty iterables are allowed, but acceptance of three empty iterables is
141 platform-dependent. (It is known to work on Unix but not on Windows.) The
142 optional *timeout* argument specifies a time-out as a floating-point number
143 in seconds.
144 When the *timeout* argument is omitted or ``None``, the function blocks until
145 at least one file descriptor is ready. A time-out value of zero specifies a
146 poll and never blocks.
147
148 The return value is a triple of lists of objects that are ready: subsets of the
149 first three arguments. When the time-out is reached without a file descriptor
150 becoming ready, three empty lists are returned.
151
152 .. index::
153 single: socket() (in module socket)
154 single: popen() (in module os)
155
156 Among the acceptable object types in the iterables are Python :term:`file
157 objects <file object>` (e.g. ``sys.stdin``, or objects returned by
158 :func:`open` or :func:`os.popen`), socket objects returned by
159 :func:`socket.socket`. You may also define a :dfn:`wrapper` class yourself,
160 as long as it has an appropriate :meth:`~io.IOBase.fileno` method (that
161 really returns a file descriptor, not just a random integer).
162
163 .. note::
164
165 .. index:: single: WinSock
166
167 File objects on Windows are not acceptable, but sockets are. On Windows,
168 the underlying :c:func:`!select` function is provided by the WinSock
169 library, and does not handle file descriptors that don't originate from
170 WinSock.
171
172 .. versionchanged:: 3.5
173 The function is now retried with a recomputed timeout when interrupted by
174 a signal, except if the signal handler raises an exception (see
175 :pep:`475` for the rationale), instead of raising
176 :exc:`InterruptedError`.
177
178
179 .. data:: PIPE_BUF
180
181 The minimum number of bytes which can be written without blocking to a pipe
182 when the pipe has been reported as ready for writing by :func:`~select.select`,
183 :func:`!poll` or another interface in this module. This doesn't apply
184 to other kinds of file-like objects such as sockets.
185
186 This value is guaranteed by POSIX to be at least 512.
187
188 .. availability:: Unix
189
190 .. versionadded:: 3.2
191
192
193 .. _devpoll-objects:
194
195 ``/dev/poll`` polling objects
196 -----------------------------
197
198 Solaris and derivatives have ``/dev/poll``. While :c:func:`!select` is
199 *O*\ (*highest file descriptor*) and :c:func:`!poll` is *O*\ (*number of file
200 descriptors*), ``/dev/poll`` is *O*\ (*active file descriptors*).
201
202 ``/dev/poll`` behaviour is very close to the standard :c:func:`!poll`
203 object.
204
205
206 .. method:: devpoll.close()
207
208 Close the file descriptor of the polling object.
209
210 .. versionadded:: 3.4
211
212
213 .. attribute:: devpoll.closed
214
215 ``True`` if the polling object is closed.
216
217 .. versionadded:: 3.4
218
219
220 .. method:: devpoll.fileno()
221
222 Return the file descriptor number of the polling object.
223
224 .. versionadded:: 3.4
225
226
227 .. method:: devpoll.register(fd[, eventmask])
228
229 Register a file descriptor with the polling object. Future calls to the
230 :meth:`poll` method will then check whether the file descriptor has any
231 pending I/O events. *fd* can be either an integer, or an object with a
232 :meth:`~io.IOBase.fileno` method that returns an integer. File objects
233 implement :meth:`!fileno`, so they can also be used as the argument.
234
235 *eventmask* is an optional bitmask describing the type of events you want to
236 check for. The constants are the same as with :c:func:`!poll`
237 object. The default value is a combination of the constants :const:`POLLIN`,
238 :const:`POLLPRI`, and :const:`POLLOUT`.
239
240 .. warning::
241
242 Registering a file descriptor that's already registered is not an
243 error, but the result is undefined. The appropriate action is to
244 unregister or modify it first. This is an important difference
245 compared with :c:func:`!poll`.
246
247
248 .. method:: devpoll.modify(fd[, eventmask])
249
250 This method does an :meth:`unregister` followed by a
251 :meth:`register`. It is (a bit) more efficient than doing the same
252 explicitly.
253
254
255 .. method:: devpoll.unregister(fd)
256
257 Remove a file descriptor being tracked by a polling object. Just like the
258 :meth:`register` method, *fd* can be an integer or an object with a
259 :meth:`~io.IOBase.fileno` method that returns an integer.
260
261 Attempting to remove a file descriptor that was never registered is
262 safely ignored.
263
264
265 .. method:: devpoll.poll([timeout])
266
267 Polls the set of registered file descriptors, and returns a possibly empty list
268 containing ``(fd, event)`` 2-tuples for the descriptors that have events or
269 errors to report. *fd* is the file descriptor, and *event* is a bitmask with
270 bits set for the reported events for that descriptor --- :const:`POLLIN` for
271 waiting input, :const:`POLLOUT` to indicate that the descriptor can be written
272 to, and so forth. An empty list indicates that the call timed out and no file
273 descriptors had any events to report. If *timeout* is given, it specifies the
274 length of time in milliseconds which the system will wait for events before
275 returning. If *timeout* is omitted, -1, or :const:`None`, the call will
276 block until there is an event for this poll object.
277
278 .. versionchanged:: 3.5
279 The function is now retried with a recomputed timeout when interrupted by
280 a signal, except if the signal handler raises an exception (see
281 :pep:`475` for the rationale), instead of raising
282 :exc:`InterruptedError`.
283
284
285 .. _epoll-objects:
286
287 Edge and level trigger polling (epoll) objects
288 ----------------------------------------------
289
290 https://linux.die.net/man/4/epoll
291
292 The *eventmask* is a bit mask using the following constants:
293
294 +-------------------------+------------------------------------------------+
295 | Constant | Meaning |
296 +=========================+================================================+
297 | :const:`EPOLLIN` | Available for read. |
298 +-------------------------+------------------------------------------------+
299 | :const:`EPOLLOUT` | Available for write. |
300 +-------------------------+------------------------------------------------+
301 | :const:`EPOLLPRI` | Urgent data for read. |
302 +-------------------------+------------------------------------------------+
303 | :const:`EPOLLERR` | Error condition happened on the associated fd. |
304 +-------------------------+------------------------------------------------+
305 | :const:`EPOLLHUP` | Hang up happened on the associated fd. |
306 +-------------------------+------------------------------------------------+
307 | :const:`EPOLLET` | Set Edge Trigger behavior, the default is |
308 | | Level Trigger behavior. |
309 +-------------------------+------------------------------------------------+
310 | :const:`EPOLLONESHOT` | Set one-shot behavior. After one event is |
311 | | pulled out, the fd is internally disabled. |
312 +-------------------------+------------------------------------------------+
313 | :const:`EPOLLEXCLUSIVE` | Wake only one epoll object when the |
314 | | associated fd has an event. The default (if |
315 | | this flag is not set) is to wake all epoll |
316 | | objects polling on an fd. |
317 +-------------------------+------------------------------------------------+
318 | :const:`EPOLLRDHUP` | Stream socket peer closed connection or shut |
319 | | down writing half of connection. |
320 +-------------------------+------------------------------------------------+
321 | :const:`EPOLLRDNORM` | Equivalent to :const:`EPOLLIN` |
322 +-------------------------+------------------------------------------------+
323 | :const:`EPOLLRDBAND` | Priority data band can be read. |
324 +-------------------------+------------------------------------------------+
325 | :const:`EPOLLWRNORM` | Equivalent to :const:`EPOLLOUT`. |
326 +-------------------------+------------------------------------------------+
327 | :const:`EPOLLWRBAND` | Priority data may be written. |
328 +-------------------------+------------------------------------------------+
329 | :const:`EPOLLMSG` | Ignored. |
330 +-------------------------+------------------------------------------------+
331
332 .. versionadded:: 3.6
333 :const:`EPOLLEXCLUSIVE` was added. It's only supported by Linux Kernel 4.5
334 or later.
335
336 .. method:: epoll.close()
337
338 Close the control file descriptor of the epoll object.
339
340
341 .. attribute:: epoll.closed
342
343 ``True`` if the epoll object is closed.
344
345
346 .. method:: epoll.fileno()
347
348 Return the file descriptor number of the control fd.
349
350
351 .. method:: epoll.fromfd(fd)
352
353 Create an epoll object from a given file descriptor.
354
355
356 .. method:: epoll.register(fd[, eventmask])
357
358 Register a file descriptor *fd* with the epoll object.
359
360
361 .. method:: epoll.modify(fd, eventmask)
362
363 Modify a registered file descriptor *fd*.
364
365
366 .. method:: epoll.unregister(fd)
367
368 Remove a registered file descriptor from the epoll object.
369
370 .. versionchanged:: 3.9
371 The method no longer ignores the :data:`~errno.EBADF` error.
372
373
374 .. method:: epoll.poll(timeout=None, maxevents=-1)
375
376 Wait for events. timeout in seconds (float)
377
378 .. versionchanged:: 3.5
379 The function is now retried with a recomputed timeout when interrupted by
380 a signal, except if the signal handler raises an exception (see
381 :pep:`475` for the rationale), instead of raising
382 :exc:`InterruptedError`.
383
384
385 .. _poll-objects:
386
387 Polling objects
388 ---------------
389
390 The :c:func:`!poll` system call, supported on most Unix systems, provides better
391 scalability for network servers that service many, many clients at the same
392 time. :c:func:`!poll` scales better because the system call only requires listing
393 the file descriptors of interest, while :c:func:`!select` builds a bitmap, turns
394 on bits for the fds of interest, and then afterward the whole bitmap has to be
395 linearly scanned again. :c:func:`!select` is *O*\ (*highest file descriptor*), while
396 :c:func:`!poll` is *O*\ (*number of file descriptors*).
397
398
399 .. method:: poll.register(fd[, eventmask])
400
401 Register a file descriptor with the polling object. Future calls to the
402 :meth:`poll` method will then check whether the file descriptor has any
403 pending I/O events. *fd* can be either an integer, or an object with a
404 :meth:`~io.IOBase.fileno` method that returns an integer. File objects
405 implement :meth:`!fileno`, so they can also be used as the argument.
406
407 *eventmask* is an optional bitmask describing the type of events you want to
408 check for, and can be a combination of the constants :const:`POLLIN`,
409 :const:`POLLPRI`, and :const:`POLLOUT`, described in the table below. If not
410 specified, the default value used will check for all 3 types of events.
411
412 +-------------------+-------------------------------------------+
413 | Constant | Meaning |
414 +===================+===========================================+
415 | :const:`POLLIN` | There is data to read. |
416 +-------------------+-------------------------------------------+
417 | :const:`POLLPRI` | There is urgent data to read. |
418 +-------------------+-------------------------------------------+
419 | :const:`POLLOUT` | Ready for output: writing will not block. |
420 +-------------------+-------------------------------------------+
421 | :const:`POLLERR` | Error condition of some sort. |
422 +-------------------+-------------------------------------------+
423 | :const:`POLLHUP` | Hung up. |
424 +-------------------+-------------------------------------------+
425 | :const:`POLLRDHUP`| Stream socket peer closed connection, or |
426 | | shut down writing half of connection. |
427 +-------------------+-------------------------------------------+
428 | :const:`POLLNVAL` | Invalid request: descriptor not open. |
429 +-------------------+-------------------------------------------+
430
431 Registering a file descriptor that's already registered is not an error, and has
432 the same effect as registering the descriptor exactly once.
433
434
435 .. method:: poll.modify(fd, eventmask)
436
437 Modifies an already registered fd. This has the same effect as
438 ``register(fd, eventmask)``. Attempting to modify a file descriptor
439 that was never registered causes an :exc:`OSError` exception with errno
440 :const:`ENOENT` to be raised.
441
442
443 .. method:: poll.unregister(fd)
444
445 Remove a file descriptor being tracked by a polling object. Just like the
446 :meth:`register` method, *fd* can be an integer or an object with a
447 :meth:`~io.IOBase.fileno` method that returns an integer.
448
449 Attempting to remove a file descriptor that was never registered causes a
450 :exc:`KeyError` exception to be raised.
451
452
453 .. method:: poll.poll([timeout])
454
455 Polls the set of registered file descriptors, and returns a possibly empty list
456 containing ``(fd, event)`` 2-tuples for the descriptors that have events or
457 errors to report. *fd* is the file descriptor, and *event* is a bitmask with
458 bits set for the reported events for that descriptor --- :const:`POLLIN` for
459 waiting input, :const:`POLLOUT` to indicate that the descriptor can be written
460 to, and so forth. An empty list indicates that the call timed out and no file
461 descriptors had any events to report. If *timeout* is given, it specifies the
462 length of time in milliseconds which the system will wait for events before
463 returning. If *timeout* is omitted, negative, or :const:`None`, the call will
464 block until there is an event for this poll object.
465
466 .. versionchanged:: 3.5
467 The function is now retried with a recomputed timeout when interrupted by
468 a signal, except if the signal handler raises an exception (see
469 :pep:`475` for the rationale), instead of raising
470 :exc:`InterruptedError`.
471
472
473 .. _kqueue-objects:
474
475 Kqueue objects
476 --------------
477
478 .. method:: kqueue.close()
479
480 Close the control file descriptor of the kqueue object.
481
482
483 .. attribute:: kqueue.closed
484
485 ``True`` if the kqueue object is closed.
486
487
488 .. method:: kqueue.fileno()
489
490 Return the file descriptor number of the control fd.
491
492
493 .. method:: kqueue.fromfd(fd)
494
495 Create a kqueue object from a given file descriptor.
496
497
498 .. method:: kqueue.control(changelist, max_events[, timeout]) -> eventlist
499
500 Low level interface to kevent
501
502 - changelist must be an iterable of kevent objects or ``None``
503 - max_events must be 0 or a positive integer
504 - timeout in seconds (floats possible); the default is ``None``,
505 to wait forever
506
507 .. versionchanged:: 3.5
508 The function is now retried with a recomputed timeout when interrupted by
509 a signal, except if the signal handler raises an exception (see
510 :pep:`475` for the rationale), instead of raising
511 :exc:`InterruptedError`.
512
513
514 .. _kevent-objects:
515
516 Kevent objects
517 --------------
518
519 https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2
520
521 .. attribute:: kevent.ident
522
523 Value used to identify the event. The interpretation depends on the filter
524 but it's usually the file descriptor. In the constructor ident can either
525 be an int or an object with a :meth:`~io.IOBase.fileno` method. kevent
526 stores the integer internally.
527
528 .. attribute:: kevent.filter
529
530 Name of the kernel filter.
531
532 +---------------------------+---------------------------------------------+
533 | Constant | Meaning |
534 +===========================+=============================================+
535 | :const:`KQ_FILTER_READ` | Takes a descriptor and returns whenever |
536 | | there is data available to read. |
537 +---------------------------+---------------------------------------------+
538 | :const:`KQ_FILTER_WRITE` | Takes a descriptor and returns whenever |
539 | | there is data available to write. |
540 +---------------------------+---------------------------------------------+
541 | :const:`KQ_FILTER_AIO` | AIO requests. |
542 +---------------------------+---------------------------------------------+
543 | :const:`KQ_FILTER_VNODE` | Returns when one or more of the requested |
544 | | events watched in *fflag* occurs. |
545 +---------------------------+---------------------------------------------+
546 | :const:`KQ_FILTER_PROC` | Watch for events on a process ID. |
547 +---------------------------+---------------------------------------------+
548 | :const:`KQ_FILTER_NETDEV` | Watch for events on a network device |
549 | | (not available on macOS). |
550 +---------------------------+---------------------------------------------+
551 | :const:`KQ_FILTER_SIGNAL` | Returns whenever the watched signal is |
552 | | delivered to the process. |
553 +---------------------------+---------------------------------------------+
554 | :const:`KQ_FILTER_TIMER` | Establishes an arbitrary timer. |
555 +---------------------------+---------------------------------------------+
556
557 .. attribute:: kevent.flags
558
559 Filter action.
560
561 +---------------------------+----------------------------------------------+
562 | Constant | Meaning |
563 +===========================+==============================================+
564 | :const:`KQ_EV_ADD` | Adds or modifies an event. |
565 +---------------------------+----------------------------------------------+
566 | :const:`KQ_EV_DELETE` | Removes an event from the queue. |
567 +---------------------------+----------------------------------------------+
568 | :const:`KQ_EV_ENABLE` | Permits control() to return the event. |
569 +---------------------------+----------------------------------------------+
570 | :const:`KQ_EV_DISABLE` | Disables event. |
571 +---------------------------+----------------------------------------------+
572 | :const:`KQ_EV_ONESHOT` | Removes event after first occurrence. |
573 +---------------------------+----------------------------------------------+
574 | :const:`KQ_EV_CLEAR` | Reset the state after an event is retrieved. |
575 +---------------------------+----------------------------------------------+
576 | :const:`KQ_EV_SYSFLAGS` | Internal event. |
577 +---------------------------+----------------------------------------------+
578 | :const:`KQ_EV_FLAG1` | Internal event. |
579 +---------------------------+----------------------------------------------+
580 | :const:`KQ_EV_EOF` | Filter-specific EOF condition. |
581 +---------------------------+----------------------------------------------+
582 | :const:`KQ_EV_ERROR` | See return values. |
583 +---------------------------+----------------------------------------------+
584
585
586 .. attribute:: kevent.fflags
587
588 Filter-specific flags.
589
590 :const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags:
591
592 +----------------------------+--------------------------------------------+
593 | Constant | Meaning |
594 +============================+============================================+
595 | :const:`KQ_NOTE_LOWAT` | Low water mark of a socket buffer. |
596 +----------------------------+--------------------------------------------+
597
598 :const:`KQ_FILTER_VNODE` filter flags:
599
600 +----------------------------+--------------------------------------------+
601 | Constant | Meaning |
602 +============================+============================================+
603 | :const:`KQ_NOTE_DELETE` | *unlink()* was called. |
604 +----------------------------+--------------------------------------------+
605 | :const:`KQ_NOTE_WRITE` | A write occurred. |
606 +----------------------------+--------------------------------------------+
607 | :const:`KQ_NOTE_EXTEND` | The file was extended. |
608 +----------------------------+--------------------------------------------+
609 | :const:`KQ_NOTE_ATTRIB` | An attribute was changed. |
610 +----------------------------+--------------------------------------------+
611 | :const:`KQ_NOTE_LINK` | The link count has changed. |
612 +----------------------------+--------------------------------------------+
613 | :const:`KQ_NOTE_RENAME` | The file was renamed. |
614 +----------------------------+--------------------------------------------+
615 | :const:`KQ_NOTE_REVOKE` | Access to the file was revoked. |
616 +----------------------------+--------------------------------------------+
617
618 :const:`KQ_FILTER_PROC` filter flags:
619
620 +----------------------------+--------------------------------------------+
621 | Constant | Meaning |
622 +============================+============================================+
623 | :const:`KQ_NOTE_EXIT` | The process has exited. |
624 +----------------------------+--------------------------------------------+
625 | :const:`KQ_NOTE_FORK` | The process has called *fork()*. |
626 +----------------------------+--------------------------------------------+
627 | :const:`KQ_NOTE_EXEC` | The process has executed a new process. |
628 +----------------------------+--------------------------------------------+
629 | :const:`KQ_NOTE_PCTRLMASK` | Internal filter flag. |
630 +----------------------------+--------------------------------------------+
631 | :const:`KQ_NOTE_PDATAMASK` | Internal filter flag. |
632 +----------------------------+--------------------------------------------+
633 | :const:`KQ_NOTE_TRACK` | Follow a process across *fork()*. |
634 +----------------------------+--------------------------------------------+
635 | :const:`KQ_NOTE_CHILD` | Returned on the child process for |
636 | | *NOTE_TRACK*. |
637 +----------------------------+--------------------------------------------+
638 | :const:`KQ_NOTE_TRACKERR` | Unable to attach to a child. |
639 +----------------------------+--------------------------------------------+
640
641 :const:`KQ_FILTER_NETDEV` filter flags (not available on macOS):
642
643 +----------------------------+--------------------------------------------+
644 | Constant | Meaning |
645 +============================+============================================+
646 | :const:`KQ_NOTE_LINKUP` | Link is up. |
647 +----------------------------+--------------------------------------------+
648 | :const:`KQ_NOTE_LINKDOWN` | Link is down. |
649 +----------------------------+--------------------------------------------+
650 | :const:`KQ_NOTE_LINKINV` | Link state is invalid. |
651 +----------------------------+--------------------------------------------+
652
653
654 .. attribute:: kevent.data
655
656 Filter-specific data.
657
658
659 .. attribute:: kevent.udata
660
661 User-defined value.