gensyscalls.sh 653 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. #
  3. # gensyscalls.sh
  4. # Usage: ./gensyscalls.sh < syscalls.h
  5. #
  6. # Parses the kernel's syscalls.h into the body of syscalls.S
  7. #
  8. # tabs to spaces, just in case
  9. tr '\t' ' ' |\
  10. awk '
  11. # Do not read the parts of the file that are not between the markers.
  12. /^\/\*CALLBEGIN\*\// { look=1; }
  13. /^\/\*CALLEND\*\// { look=0; }
  14. # And, do not read lines that do not match the approximate right pattern.
  15. look && /^#define SYS_/ && NF==3 {
  16. sub("^SYS_", "", $2);
  17. # print the name of the call and the number.
  18. print $2, $3;
  19. }
  20. ' | awk '{
  21. # output something simple that will work in syscalls.S.
  22. printf "SYSCALL(%s, %s)\n", $1, $2;
  23. }'