<--previous |
contents |
next-->
KEvents
The user program communicates with the event queue by way of KEvents. A set
of KEvents are passed into the queue using the kevent() method to set up the
conditions to monitor, and a set of KEvents are passed back to indicate which
events have triggered.
The KEvent objects are analagous to the struct defined in kqueue(2).
Interface
KEvent(ident, flags=0, fflags=0, udata=None)
Note that "KEvent" in the definition above refers to a generic KEvent
class - in practice, one of the KEvent classes defined below will be used
instead.
All KEvents obey the same construction interface:
- ident is an identifier whose interpretation differs
between KEvent classes. For instance, it may be a file descriptor,
or a process identifier.
- flags are the actions to perform on the given KEvent.
Possible flag values are:
- EV_ADD - Add the event to the queue.
- EV_ENABLE - Permit kevent() to return the event if it is triggered.
- EV_DISABLE - Do not permit kevent() to return the event if it is triggered.
- EV_DELETE - Remove the event from the queue.
- EV_ONESHOT - Delete the event from the queue after the first time it is triggered.
- EV_CLEAR - Reset the event state after it is retrieved by the user.
- EV_EOF - Filters may set this flag to indicate a filter-specific EOF condition.
- EV_ERROR - Filters may set this to signal filter-specific error conditions.
- fflags are filter-specific flags. See the specific
filter documentation below for a list of fflags available for each
filter. Please see kqueue(2) for information on the meaning of each
flag.
- udata is opaque user data. This can be any arbitrary
piece of user-defined data associated with the KEvent. User data
will be returned intact by kevent() when a KEvent triggers.
Some filters return filter-specific data through the .data attribute.
Please see kqueue(2) for more information.
ERead
Returns whenever data is available to read.
- ident is a descriptor.
- fflags:
- ERead.NOTE_LOWAT
- ERead.NOTE_EOF
EWrite
EWrite has no filter flags.
EVNode
fflags:
- EVNode.NOTE_DELETE
- EVNode.NOTE_WRITE
- EVNode.NOTE_EXTEND
- EVNode.NOTE_TRUNCATE
- EVNode.NOTE_ATTRIB
- EVNode.NOTE_LINK
- EVNode.NOTE_RENAME
- EVNode.NOTE_REVOKE
EProc
fflags:
- EProc.NOTE_EXIT
- EProc.NOTE_FORK
- EProc.NOTE_EXEC
- EProc.NOTE_TRACK
- EProc.NOTE_TRACKERR
- EProc.NOTE_CHILD
- EProc.NOTE_PROC
ESignal
ESignal has no filter flags.
PyOpenbsd v0.1 Manual