Documentation ¶
Overview ¶
Package epoll provides an implementation of Linux's IO event notification facility. See epoll(7) for more details.
Index ¶
- func NewEventPoll(ctx context.Context) *fs.File
- type EntryFlags
- type Event
- type EventPoll
- func (e *EventPoll) AddEntry(id FileIdentifier, flags EntryFlags, mask waiter.EventMask, data [2]int32) error
- func (*EventPoll) Read(context.Context, *fs.File, usermem.IOSequence, int64) (int64, error)
- func (e *EventPoll) ReadEvents(max int) []Event
- func (e *EventPoll) Readiness(mask waiter.EventMask) waiter.EventMask
- func (e *EventPoll) Release()
- func (e *EventPoll) RemoveEntry(id FileIdentifier) error
- func (e *EventPoll) UnregisterEpollWaiters()
- func (e *EventPoll) UpdateEntry(id FileIdentifier, flags EntryFlags, mask waiter.EventMask, data [2]int32) error
- func (*EventPoll) Write(context.Context, *fs.File, usermem.IOSequence, int64) (int64, error)
- type FileIdentifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EntryFlags ¶
type EntryFlags int
EntryFlags is a bitmask that holds an entry's flags.
const ( OneShot EntryFlags = 1 << iota EdgeTriggered )
Valid entry flags.
type Event ¶
type Event struct { // Events is the event mask containing the set of events that have been // observed on an entry. Events uint32 // Data is an opaque 64-bit value provided by the caller when adding the // entry, and returned to the caller when the entry reports an event. Data [2]int32 }
Event describes the event mask that was observed and the user data to be returned when one of the events occurs. It has this format to match the linux format to avoid extra copying/allocation when writing events to userspace.
type EventPoll ¶
type EventPoll struct { fsutil.PipeSeek `state:"zerovalue"` fsutil.NotDirReaddir `state:"zerovalue"` fsutil.NoFsync `state:"zerovalue"` fsutil.NoopFlush `state:"zerovalue"` fsutil.NoMMap `state:"zerovalue"` fsutil.NoIoctl `state:"zerovalue"` // Wait queue is used to notify interested parties when the event poll // object itself becomes readable or writable. waiter.Queue // contains filtered or unexported fields }
EventPoll holds all the state associated with an event poll object, that is, collection of files to observe and their current state.
func (*EventPoll) AddEntry ¶
func (e *EventPoll) AddEntry(id FileIdentifier, flags EntryFlags, mask waiter.EventMask, data [2]int32) error
AddEntry adds a new file to the collection of files observed by e.
func (*EventPoll) ReadEvents ¶
ReadEvents returns up to max available events.
func (*EventPoll) Readiness ¶
Readiness determines if the event poll object is currently readable (i.e., if there are pending events for delivery).
func (*EventPoll) Release ¶
func (e *EventPoll) Release()
Release implements fs.FileOperations.Release.
func (*EventPoll) RemoveEntry ¶
func (e *EventPoll) RemoveEntry(id FileIdentifier) error
RemoveEntry a files from the collection of observed files.
func (*EventPoll) UnregisterEpollWaiters ¶
func (e *EventPoll) UnregisterEpollWaiters()
UnregisterEpollWaiters removes the epoll waiter objects from the waiting queues. This is different from Release() as the file is not dereferenced.
func (*EventPoll) UpdateEntry ¶
func (e *EventPoll) UpdateEntry(id FileIdentifier, flags EntryFlags, mask waiter.EventMask, data [2]int32) error
UpdateEntry updates the flags, mask and user data associated with a file that is already part of the collection of observed files.
type FileIdentifier ¶
FileIdentifier identifies a file. We cannot use just the FD because it could potentially be reassigned. We also cannot use just the file pointer because it is possible to have multiple entries for the same file object as long as they are created with different FDs (i.e., the FDs point to the same file).