The right way to do this on linux is shown in the syscall(2) manual page (see for example http://man7.org/linux/man-pages/man2/syscall.2.html):
#include <unistd.h>
#include <sys/syscall.h>
possibly with a preceding "#define _GNU_SOURCE" or other system specifier, though that doesn't seem to be necessary on my system. The <sys/syscall.h>
file actually includes <asm/unistd.h>
. This provides the SYS_syscall definition as well as __NR_syscall