3 ms·
Linux is the best operating system for a project like this. The system call binary interface is stable at the processor architecture level: https://www.kernel.
by matheusmoreira 6y ago
Linux is the best operating system for a project like this. The system call binary interface is stable at the processor architecture level:
https://www.kernel.org/doc/Documentation/ABI/stable/syscalls https://www.kernel.org/doc/Documentation/ABI/stable/syscalls
http://man7.org/linux/man-pages/man2/syscalls.2.html http://man7.org/linux/man-pages/man2/syscalls.2.html
http://man7.org/linux/man-pages/man2/syscall.2.html http://man7.org/linux/man-pages/man2/syscall.2.html
Any Linux process can perform Linux system calls, no matter what language the software is written in. Instead of relying on C libraries to do everything, a compiler could emit system call code when necessary. The entire Linux user space could be rewritten in a higher level language that way. Rust would be the likely candidate but there's no reason a Lisp or Scheme couldn't do it. The language would need full support for features of binary interfaces such as function calling conventions, pointers, structures with padding and alignment, etc.
- heavyset_go 6y agoDo you know of any projects exploring this space?
- anton96 6y agoIn matter of scheme you have the guile project. https://www.gnu.org/software/guile/guile.html https://www.gnu.org/software/guile/guile.html
- slim 6y agoso maybe guixsd ?
- yencabulator 6y agoGo does syscalls directly on Linux. Libc is only needed if you use a thing that only exists in libc (e.g. NSS).
- AnIdiotOnTheNet 6y agoIn that vein, Zig also uses syscalls directly on Linux in its standard library so as to avoid linking with C unless desired. This is not possible on the various BSDs.
- matheusmoreira 6y agoThe Go runtime apparently uses system calls directly. The implementation of every other programming language I know uses the C standard library. Rust has a freestanding mode which is great. I even made a crate for Linux system calls but that needs inline assembly which isn't stable yet. As for user space projects, I know this one: https://github.com/arsv/minibase https://github.com/arsv/minibase I meant to start my own but replacing what already exists is a lifetime of work. Haven't had much free time these days nor the willpower to make it happen. I created a liblinux but it's incomplete: https://github.com/matheusmoreira/liblinux https://github.com/matheusmoreira/liblinux I also found out the Linux kernel itself has an excellent system call stubs header which they apparently use for their own tools: https://github.com/torvalds/linux/blob/master/tools/include/nolibc/nolibc.h https://github.com/torvalds/linux/blob/master/tools/include/...