// Package uevent provides userspace client for consuming events from a // NETLINK_KOBJECT_UEVENT socket, as well as helpers for supplementing // events received from the kernel. package uevent import ( "syscall" "hakurei.app/internal/netlink" ) // Conn represents a NETLINK_KOBJECT_UEVENT socket. type Conn struct{ conn *netlink.Conn } // Close closes the underlying socket. func (c *Conn) Close() error { return c.conn.Close() } // Dial returns the address of a newly connected [Conn]. func Dial() (*Conn, error) { // kernel group is hard coded in lib/kobject_uevent.c, undocumented c, err := netlink.Dial(syscall.NETLINK_KOBJECT_UEVENT, 1) if err != nil { return nil, err } return &Conn{c}, err }