Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/modules/lua

Marc Balmer wrote:
> Module Name:  src
> Committed By: mbalmer
> Date:         Wed Oct 16 19:44:58 UTC 2013
> Added Files:
>       src/sys/modules/lua: Makefile assert.h ctype.h errno.h infinite.lua
>           inttypes.h limits.h locale.h lua.c luaconf.h luavar.h math.h
>           setjmp.h signal.h stdarg.h stddef.h stdio.h stdlib.h string.h
>           test.lua
> Log Message:
> welcome lua(4), a devide driver that can create and control Lua states inside 
> the kernel

First of all, the code has been imported the wrong way as I stated in
the previous email. You should properly import Lua 5.2 to sys/external/
and then apply local changes required to run it in kernel space.

Second, lua device driver has a limited application. We need a generic
lua module. Your lua device driver can then use it.
For example, if I want to generate bpf code when a user sends a filter
program to /dev/bpf* with Lua, I don't need a device driver. I need to
open a regular lua_State, load sljit module, run bfjit.lua script and
close the state afterwards.

Also, I have a couple of small things.

1. Why do you use lua_ prefix for private functions? You get very close
to lua names: lua_reader vs lua_Reader of lua_require vs luaL_requiref.

2. When you call lua_tostring() you often (or never???) don't check
whether it returns NULL. You can easily panic the kernel when you try
to print a table.


Home | Main Index | Thread Index | Old Index