kobject

package module
v0.0.0-...-19ca174 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: MIT Imports: 10 Imported by: 2

README

kobject builds.sr.ht status GoDoc Go Report Card

Package kobject provides access to Linux kobject userspace events.

Userspace events occur whenever a kobject's state changes. As an example, events are triggered whenever a USB device is added or removed from a system, or whenever a virtual network interface is added or removed.

For more information on kobjects, please see:

MIT Licensed.

Documentation

Overview

Package kobject provides access to Linux kobject userspace events.

Userspace events occur whenever a kobject's state changes. As an example, events are triggered whenever a USB device is added or removed from a system, or whenever a virtual network interface is added or removed.

For more information on kobjects, please see:

Index

Constants

View Source
const (
	Add     = "add"
	Bind    = "bind"
	Remove  = "remove"
	Change  = "change"
	Move    = "move"
	Online  = "online"
	Offline = "offline"
	Unbind  = "unbind"
)

Possible Actions which trigger an Event.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

An Action is an action which caused an Event to be triggered.

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client provides access to Linux kobject userspace events. Clients are safe for concurrent use.

func New

func New() (*Client, error)

New creates a new Client.

func (*Client) Close

func (c *Client) Close() error

Close releases resources used by a Client.

func (*Client) Receive

func (c *Client) Receive() (*Event, error)

Receive waits until a kobject userspace event is triggered, and then returns the Event.

func (*Client) SetDeadline

func (c *Client) SetDeadline(t time.Time) error

SetDeadline sets the read deadline associated with the connection.

type Event

type Event struct {
	// Fields which are present in all events.
	Action     Action
	DevicePath string
	Subsystem  string
	Sequence   int

	// Values contains arbitrary key/value pairs which are not present in
	// all Events.
	Values map[string]string
}

An Event is a userspace event in response to a state change of a kobject.

Directories

Path Synopsis
cmd
kobject
Command kobject opens a Linux kobject userspace events listener and prints all received events to the terminal.
Command kobject opens a Linux kobject userspace events listener and prints all received events to the terminal.

Jump to

Keyboard shortcuts

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