Arch Linux ships unistd_32.h
and unistd_64.h
in /usr/include/asm/
. Just look at those headers unless you're modifying the kernel to add new system calls.
<asm/unistd.h>
checks macros to figure out if its being included in 32 or 64-bit code (and checks for x32), and uses #include
to pull in the right set of definitions for the target.
On my up-to-date x86-64 Arch system:
$ pacman -Fo /usr/include/asm/unistd*
usr/include/asm/unistd_32.h is owned by core/linux-api-headers 4.7-1
usr/include/asm/unistd_64.h is owned by core/linux-api-headers 4.7-1
usr/include/asm/unistd.h is owned by core/linux-api-headers 4.7-1
usr/include/asm/unistd_x32.h is owned by core/linux-api-headers 4.7-1
In the kernel source itself, starting with version 3.3, the unistd_32.h
for use by user-space is built from other files.
https://github.com/torvalds/linux/search?q=unistd_32.h&unscoped_q=unistd_32.h finds this in arch/x86/entry/syscalls/Makefile
$(uapi)/unistd_32.h: $(syscall32) $(syshdr)
$(call if_changed,syshdr)
The syscall tables are defined in: arch/x86/entry/syscalls/syscall_32.tbl
and .../syscall_64.tbl
https://github.com/torvalds/linux/tree/6f0d349d922ba44e4348a17a78ea51b7135965b1/arch/x86/entry/syscalls
The contents of syscall_32.tbl
looks like:
# some comments
0 i386 restart_syscall sys_restart_syscall __ia32_sys_restart_syscall
1 i386 exit sys_exit __ia32_sys_exit
2 i386 fork sys_fork __ia32_sys_fork
3 i386 read sys_read __ia32_sys_read
...