Reference

nlsysevent(4)

Netlink-based kernel event notification module

NAME

nlsysevent – Netlink-based kernel event notification module

SYNOPSIS

To load the driver as a module at boot time, place the following line in loader.conf(5):

nlsysevent_load="YES"

Alternatively, to load the module at runtime:

kldload nlsysevent

DESCRIPTION

The nlsysevent kernel module provides a netlink(4) Generic Netlink interface for receiving kernel device events. It hooks into the devctl(4) notification system and re-publishes all kernel events as Generic Netlink multicast messages under the NETLINK_GENERIC protocol family.

This provides an alternative to reading events from /dev/devctl (used by devd(8)), with the advantage that multiple consumers can subscribe to events simultaneously, and consumers can selectively subscribe to specific event groups.

Generic Netlink Family

The module registers a Generic Netlink family named “nlsysevent”. The dynamically-assigned family identifier can be resolved using the standard CTRL_CMD_GETFAMILY request as described in genetlink(4).

Commands

The following command is defined:

NLSE_CMD_NEWEVENT

Sent when a kernel event occurs. This message is never solicited by userland; it is only delivered to sockets that have subscribed to one or more multicast groups.

Attributes

Each NLSE_CMD_NEWEVENT message contains the following TLV attributes:

NLSE_ATTR_SYSTEM

(string) The system name that generated the event (e.g., “ACPI, “IFNET, “USB”””).

NLSE_ATTR_SUBSYSTEM

(string) The subsystem name within the system.

NLSE_ATTR_TYPE

(string) The type of the event.

NLSE_ATTR_DATA

(string) Optional extra data associated with the event. This attribute may be absent if no extra data was provided.

Multicast Groups

The module creates one multicast group per system name. The following groups are pre-registered when the module is loaded:

ACPI
AEON
CAM
CARP
coretemp
DEVFS
device
ETHERNET
GEOM
HYPERV_NIC_VF
IFNET
INFINIBAND
KERNEL
nvme
PMU
RCTL
USB
VFS
VT
ZFS

Additional groups are created dynamically as new system names appear in kernel events, up to a maximum of 64 groups.

The group identifier for a given system name can be resolved via CTRL_CMD_GETFAMILY and then subscribed to using the NETLINK_ADD_MEMBERSHIP socket option.

EXAMPLES

The genl(1) utility can be used to monitor events:

genl monitor nlsysevent

SEE ALSO

genl(1), snl(3), devctl(4), genetlink(4), netlink(4), devd(8)

HISTORY

The nlsysevent module first appeared in FreeBSD 15.0.

AUTHORS

The nlsysevent kernel module and this manual page were written by Baptiste Daroussin ⟨[email protected]⟩.