gen_bits_syscall_h.sh 1011 B

12345678910111213141516171819202122232425262728
  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 _BITS_SYSCALL_H" ;
  18. echo "#define _BITS_SYSCALL_H" ;
  19. echo "#ifndef _SYSCALL_H" ;
  20. echo "# error \"Never use <bits/syscall.h> directly; include <sys/syscall.h> instead.\"" ;
  21. echo "#endif" ; echo ;
  22. sed -ne 's/^UCLIBC_\([A-Za-z0-9_]*\) *\(.*\)/#define __NR_\1 \2\
  23. #define SYS_\1 __NR_\1\
  24. #define __STR_NR_\1 \"\2\"/gp'
  25. echo "#endif" ; echo ;
  26. )