Module lunatik

Manages Lunatik runtimes — isolated Lua states running in the kernel.

lunatik

_ENV Shared global environment; scripts exchange objects (e.g.
runtime (script[, context="process"]) Creates a new Lunatik runtime executing the given script.

Class runtime

runtime:resume (...) Resumes a yielded runtime, analogous to coroutine.resume.
runtime:stop () Stops the runtime and releases all associated kernel resources.


lunatik

_ENV
Shared global environment; scripts exchange objects (e.g. RCU tables) through it.
  • _ENV
runtime (script[, context="process"])
Creates a new Lunatik runtime executing the given script.

Parameters:

  • script string script name (e.g., "mymod" loads /lib/modules/lua/mymod.lua)
  • context string execution context: "process" (sleepable, GFP_KERNEL, mutex) or "softirq" (atomic, GFP_ATOMIC, spinlock). Use "softirq" for hooks that fire in interrupt context (netfilter, XDP). (default "process")

Returns:

    runtime

Raises:

if allocation fails or the script errors on load

Class runtime

Isolated Lua state running within the Linux kernel.
runtime:resume (...)
Resumes a yielded runtime, analogous to coroutine.resume.

Parameters:

  • ... values delivered to the script as return values of coroutine.yield()

Returns:

    vararg values passed to the next coroutine.yield(), or returned by the script

Raises:

if the runtime errors on resumption
runtime:stop ()
Stops the runtime and releases all associated kernel resources.
generated by LDoc 1.5.0 Last updated 2026-03-31 12:21:45