Merge tag 'linux-kselftest-kunit-fixes-5.11-rc3' of git://git.kernel.org/pub/scm...
[linux/fpc-iii.git] / arch / mips / kernel / syscalls / syscallnr.sh
blob60bbdb3fe03abe06184f950259cf1e5f017b01a6
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
4 in="$1"
5 out="$2"
6 my_abis=`echo "($3)" | tr ',' '|'`
7 prefix="$4"
8 offset="$5"
10 fileguard=_UAPI_ASM_MIPS_`basename "$out" | sed \
11 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
12 -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
13 grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
14 printf "#ifndef %s\n" "${fileguard}"
15 printf "#define %s\n" "${fileguard}"
16 printf "\n"
18 nxt=0
19 while read nr abi name entry compat ; do
20 nxt=$((nr+1))
21 done
23 printf "#define __NR_%s_Linux\t%s\n" "${prefix}" "${offset}"
24 printf "#define __NR_%s_Linux_syscalls\t%s\n" "${prefix}" "${nxt}"
25 printf "\n"
26 printf "#endif /* %s */" "${fileguard}"
27 printf "\n"
28 ) > "$out"