Documentation ¶
Overview ¶
Package epoll provides an implementation of Linux's IO event notification facility. See epoll(7) for more details.
Lock order: EventPoll.mu
fdnotifier.notifier.mu EventPoll.listsMu unix.baseEndpoint.Mutex
Index ¶
- func NewEventPoll(ctx context.Context) *fs.File
- type EntryFlags
- type EventPoll
- func (e *EventPoll) AddEntry(id FileIdentifier, flags EntryFlags, mask waiter.EventMask, data [2]int32) error
- func (e *EventPoll) EventRegister(entry *waiter.Entry) error
- func (*EventPoll) Read(context.Context, *fs.File, usermem.IOSequence, int64) (int64, error)
- func (e *EventPoll) ReadEvents(max int) []linux.EpollEvent
- func (e *EventPoll) Readiness(mask waiter.EventMask) waiter.EventMask
- func (e *EventPoll) Release(ctx context.Context)
- func (e *EventPoll) RemoveEntry(ctx context.Context, id FileIdentifier) error
- 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 EventPoll ¶
type EventPoll struct { fsutil.FilePipeSeek `state:"zerovalue"` fsutil.FileNotDirReaddir `state:"zerovalue"` fsutil.FileNoFsync `state:"zerovalue"` fsutil.FileNoopFlush `state:"zerovalue"` fsutil.FileNoIoctl `state:"zerovalue"` fsutil.FileNoMMap `state:"zerovalue"` fsutil.FileNoSplice `state:"nosave"` fsutil.FileUseInodeUnstableAttr `state:"nosave"` // 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.
+stateify savable
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) EventRegister ¶
EventRegister implements waiter.Waitable.
func (*EventPoll) ReadEvents ¶
func (e *EventPoll) ReadEvents(max int) []linux.EpollEvent
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) RemoveEntry ¶
func (e *EventPoll) RemoveEntry(ctx context.Context, id FileIdentifier) error
RemoveEntry a files from the collection of observed files.
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).
+stateify savable