3 ms·
> ‘porting’ this program to, say, FreeBSD, would only require to change those [system call numbers] This is not correct. Only Linux has a stable kernel-userspa
by matheusmoreira 3y ago
> ‘porting’ this program to, say, FreeBSD, would only require to change those [system call numbers]
This is not correct. Only Linux has a stable kernel-userspace interface which allows you to depend on these numbers. In pretty much every other operating system, you are required to use the system libraries they provide. Compiling a program with these numbers hardcoded into them will cause them to break when the OS developers change the syscalls.
I wrote an article about this with more details and lots of citations:
https://www.matheusmoreira.com/linux/system-calls https://www.matheusmoreira.com/linux/system-calls
- toast0 3y agoFreeBSD may not promise stable system calls, but it usually delivers. The documented procedure for upgrades is update the kernel, reboot, update userland, restart deamons as needed. That only works if the old userland can run on the new kernel, so usually it can. Certainly there have been exceptions, but in my experience, they've all been fixed. FreeBSD documentation includes a guide on assembly programming [1], which means libc isn't the only acceptable interface to the kernel. Staticly linked executables are supported by the included compiler, those are expected to continue to work after kernel updates, which requires syscall stability. Syscalls that take structures at risk of changing sizes generally include size as a parameter or within the structure, and the transitions to different sizes haven't always been easy (cpuset increases were rough in the past, but the next one will be better), but the syscall interface didn't change really. [1] https://docs.freebsd.org/en/books/developers-handbook/x86/ https://docs.freebsd.org/en/books/developers-handbook/x86/
- matheusmoreira 3y agoThay's just the thing... As far as I know Linux is the only one which does make that promise. If user space programs break it's a bug in the kernel. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/stable/syscalls https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin... Other systems have the same "usually works but no promises" disposition which means they can't be relied upon. Things work fine until they don't. When breakage occurs they take no responsibility for them because they didn't promise anything to begin with. Torvalds says today's Linux can run binaries from the 90s, that's how serious this guy is about ABIs. I've never seen other operating system developers claim anything of the sort. Not even Microsoft.