str_syscalls.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  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__ioctl __NR_ioctl"
  11. echo "#define __NR__fcntl __NR_fcntl"
  12. echo "#define __NR__reboot __NR_reboot"
  13. echo "#define __NR__mmap __NR_mmap"
  14. echo "#define __NR__syslog __NR_syslog"
  15. echo "#define __NR__stat __NR_stat"
  16. echo "#define __NR__lstat __NR_lstat"
  17. echo "#define __NR__fstat __NR_fstat"
  18. echo "#define __NR__getdents __NR_getdents"
  19. echo
  20. sed -ne 's/^.*_syscall[0-9].*([^,]*, *\([^,)]*\).*/printf("#define __STR_NR_\1 \\\"%d\\\"\\n", __NR_\1);/gp' syscalls.c
  21. echo
  22. echo "printf(\"#define __STR_NR_exit __STR_NR__exit\n\");"
  23. echo "printf(\"#define __STR_NR_open __STR_NR___open\n\");"
  24. echo "printf(\"#define __STR_NR_ioctl __STR_NR__ioctl\n\");"
  25. echo "printf(\"#define __STR_NR_fcntl __STR_NR__fcntl\n\");"
  26. echo "printf(\"#define __STR_NR_reboot __STR_NR__reboot\n\");"
  27. echo "printf(\"#define __STR_NR_mmap __STR_NR__mmap\n\");"
  28. echo "printf(\"#define __STR_NR_syslog __STR_NR__syslog\n\");"
  29. echo "printf(\"#define __STR_NR_stat __STR_NR__stat\n\");"
  30. echo "printf(\"#define __STR_NR_lstat __STR_NR__lstat\n\");"
  31. echo "printf(\"#define __STR_NR_fstat __STR_NR__fstat\n\");"
  32. echo "printf(\"#define __STR_NR_getdents __STR_NR__getdents\n\");"
  33. echo
  34. echo "return EXIT_SUCCESS; }"