tst-syscall0.c 312 B

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