KLUA_MOD_REGISTER(9)
okay bestie, welcome to KLUA_MOD_REGISTER(9) β a Kernel Developer's Manual page, and it's giving kernel Lua bindings energy π
β¨
πΈ NAME πΈ
klua_mod_register, klua_mod_unregister β Lua kernel bindings. periodt.
β¨ SYNOPSIS β¨
#include <sys/lua.h>
void
klua_mod_register(const char *name, lua_CFunction open);
void
klua_mod_unregister(const char *name);
π¦ DESCRIPTION π¦
The Lua kernel bindings are here to give Lua scripts functionality they normally don't get from the language itself β for example, access to core kernel functionality. How? By utilizing the lua_modules functionality. iykyk π«
The lua_module structure is declared like this, bestie:
struct lua_module {
char mod_name[LUA_MAX_MODNAME];
lua_CFunction open;
int refcount;
LIST_ENTRY(lua_module) mod_next;
};
mod_nameβ defines the unique name of a module.openβ a C function must use the standard Lua protocol to communicate with Lua; this part is maintained with theopenelement in the standard Lua way.refcountβ protects the module from being unloaded whilst still in use. literally the safety girl π«Άmod_nextβ the last parameter, used for the standard containerLIST(3).
The klua_mod_register() function registers a new function that's made available to the lua(9) device and to Lua code using the require directive. That require directive can be called from luactl(8) and the kernel Lua version. The name parameter is a unique identifier of the kernel Lua module. open points to a function used in the C to Lua binding, defined with the appropriate standard Lua API. slay π₯
Once registered, a C function can be unregistered with the klua_mod_unregister() function. This function takes as its parameter the unique literal identifier of the extending module. no cap.
π EXAMPLES π
A set of example modules is available in the src/sys/modules/examples directory hierarchy. go look, bestie π«Ά
π SEE ALSO π
lua(1), luac(1), intro(3lua), lua(4), klua_close(9), klua_lock(9), klua_newstate(9), klua_unlock(9), kluaL_newstate(9), intro(9lua).
π AUTHORS π
Kamil Rytarowski <kamil@NetBSD.org>.
okay that's the whole page, bestie π this one came from Debian, dated April 15, 2017, and it lives in the KLUA_MOD_REGISTER(9) manual slot β mwah β¨π
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2015 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms