uevent

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package uevent reads the kernel's device events from its own uevent netlink group, which carries ACTION, SUBSYSTEM and the rest of each event without depending on udevd having processed it, and which unprivileged processes may read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action uint8

Action is what an event reports happened to its device.

const (
	Other Action = iota
	Add
	Remove
	Change
)

The actions told apart; every other is Other.

type Event

type Event struct {
	Action    Action
	Subsystem string
	Sysname   string
	Props     map[string]string
}

Event is one kernel uevent.

func Parse

func Parse(msg []byte) (Event, error)

Parse decodes one kernel netlink message, "action@devpath\0KEY=VALUE\0...". libudev-framed messages, which udevd sends to its own group, are rejected.

type Reader

type Reader interface {
	Next() (Event, error)
	Close() error
}

Reader yields events until closed.

func Listen

func Listen() (Reader, error)

Listen opens a socket on the kernel's uevent group. It is non-blocking and wrapped in an os.File, so Next parks on the runtime poller and Close interrupts it.

Jump to

Keyboard shortcuts

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