Comment by matheusmoreira

2 years ago

The manuals have the following pages on system calls:

https://www.man7.org/linux/man-pages/man2/syscall.2.html

https://www.man7.org/linux/man-pages/man2/syscalls.2.html

There are also the manual pages for each individual system call.

The syscall numbers unfortunately cannot be found in the manual. They are found in published tables on the internet.

They are defined in numerous locations in the Linux kernel tree. They are included via the linux/unistd.h header which in turn includes the appropriate asm-generic/ and asm/ headers.

https://github.com/torvalds/linux/blob/master/include/uapi/a...

https://github.com/torvalds/linux/blob/master/tools/arch/x86...

https://github.com/torvalds/linux/blob/master/tools/arch/x86...

https://github.com/torvalds/linux/blob/master/tools/arch/arm...

There's quite a bit of complexity here. The system call numbers are stable for each architecture but may differ between architectures. Some architectures have multiple historical versions of the same system call which are maintained for backwards compatibility, others have just the latest version of the relevant system call with the version number removed.

I assume this complexity is the reason why this information is not typically included. People expect you to rely on the libc which abstracts all this.