Module notifier

Notifier chain mechanism.

This library allows Lua scripts to register callback functions that are invoked when specific kernel events occur, such as keyboard input, network device status changes, or virtual terminal events.

Class notifier

notifier:stop () Stops event delivery to the Lua callback.

notifier

keyboard (callback) Registers a keyboard-event notifier.
netdevice (callback) Registers a network-device notifier.
vterm (callback) Registers a virtual-terminal notifier.


Class notifier

Represents a kernel notifier object. This is a userdata object returned by functions like notifier.keyboard(), notifier.netdevice(), or notifier.vterm(). It encapsulates a struct notifier_block and the associated Lua callback.
notifier:stop ()
Stops event delivery to the Lua callback. After stop(), the underlying notifier_block remains registered in the kernel chain until the owning runtime is torn down, but firings become silent no-ops. This keeps stop() safe in any context (including hardirq) since it performs no sleeping operations; the real unregistration happens in release, which always runs in process context.

Returns:

    nil

Usage:

    my_notifier:stop()

notifier

keyboard (callback)
Registers a keyboard-event notifier. Must be called from a hardirq runtime. Only available when the kernel is built with CONFIG_VT.

Parameters:

  • callback function invoked as callback(event, down, shift, value)event is a linux.kbd code, down is a boolean (key pressed), shift is a boolean (modifier held), and value is the keycode or keysym depending on event. Returns a linux.notify status code.

Returns:

    notifier
netdevice (callback)
Registers a network-device notifier. Must be called from a process runtime (the default).

Parameters:

  • callback function invoked as callback(event, name)event is a linux.netdev code and name is the device name (e.g. "eth0"). Returns a linux.notify status code.

Returns:

    notifier
vterm (callback)
Registers a virtual-terminal notifier. Must be called from a hardirq runtime. Only available when the kernel is built with CONFIG_VT.

Parameters:

  • callback function invoked as callback(event, c, vc_num)event is a linux.vt code, c is the character value, and vc_num is the virtual console number. Returns a linux.notify status code.

Returns:

    notifier
generated by LDoc 1.5.0 Last updated 2026-05-09 15:39:54