Lunatik: Lunatik is a framework for scripting the Linux kernel with Lua
github.com
github.com
Please feel welcome to join us on Matrix [1] as well.
[1] https://legacy.netdevconf.info/0x14/session.html?talk-linux-... [2] https://netdevconf.info/0x17/sessions/talk/scripting-the-lin... [3] https://www.netbsd.org/~lneto/dls14.pdf [4] https://www.slideshare.net/eurobsdcon/lneto-npf-scripting [5] https://2018.eurobsdcon.org/static/slides/Fast,%20Flexible%2...
However, it was conceived for extensibility and flexibility in general, in the spirit of [6]. It has been used also for scripting CPU frequency scaling, debugging, application sandboxing among others [7,8].
[6] https://web.stanford.edu/~ouster/cgi-bin/papers/scripting.pd... [7] https://drive.google.com/file/d/1TJ50IEbRXlBz-TxheGdkO-b4vLS... [8] https://youtu.be/-ufBgy044HI?si=IT4FOqeldA-jsg2r (Portuguese only)
ZFS also has its own kernel Lua version (I'd love to unify them, BTW).
Moreover, we have some simplified examples on our repository [9].
[9] https://github.com/luainkernel/lunatik?tab=readme-ov-file#ex...
[1] https://victornogueirario.github.io/xdplua/ [2] https://netdevconf.info/0x14/session.html?talk-linux-network...
I'm currently working on updating XDPLua for using kfuncs on top of the newest version of Lunatik.. I've a PoC already and should create a PR in a few weeks.
https://archive.fosdem.org/2013/schedule/event/lua_in_the_ne...
Edit: It made it to HN front page today.
Edit: see http://www.abstractnonsense.com/schemix/
[1] https://sourceforge.net/projects/lunatik/files/ [2] https://www.maxwell.vrac.puc-rio.br/colecao.php?strSecao=res... (Portuguese only)
[1] https://netdevconf.info/0x14/session.html?talk-linux-network... [2] https://netdevconf.info/0x17/sessions/talk/scripting-the-lin...
I'm currently updating XDPLua and we might have a GSoC project on updating NFLua this year =)..
[3] http://www.lua.inf.puc-rio.br/gsoc/ideas2024.html#lunatik-ne...
Assuming there is one, what's the technical reason for this?
> However, occasionally drivers or library functions may need to include FP code. This is supported by isolating the functions containing FP code to a separate translation unit (a separate source file), and saving/restoring the FP register state around calls to those functions. This creates “critical sections” of floating-point usage.
https://www.kernel.org/doc/html/next/core-api/floating-point...
With this, we can proceed - easily! - to attain something I have long wanted: to replace all Linux userspace with Lua-only tooling. Yes, Lua all the things in userspace.
I know, "why would I do that?", well, because there is a thing I've wanted for 40 years of computing, and that is a very, very powerful computer that only requires me to use one (oh, okay, two or three..) languages.
I grew up in computers that booted directly to a single language (BASIC), and would let you do everything you need in that and only that. Imagine replacing all userspace tooling with a lua implementation. Yes, insane! But imagine the development flow once you get some good stuff ported/ffi'ed! Having the kernel interfaces available now, is just .. candy.
I would love to have this for a Linux distro, even experimental, even just as a toy, to boot directly into a LOAD81[1] interface that has a whole lotta new Lunatik in it .. I could imagine pushing LOAD81 very hard into a new OS paradigm with this. Wow!
[1] = antirez' LOAD81, which I have long thought of as a fun way to build a new userspace front-end: https://github.com/antirez/LOAD81.git
[1] https://pdos.csail.mit.edu/6.828/2008/readings/hunt07singula... [2] https://www.classes.cs.uchicago.edu/archive/2019/winter/3310...
[1] https://github.com/luainkernel/lunatik?tab=readme-ov-file#no... [2] https://github.com/luainkernel/lunatik?tab=readme-ov-file#ke...
But thanks for the further insight into Lunatik - I'm definitely going to be putting it through its paces soon.
Depending on which set of Lua scripts it runs it fills a different role. The first set becomes the display server and window manager. It can then run itself recursively to provide graphical 'apps' (but also X11 ones, Wayland ones, ...).
I run the 'regular' desktop (stacking, tiling, ...) 'durden' right now, but I hope to switch to the more crazy dataflow/zui one (pipeworld[2]) or the VR one (safespaces[3]).
Then it has an additional 'curses like' one for TUIs and CLIs, 'arcan-tui' with a default shell Lash#Cat9[4]. Looking at their recent posts there also seem to be a network story including server-side processing, but I haven't had the time to play with out more than following the examples in the blog so can't say more about that.
EltaninOS[5] is trying to build a distribution around it.
Everything scripted in Lua.
[1] = https://arcan-fe.com [2] = https://arcan-fe.com/2021/04/12/introducing-pipeworld/ [3] = https://arcan-fe.com/2018/03/29/safespaces-an-open-source-vr... [4] = https://arcan-fe.com/2022/10/15/whipping-up-a-new-shell-lash... [5] = https://eltaninos.org/
[1] https://www.netbsd.org/~lneto/dls14.pdf
However, giving you a short answer, we use Lua mainly because it's easy both to extend and to embed. It's implemented as an almost "freestanding" C library. Moreover, it has a considerable small footprint (~250 KB) in comparison to other scripting languages (e.g., Python has a few MB). Moreover, Lua has automatic memory management, fully isolated execution states, protected calls, among other features.