Skip to content

Commit

Permalink
Rename syscalls order file to supported-arch.txt
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
  • Loading branch information
acerv committed Sep 23, 2024
1 parent aa811ca commit 09489a8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 45 deletions.
88 changes: 44 additions & 44 deletions include/lapi/syscalls/regen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ err() {
exit 1
}

cat << EOF > "${output_pid}"
cat <<EOF >"${output_pid}"
/************************************************
* GENERATED FILE: DO NOT EDIT/PATCH THIS FILE *
* change your arch specific .in file instead *
Expand Down Expand Up @@ -65,65 +65,65 @@ inline static void dummy_cleanup(void) {}
EOF

jobs=0
for arch in $(cat "${srcdir}/order") ; do
for arch in $(cat "${srcdir}/supported-arch.txt"); do
(
echo "Generating data for arch $arch ... "

(
echo
case ${arch} in
sparc64) echo "#if defined(__sparc__) && defined(__arch64__)" ;;
sparc) echo "#if defined(__sparc__) && !defined(__arch64__)" ;;
s390) echo "#if defined(__s390__) && !defined(__s390x__)" ;;
mips_n32) echo "#if defined(__mips__) && defined(_ABIN32)" ;;
mips_n64) echo "#if defined(__mips__) && defined(_ABI64)" ;;
mips_o32) echo "#if defined(__mips__) && defined(_ABIO32) && _MIPS_SZLONG == 32" ;;
*) echo "#ifdef __${arch}__" ;;
esac
while read line ; do
set -- ${line}
nr="__NR_$1"
shift
if [ $# -eq 0 ] ; then
err "invalid line found: $line"
fi
echo "# ifndef ${nr}"
echo "# define ${nr} $*"
echo "# endif"
done < "${srcdir}/${arch}.in"
echo "#endif"
echo
) >> "${output_pid}.${arch}"
echo "Generating data for arch $arch ... "

(
echo
case ${arch} in
sparc64) echo "#if defined(__sparc__) && defined(__arch64__)" ;;
sparc) echo "#if defined(__sparc__) && !defined(__arch64__)" ;;
s390) echo "#if defined(__s390__) && !defined(__s390x__)" ;;
mips_n32) echo "#if defined(__mips__) && defined(_ABIN32)" ;;
mips_n64) echo "#if defined(__mips__) && defined(_ABI64)" ;;
mips_o32) echo "#if defined(__mips__) && defined(_ABIO32) && _MIPS_SZLONG == 32" ;;
*) echo "#ifdef __${arch}__" ;;
esac
while read line; do
set -- ${line}
nr="__NR_$1"
shift
if [ $# -eq 0 ]; then
err "invalid line found: $line"
fi
echo "# ifndef ${nr}"
echo "# define ${nr} $*"
echo "# endif"
done <"${srcdir}/${arch}.in"
echo "#endif"
echo
) >>"${output_pid}.${arch}"

) &

jobs=$(( jobs + 1 ))
if [ ${jobs} -ge ${max_jobs} ] ; then
jobs=$((jobs + 1))
if [ ${jobs} -ge ${max_jobs} ]; then
wait || exit 1
jobs=0
fi
done

echo "Generating stub list ... "
(
echo
echo "/* Common stubs */"
echo "#define __LTP__NR_INVALID_SYSCALL -1" >> "${output_pid}"
for nr in $(awk '{print $1}' "${srcdir}/"*.in | sort -u) ; do
nr="__NR_${nr}"
echo "# ifndef ${nr}"
echo "# define ${nr} __LTP__NR_INVALID_SYSCALL"
echo "# endif"
done
echo "#endif"
) >> "${output_pid}._footer"
echo
echo "/* Common stubs */"
echo "#define __LTP__NR_INVALID_SYSCALL -1" >>"${output_pid}"
for nr in $(awk '{print $1}' "${srcdir}/"*.in | sort -u); do
nr="__NR_${nr}"
echo "# ifndef ${nr}"
echo "# define ${nr} __LTP__NR_INVALID_SYSCALL"
echo "# endif"
done
echo "#endif"
) >>"${output_pid}._footer"

wait || exit 1

printf "Combining them all ... "
for arch in $(cat "${srcdir}/order") _footer ; do
for arch in $(cat "${srcdir}/supported-arch.txt") _footer; do
cat "${output_pid}.${arch}"
done >> "${output_pid}"
done >>"${output_pid}"
mv "${output_pid}" "../${output}"
rm -f "${output_pid}"*
echo "OK!"
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ loongarch
mips_n32
mips_n64
mips_o32
powerpc64
powerpc
s390x
s390
Expand Down

0 comments on commit 09489a8

Please sign in to comment.