Documentation ¶
Overview ¶
Package socketset is in API for creating a select style netlink socket to receive events from the kernel.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SocketSet ¶
type SocketSet struct {
// contains filtered or unexported fields
}
SocketSet is used to receive events from a socket and shut it down cleanly when asked. It contains a socket for events and a pipe socket to unblock receive on shutdown.
func NewSocketSet ¶
NewSocketSet returns a socketSet, initialized with the given parameters.
func (*SocketSet) Close ¶
Close closes the pipe file descriptor. It must only be called after Shutdown has closed fdEvents, and unblocked receive. It should only be called once.
func (*SocketSet) ReceiveBytes ¶
ReceiveBytes waits for bytes from fdEvents and return a byte array truncated to the message length. It will block until an event is produced, or shutdown is called.
func (*SocketSet) ReceiveNetlinkMessages ¶
func (obj *SocketSet) ReceiveNetlinkMessages() ([]syscall.NetlinkMessage, error)
ReceiveNetlinkMessages is a wrapper around ReceiveBytes that parses the bytes from the event and returns an array of NetlinkMessages.
func (*SocketSet) ReceiveUEvent ¶
ReceiveUEvent is a wrapper around ReceiveBytes. Parses the UEvent data receieved from the socket and puts it into a UEvent struct.
type UEvent ¶
type UEvent struct { // default keys, as per https://github.com/torvalds/linux/blob/master/lib/kobject_uevent.c Action string Devpath string Subsystem string // every other KV pair Data map[string]string }
UEvent struct has attributes for KOBJECT_NETWORK_UEVENT, passed from the kernel.