[LTP] [PATCH v7 2/4] Add script to generate arch(s) dependant syscalls
Petr Vorel
pvorel@suse.cz
Thu Oct 31 14:58:14 CET 2024
Hi Andrea,
> --- /dev/null
> +++ b/include/lapi/syscalls/generate_arch.sh
> @@ -0,0 +1,211 @@
> +#!/bin/sh
Also here would be nice to use -eu (I know it's a script originated from
elsewhere)...
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +#
> +# This is an adaptation of the update-tables.sh script, included in the
> +# syscalls-table project (https://github.com/hrw/syscalls-table) and released
> +# under the MIT license.
> +#
> +# Author: Andrea Cervesato <andrea.cervesato@suse.com>
> +
> +KERNELSRC="$1"
... but that would require instead of this to check like this before using $1:
if [ $# -eq 0 ]
echo "Please provide kernel sources:"
echo ""
echo "$0 path/to/Linux/kernel/sources"
echo ""
exit 1
fi
Also running with dash I get failures:
$ ./include/lapi/syscalls/generate_arch.sh ../linux
...
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm/unistd*.h: No such file or directory
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm-generic/unistd.h: No such file or directory
./include/lapi/syscalls/generate_arch.sh: 73: [: 64: unexpected operator
./include/lapi/syscalls/generate_arch.sh: 85: /tmp/tmp.sVfa08a9De/list-syscalls: not found
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm/unistd*.h: No such file or directory
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm-generic/unistd.h: No such file or directory
./include/lapi/syscalls/generate_arch.sh: 73: [: 32: unexpected operator
./include/lapi/syscalls/generate_arch.sh: 85: /tmp/tmp.sVfa08a9De/list-syscalls: not found
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm/unistd*.h: No such file or directory
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm-generic/unistd.h: No such file or directory
./include/lapi/syscalls/generate_arch.sh: 73: [: 32: unexpected operator
/tmp/tmp.sVfa08a9De/list-syscalls.c: In function 'main':
/tmp/tmp.sVfa08a9De/list-syscalls.c:11:32: warning: missing terminating " character
11 | printf("_llseek %d
| ^
/tmp/tmp.sVfa08a9De/list-syscalls.c:12:1: warning: missing terminating " character
12 | ", __NR__llseek);
| ^
That fails in generate_table on:
if [ $bits == 32 ]; then
When I use "!/bin/sh -eux" I see:
make -s -C /home/foo/sources/linux ARCH=alpha O=/tmp/tmp.G3HzE6EnFu/headers headers_install
grep: /tmp/tmp.G3HzE6EnFu/headers/usr/include/asm/unistd*.h: No such file or directory
This looks like it requires to have build kernel before running this script,
right? (I have 6.12-rc4 in the kernel directory). As a result of running the
script are empty include/lapi/syscalls/*.in files.
Again, it can be a combination of some problem with my environment (some
variable set or shell setup) + dash as /bin/sh. Changing script to /bin/bash
fixes everything. It would be nice if anybody test it with installed dash and
!#/bin/dash in both scripts.
And successful run changes include/lapi/syscalls/arm.in:
+++ include/lapi/syscalls/arm.in
@@ -1,406 +1,415 @@
-restart_syscall (__NR_SYSCALL_BASE+ 0)
-exit (__NR_SYSCALL_BASE+ 1)
-fork (__NR_SYSCALL_BASE+ 2)
-read (__NR_SYSCALL_BASE+ 3)
...
+restart_syscall 0
+exit 1
+fork 2
+read 3
+write 4
Maybe we could update syscalls with generate_arch.sh after we merge this?
Kind regards,
Petr
More information about the ltp
mailing list