epoll

package
v0.0.0-...-ba09d25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2021 License: Apache-2.0, MIT Imports: 11 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEventPoll

func NewEventPoll(ctx context.Context) *fs.File

NewEventPoll allocates and initializes a new event poll object.

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

func (e *EventPoll) EventRegister(entry *waiter.Entry) error

EventRegister implements waiter.Waitable.

func (*EventPoll) Read

Read implements fs.FileOperations.Read.

func (*EventPoll) ReadEvents

func (e *EventPoll) ReadEvents(max int) []linux.EpollEvent

ReadEvents returns up to max available events.

func (*EventPoll) Readiness

func (e *EventPoll) Readiness(mask waiter.EventMask) waiter.EventMask

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(ctx context.Context)

Release implements fs.FileOperations.Release.

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.

func (*EventPoll) Write

Write implements fs.FileOperations.Write.

type FileIdentifier

type FileIdentifier struct {
	File *fs.File `state:"wait"`
	Fd   int32
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL