1#!/bin/sh 2 3in="$1" 4arch="$2" 5 6syscall_macro() { 7 nr="$1" 8 name="$2" 9 10 echo " [$nr] = \"$name\"," 11} 12 13emit() { 14 nr="$1" 15 entry="$2" 16 17 syscall_macro "$nr" "$entry" 18} 19 20echo "static const char *syscalltbl_${arch}[] = {" 21 22sorted_table=$(mktemp /tmp/syscalltbl.XXXXXX) 23grep '^[0-9]' "$in" | sort -n > $sorted_table 24 25max_nr=0 26while read nr abi name entry compat; do 27 if [ $nr -ge 512 ] ; then # discard compat sycalls 28 break 29 fi 30 31 emit "$nr" "$name" 32 max_nr=$nr 33done < $sorted_table 34 35rm -f $sorted_table 36 37echo "};" 38 39echo "#define SYSCALLTBL_${arch}_MAX_ID ${max_nr}" 40