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 underlyingnotifier_blockremains registered in the kernel chain until the owning runtime is torn down, but firings become silent no-ops. This keepsstop()safe in any context (including hardirq) since it performs no sleeping operations; the real unregistration happens inrelease, 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
hardirqruntime. Only available when the kernel is built withCONFIG_VT.Parameters:
- callback
function
invoked as
callback(event, down, shift, value)—eventis a linux.kbd code,downis a boolean (key pressed),shiftis a boolean (modifier held), andvalueis the keycode or keysym depending onevent. Returns a linux.notify status code.
Returns:
- callback
function
invoked as
- netdevice (callback)
-
Registers a network-device notifier. Must be called from a process
runtime (the default).
Parameters:
- callback
function
invoked as
callback(event, name)—eventis a linux.netdev code andnameis the device name (e.g."eth0"). Returns a linux.notify status code.
Returns:
- callback
function
invoked as
- vterm (callback)
-
Registers a virtual-terminal notifier. Must be called from a
hardirqruntime. Only available when the kernel is built withCONFIG_VT.Parameters:
- callback
function
invoked as
callback(event, c, vc_num)—eventis a linux.vt code,cis the character value, andvc_numis the virtual console number. Returns a linux.notify status code.
Returns:
- callback
function
invoked as