syscallhdr.sh 713 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. in="$1"
  3. out="$2"
  4. my_abis=`echo "($3)" | tr ',' '|'`
  5. prefix="$4"
  6. offset="$5"
  7. fileguard=_ASM_ARM_`basename "$out" | sed \
  8. -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
  9. -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
  10. if echo $out | grep -q uapi; then
  11. fileguard="_UAPI$fileguard"
  12. fi
  13. grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
  14. echo "#ifndef ${fileguard}"
  15. echo "#define ${fileguard} 1"
  16. echo ""
  17. while read nr abi name entry ; do
  18. if [ -z "$offset" ]; then
  19. echo "#define __NR_${prefix}${name} $nr"
  20. else
  21. echo "#define __NR_${prefix}${name} ($offset + $nr)"
  22. fi
  23. done
  24. echo ""
  25. echo "#endif /* ${fileguard} */"
  26. ) > "$out"