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 | :const:`EPOLLWAKEUP` | Prevents sleep during event waiting. |
332 +-------------------------+------------------------------------------------+
333
334 .. versionadded:: 3.6
335 :const:`EPOLLEXCLUSIVE` was added. It's only supported by Linux Kernel 4.5
336 or later.
337
338 .. versionadded:: 3.14
339 :const:`EPOLLWAKEUP` was added. It's only supported by Linux Kernel 3.5
340 or later.
341
342 .. method:: epoll.close()
343
344 Close the control file descriptor of the epoll object.
345
346
347 .. attribute:: epoll.closed
348
349 ``True`` if the epoll object is closed.
350
351
352 .. method:: epoll.fileno()
353
354 Return the file descriptor number of the control fd.
355
356
357 .. method:: epoll.fromfd(fd)
358
359 Create an epoll object from a given file descriptor.
360
361
362 .. method:: epoll.register(fd[, eventmask])
363
364 Register a file descriptor *fd* with the epoll object.
365
366
367 .. method:: epoll.modify(fd, eventmask)
368
369 Modify a registered file descriptor *fd*.
370
371
372 .. method:: epoll.unregister(fd)
373
374 Remove a registered file descriptor from the epoll object.
375
376 .. versionchanged:: 3.9
377 The method no longer ignores the :data:`~errno.EBADF` error.
378
379
380 .. method:: epoll.poll(timeout=None, maxevents=-1)
381
382 Wait for events. timeout in seconds (float)
383
384 .. versionchanged:: 3.5
385 The function is now retried with a recomputed timeout when interrupted by
386 a signal, except if the signal handler raises an exception (see
387 :pep:`475` for the rationale), instead of raising
388 :exc:`InterruptedError`.
389
390
391 .. _poll-objects:
392
393 Polling objects
394 ---------------
395
396 The :c:func:`!poll` system call, supported on most Unix systems, provides better
397 scalability for network servers that service many, many clients at the same
398 time. :c:func:`!poll` scales better because the system call only requires listing
399 the file descriptors of interest, while :c:func:`!select` builds a bitmap, turns
400 on bits for the fds of interest, and then afterward the whole bitmap has to be
401 linearly scanned again. :c:func:`!select` is *O*\ (*highest file descriptor*), while
402 :c:func:`!poll` is *O*\ (*number of file descriptors*).
403
404
405 .. method:: poll.register(fd[, eventmask])
406
407 Register a file descriptor with the polling object. Future calls to the
408 :meth:`poll` method will then check whether the file descriptor has any
409 pending I/O events. *fd* can be either an integer, or an object with a
410 :meth:`~io.IOBase.fileno` method that returns an integer. File objects
411 implement :meth:`!fileno`, so they can also be used as the argument.
412
413 *eventmask* is an optional bitmask describing the type of events you want to
414 check for, and can be a combination of the constants :const:`POLLIN`,
415 :const:`POLLPRI`, and :const:`POLLOUT`, described in the table below. If not
416 specified, the default value used will check for all 3 types of events.
417
418 +-------------------+-------------------------------------------+
419 | Constant | Meaning |
420 +===================+===========================================+
421 | :const:`POLLIN` | There is data to read. |
422 +-------------------+-------------------------------------------+
423 | :const:`POLLPRI` | There is urgent data to read. |
424 +-------------------+-------------------------------------------+
425 | :const:`POLLOUT` | Ready for output: writing will not block. |
426 +-------------------+-------------------------------------------+
427 | :const:`POLLERR` | Error condition of some sort. |
428 +-------------------+-------------------------------------------+
429 | :const:`POLLHUP` | Hung up. |
430 +-------------------+-------------------------------------------+
431 | :const:`POLLRDHUP`| Stream socket peer closed connection, or |
432 | | shut down writing half of connection. |
433 +-------------------+-------------------------------------------+
434 | :const:`POLLNVAL` | Invalid request: descriptor not open. |
435 +-------------------+-------------------------------------------+
436
437 Registering a file descriptor that's already registered is not an error, and has
438 the same effect as registering the descriptor exactly once.
439
440
441 .. method:: poll.modify(fd, eventmask)
442
443 Modifies an already registered fd. This has the same effect as
444 ``register(fd, eventmask)``. Attempting to modify a file descriptor
445 that was never registered causes an :exc:`OSError` exception with errno
446 :const:`ENOENT` to be raised.
447
448
449 .. method:: poll.unregister(fd)
450
451 Remove a file descriptor being tracked by a polling object. Just like the
452 :meth:`register` method, *fd* can be an integer or an object with a
453 :meth:`~io.IOBase.fileno` method that returns an integer.
454
455 Attempting to remove a file descriptor that was never registered causes a
456 :exc:`KeyError` exception to be raised.
457
458
459 .. method:: poll.poll([timeout])
460
461 Polls the set of registered file descriptors, and returns a possibly empty list
462 containing ``(fd, event)`` 2-tuples for the descriptors that have events or
463 errors to report. *fd* is the file descriptor, and *event* is a bitmask with
464 bits set for the reported events for that descriptor --- :const:`POLLIN` for
465 waiting input, :const:`POLLOUT` to indicate that the descriptor can be written
466 to, and so forth. An empty list indicates that the call timed out and no file
467 descriptors had any events to report. If *timeout* is given, it specifies the
468 length of time in milliseconds which the system will wait for events before
469 returning. If *timeout* is omitted, negative, or :const:`None`, the call will
470 block until there is an event for this poll object.
471
472 .. versionchanged:: 3.5
473 The function is now retried with a recomputed timeout when interrupted by
474 a signal, except if the signal handler raises an exception (see
475 :pep:`475` for the rationale), instead of raising
476 :exc:`InterruptedError`.
477
478
479 .. _kqueue-objects:
480
481 Kqueue objects
482 --------------
483
484 .. method:: kqueue.close()
485
486 Close the control file descriptor of the kqueue object.
487
488
489 .. attribute:: kqueue.closed
490
491 ``True`` if the kqueue object is closed.
492
493
494 .. method:: kqueue.fileno()
495
496 Return the file descriptor number of the control fd.
497
498
499 .. method:: kqueue.fromfd(fd)
500
501 Create a kqueue object from a given file descriptor.
502
503
504 .. method:: kqueue.control(changelist, max_events[, timeout]) -> eventlist
505
506 Low level interface to kevent
507
508 - changelist must be an iterable of kevent objects or ``None``
509 - max_events must be 0 or a positive integer
510 - timeout in seconds (floats possible); the default is ``None``,
511 to wait forever
512
513 .. versionchanged:: 3.5
514 The function is now retried with a recomputed timeout when interrupted by
515 a signal, except if the signal handler raises an exception (see
516 :pep:`475` for the rationale), instead of raising
517 :exc:`InterruptedError`.
518
519
520 .. _kevent-objects:
521
522 Kevent objects
523 --------------
524
525 https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2
526
527 .. attribute:: kevent.ident
528
529 Value used to identify the event. The interpretation depends on the filter
530 but it's usually the file descriptor. In the constructor ident can either
531 be an int or an object with a :meth:`~io.IOBase.fileno` method. kevent
532 stores the integer internally.
533
534 .. attribute:: kevent.filter
535
536 Name of the kernel filter.
537
538 +---------------------------+---------------------------------------------+
539 | Constant | Meaning |
540 +===========================+=============================================+
541 | :const:`KQ_FILTER_READ` | Takes a descriptor and returns whenever |
542 | | there is data available to read. |
543 +---------------------------+---------------------------------------------+
544 | :const:`KQ_FILTER_WRITE` | Takes a descriptor and returns whenever |
545 | | there is data available to write. |
546 +---------------------------+---------------------------------------------+
547 | :const:`KQ_FILTER_AIO` | AIO requests. |
548 +---------------------------+---------------------------------------------+
549 | :const:`KQ_FILTER_VNODE` | Returns when one or more of the requested |
550 | | events watched in *fflag* occurs. |
551 +---------------------------+---------------------------------------------+
552 | :const:`KQ_FILTER_PROC` | Watch for events on a process ID. |
553 +---------------------------+---------------------------------------------+
554 | :const:`KQ_FILTER_NETDEV` | Watch for events on a network device |
555 | | (not available on macOS). |
556 +---------------------------+---------------------------------------------+
557 | :const:`KQ_FILTER_SIGNAL` | Returns whenever the watched signal is |
558 | | delivered to the process. |
559 +---------------------------+---------------------------------------------+
560 | :const:`KQ_FILTER_TIMER` | Establishes an arbitrary timer. |
561 +---------------------------+---------------------------------------------+
562
563 .. attribute:: kevent.flags
564
565 Filter action.
566
567 +---------------------------+----------------------------------------------+
568 | Constant | Meaning |
569 +===========================+==============================================+
570 | :const:`KQ_EV_ADD` | Adds or modifies an event. |
571 +---------------------------+----------------------------------------------+
572 | :const:`KQ_EV_DELETE` | Removes an event from the queue. |
573 +---------------------------+----------------------------------------------+
574 | :const:`KQ_EV_ENABLE` | Permits control() to return the event. |
575 +---------------------------+----------------------------------------------+
576 | :const:`KQ_EV_DISABLE` | Disables event. |
577 +---------------------------+----------------------------------------------+
578 | :const:`KQ_EV_ONESHOT` | Removes event after first occurrence. |
579 +---------------------------+----------------------------------------------+
580 | :const:`KQ_EV_CLEAR` | Reset the state after an event is retrieved. |
581 +---------------------------+----------------------------------------------+
582 | :const:`KQ_EV_SYSFLAGS` | Internal event. |
583 +---------------------------+----------------------------------------------+
584 | :const:`KQ_EV_FLAG1` | Internal event. |
585 +---------------------------+----------------------------------------------+
586 | :const:`KQ_EV_EOF` | Filter-specific EOF condition. |
587 +---------------------------+----------------------------------------------+
588 | :const:`KQ_EV_ERROR` | See return values. |
589 +---------------------------+----------------------------------------------+
590
591
592 .. attribute:: kevent.fflags
593
594 Filter-specific flags.
595
596 :const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags:
597
598 +----------------------------+--------------------------------------------+
599 | Constant | Meaning |
600 +============================+============================================+
601 | :const:`KQ_NOTE_LOWAT` | Low water mark of a socket buffer. |
602 +----------------------------+--------------------------------------------+
603
604 :const:`KQ_FILTER_VNODE` filter flags:
605
606 +----------------------------+--------------------------------------------+
607 | Constant | Meaning |
608 +============================+============================================+
609 | :const:`KQ_NOTE_DELETE` | *unlink()* was called. |
610 +----------------------------+--------------------------------------------+
611 | :const:`KQ_NOTE_WRITE` | A write occurred. |
612 +----------------------------+--------------------------------------------+
613 | :const:`KQ_NOTE_EXTEND` | The file was extended. |
614 +----------------------------+--------------------------------------------+
615 | :const:`KQ_NOTE_ATTRIB` | An attribute was changed. |
616 +----------------------------+--------------------------------------------+
617 | :const:`KQ_NOTE_LINK` | The link count has changed. |
618 +----------------------------+--------------------------------------------+
619 | :const:`KQ_NOTE_RENAME` | The file was renamed. |
620 +----------------------------+--------------------------------------------+
621 | :const:`KQ_NOTE_REVOKE` | Access to the file was revoked. |
622 +----------------------------+--------------------------------------------+
623
624 :const:`KQ_FILTER_PROC` filter flags:
625
626 +----------------------------+--------------------------------------------+
627 | Constant | Meaning |
628 +============================+============================================+
629 | :const:`KQ_NOTE_EXIT` | The process has exited. |
630 +----------------------------+--------------------------------------------+
631 | :const:`KQ_NOTE_FORK` | The process has called *fork()*. |
632 +----------------------------+--------------------------------------------+
633 | :const:`KQ_NOTE_EXEC` | The process has executed a new process. |
634 +----------------------------+--------------------------------------------+
635 | :const:`KQ_NOTE_PCTRLMASK` | Internal filter flag. |
636 +----------------------------+--------------------------------------------+
637 | :const:`KQ_NOTE_PDATAMASK` | Internal filter flag. |
638 +----------------------------+--------------------------------------------+
639 | :const:`KQ_NOTE_TRACK` | Follow a process across *fork()*. |
640 +----------------------------+--------------------------------------------+
641 | :const:`KQ_NOTE_CHILD` | Returned on the child process for |
642 | | *NOTE_TRACK*. |
643 +----------------------------+--------------------------------------------+
644 | :const:`KQ_NOTE_TRACKERR` | Unable to attach to a child. |
645 +----------------------------+--------------------------------------------+
646
647 :const:`KQ_FILTER_NETDEV` filter flags (not available on macOS):
648
649 +----------------------------+--------------------------------------------+
650 | Constant | Meaning |
651 +============================+============================================+
652 | :const:`KQ_NOTE_LINKUP` | Link is up. |
653 +----------------------------+--------------------------------------------+
654 | :const:`KQ_NOTE_LINKDOWN` | Link is down. |
655 +----------------------------+--------------------------------------------+
656 | :const:`KQ_NOTE_LINKINV` | Link state is invalid. |
657 +----------------------------+--------------------------------------------+
658
659
660 .. attribute:: kevent.data
661
662 Filter-specific data.
663
664
665 .. attribute:: kevent.udata
666
667 User-defined value.