gen_bits_syscall_h.sh 911 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. #
  3. # June 27, 2001 Manuel Novoa III
  4. #
  5. # This script expects TOPDIR and CC (as used in the Makefiles) to be set in
  6. # the environment, and outputs the appropriate $TOPDIR/include/bits/syscall.h
  7. # corresponding to $TOPDIR/include/asm/unistd.h to stdout.
  8. #
  9. # Warning!!! This does _no_ error checking!!!
  10. UNISTD_H_PATH=$TOPDIR/include/asm/unistd.h
  11. ( echo "#include \"$UNISTD_H_PATH\"" ;
  12. $CC -E -dN $UNISTD_H_PATH | # needed to strip out any kernel-internal defines
  13. sed -ne 's/^[ ]*#define[ ]*__NR_\([A-Za-z0-9_]*\).*/UCLIBC_\1 __NR_\1/gp'
  14. ) |
  15. $CC -E - |
  16. ( echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" ; echo ;
  17. echo "#ifndef _SYSCALL_H" ;
  18. echo "# error \"Never use <bits/syscall.h> directly; include <sys/syscall.h> instead.\"" ;
  19. echo "#endif" ; echo ;
  20. sed -ne 's/^UCLIBC_\([A-Za-z0-9_]*\) *\(.*\)/#define SYS_\1 \2\
  21. #define __NR_\1 \2\
  22. #define __STR_NR_\1 \"\2\"/gp'
  23. )