“C isnt a programming language, it’s a protocol”
“C isnt a programming language, it’s a protocol”
> Um sorry what? This is Bappyscript, not C. Where’s the Bappyscript interface for Linux?
Right here!
https://man7.org/linux/man-pages/man2/syscall.2.html#NOTES
On Linux, you don't need C at all since you can interface with the kernel directly. The ABI is stable and simple enough that a new programming language could have a system_call keyword that makes the compiler emit the system call code.
With this one piece of functionality, it's possible to do literally anything on Linux. No need for C libraries and their legacy at all. The hardest part will be describing the Linux user space API data structures in the new language so that they can be passed to and from the kernel.
The Linux kernel headers with all relevant structure definitions are here:
- you still have to take C ideas in account because you don’t know how much stack a syscall wants
- vdso are C-ABI objects
There are no such considerations when issuing Linux system calls. You place parameters in specific registers, trap into kernel mode and then read back the result from a specific register.
There is one MIPS architecture where you have to pass some arguments on the stack but that's about it.
> vdso are C-ABI objects
Yes, unfortunately. It is not necessary to use the vDSO though. It is a performance optimization. The normal system calls will work just fine.