3 ms·
Is there a reason syscall numbers don’t match up between architectures? Or is it just a quirk of history?
by MBCook 2y ago
Is there a reason syscall numbers don’t match up between architectures?
Or is it just a quirk of history?
- jmgao 2y agoThey were renumbered in x86_64 so that the syscalls that are frequently used together have their function pointers live in the same cacheline in the lookup table: https://lkml.iu.edu/hypermail/linux/kernel/0104.0/0547.html https://lkml.iu.edu/hypermail/linux/kernel/0104.0/0547.html I vaguely remember reading somewhere that the MIPS ones are weird to support compatibility with the existing unix syscall numbering, but I can't find any evidence for that anywhere, so maybe it was aspirational or I'm hallucinating.
- saagarjha 2y agoI am curious how much this actually helps.
- drewg123 2y agoI'm pretty sure it is because when Linus ported Linux from x86 to the DEC Alpha in the early 90s, he used the DEC OSF/1 syscall numbers (and error numbers) so that he could bootstrap the Linux kernel from an OSF/1 userland. He probably should have had a flag day & normalized the syscall numbers to be arch independent like they are on *BSD, but he never did. Coming from BSD, I find this very confusing and tend to grumble when I'm tracing something and have to go groveling from the right errno.h. Eg: % find ~/linux/ -name 'errno*' | wc -l 22 % find ~/freebsd/sys -name 'errno*' | wc -l 1