1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <stdio.h> #include <unistd.h> #include <sys/syscall.h> #ifndef SYS_getpid #define _SYS_call0 SYS_getxpid #else #define _SYS_call0 SYS_getpid #endif int main() { int pid; pid = syscall(_SYS_call0); if (pid > 0) { printf("syscall(SYS_getpid) says %d\n", pid); return 0; } return 1; }