zig-in-kernel-space
Linux kernel module(s) in Zig. No drops of C glue.
https://codeberg.org/bogomips/zig-in-kernel-space
Supported Zig versions
0.15.2, 0.16.0, and master.
Linux kernel module(s) in Zig. No drops of C glue.
https://codeberg.org/bogomips/zig-in-kernel-space
0.15.2, 0.16.0, and master.
Woahh so cool I wanna mess around with this later ![]()
I wrote short notes on the subject
https://codeberg.org/bogomips/zig-in-kernel-space/src/branch/main/notes.md
Don’t get excited. The Linux API is like mercury. The ABI is stable, but the API is constantly evolving. This is where Zig and Linux are similar. This project will soon become obsolete, just like others.
True, but that’s the nature of maintaining any package of kernel modules, in C or any other language.
pahole + translate-c is just too awesome, thank you very much.
Don’t you guys realize the potential of this? Linux now contains Rust and is heavily invested by MS and others. But (some of) the BSD’s don’t want Rust in their core and I suspect that they are really interested in Zig. And thinking of other systems, such as MINIX3 and Plan9 (both written in C), I see a serious potential. Apple for instance also relies on UNIX and I think that a server OS that can be trusted is worth something. Maybe it is time to return to patches for updating the system for instance.
I think most people here have always been aware that Zig could make a very good kernel development language. We’re also aware that you can’t make a unstable language a kernel dependency. So there’s not a lot of point worrying about it until 1.0 is hit, at least not for anything that isn’t a 3rd party module.
It was just a joke demo (just for fun). You can’t write something serious for the kernel space without C binding for the chosen language.
It seems to me that Rust has already reached saturation, https://rusted-kernel.com/
Why expect that Zig will find another way?
…because Zig code can work directly to the C API. No need for an intermediate layer. Yes the kernel changes APIs whenever it wants to, but that’s just as much of a problem for C code as for Zig code. Working with native C code is a fundamental feature of Zig.
However, there are other reasons it’s not the right time for kernel level Zig.