gen_bits_syscall_h.sh 983 B

123456789101112131415161718192021222324252627
  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/gp'
  24. echo "#endif" ; echo ;
  25. )