str_syscalls.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. echo "#include <stdio.h>"
  3. echo "#include <stdlib.h>"
  4. echo "#include \"../include/asm/unistd.h\""
  5. echo
  6. echo "int main(void) {"
  7. echo
  8. echo "#define __NR__exit __NR_exit"
  9. echo "#define __NR___open __NR_open"
  10. echo "#define __NR___ipc __NR_ipc"
  11. echo "#define __NR__ioctl __NR_ioctl"
  12. echo "#define __NR__fcntl __NR_fcntl"
  13. echo "#define __NR__reboot __NR_reboot"
  14. echo "#define __NR__mmap __NR_mmap"
  15. echo "#define __NR__syslog __NR_syslog"
  16. echo "#define __NR___stat __NR_stat"
  17. echo "#define __NR___lstat __NR_lstat"
  18. echo "#define __NR___fstat __NR_fstat"
  19. echo "#define __NR__getdents __NR_getdents"
  20. echo "#define __NR___ptrace __NR_ptrace"
  21. echo
  22. sed -ne 's/^[^\/]*_syscall[0-9].*([^,]*, *\([^,)]*\).*/printf("#define __STR_NR_\1 \\\"%d\\\"\\n", __NR_\1);/gp' syscalls.c
  23. echo
  24. echo "printf(\"#define __STR_NR_exit __STR_NR__exit\n\");"
  25. echo "printf(\"#define __STR_NR_open __STR_NR___open\n\");"
  26. echo "printf(\"#define __STR_NR_ioctl __STR_NR__ioctl\n\");"
  27. echo "printf(\"#define __STR_NR_fcntl __STR_NR__fcntl\n\");"
  28. echo "printf(\"#define __STR_NR_reboot __STR_NR__reboot\n\");"
  29. echo "printf(\"#define __STR_NR_mmap __STR_NR__mmap\n\");"
  30. echo "printf(\"#define __STR_NR_syslog __STR_NR__syslog\n\");"
  31. #echo "printf(\"#define __STR_NR_getdents __STR_NR__getdents\n\");"
  32. echo
  33. echo "return EXIT_SUCCESS; }"