| LUA(4) | Device Drivers Manual | LUA(4) |
lua —
lua*
#include <sys/types.h>
#include <sys/lua.h>
lua device allows to create, control, and delete Lua
states in the kernel through an
ioctl(2) interface. Moreover,
lua can be used to load Lua scripts into a Lua state
and to assign modules to an existing state, i.e. perform the equivalent of the
Lua command require. lua is also
used to retrieve information about currently active Lua states.
lua in the
form of loadable kernel modules that register their functionality with
lua. Modules are loaded using the
require Lua command; whether this command is available
or not is controlled by a
sysctl(8) variable.
lua by default tries to load a kernel module named
luafoo.kmod when it encounters the Lua command
require 'foo'.
lua can be controlled by means of the
following sysctl(8) variables:
kern.lua.autoloadlua tries to autoload kernel
modules.
The default value is 1.
kern.lua.bytecodeThe default value is 0.
kern.lua.maxcountlua limits the number
of instructions executed to this number.
The default value is 0.
kern.lua.requireThe default value is 1.
kern.lua.verboseThe default value is 0.
<sys/lua.h> header file:
LUAINFO(struct
lua_info)lua states in the
lua_info structure:
#define MAX_LUA_NAME 16
#define MAX_LUA_DESC 64
struct lua_state_info {
char name[MAX_LUA_NAME];
char desc[MAX_LUA_DESC];
bool user;
};
struct lua_info {
int num_states; /* total number of Lua states */
struct lua_state_info *states;
};
LUACREATE(struct
lua_create)
struct lua_create {
char name[MAX_LUA_NAME];
char desc[MAX_LUA_DESC];
};
LUADESTROY(struct
lua_create)LUAREQUIRE(struct
lua_require)
#define LUA_MAX_MODNAME 32
struct lua_require {
char state[MAX_LUA_NAME];
char module[LUA_MAX_MODNAME];
};
LUALOAD(struct
lua_load)
struct lua_load {
char state[MAX_LUA_NAME];
char path[MAXPATHLEN];
};
The path element of the lua_load structure must contain at least one ‘/’ character.
lua device first appeared in NetBSD
7.0.
lua driver was written by Marc
Balmer
<mbalmer@NetBSD.org>.
lua device is experimental. Incompatible changes
might be made in the future.
| July 25, 2014 | NetBSD 10.0 |