[LTP] [PATCH v4 2/4] Add script to generate arch(s) dependant syscalls

Andrea Cervesato andrea.cervesato@suse.com
Wed Oct 30 09:40:17 CET 2024


Hi Petr,

On 10/25/24 12:20, Petr Vorel wrote:
> Hi Andrea,
>
>> Add generate_arch.sh script which can be used to generate arch(s)
>> dependant syscalls file. The way it works is pretty simple: for each
>> architecture defined into supported-arch.txt, compile kernel headers,
>> extract the list of syscalls and generate a .in file containing all of
>> them, associated with their own syscall's number.
> Nice improvement, thanks!
>
>> The way syscalls files are generated, passes through a C application
>> which is automatically checking the availability of the syscalls in
>> the user space environment.
> This C application is in the Linux kernel and we only consume the result right?
>
> If the C app was needed to be run for LTP, that would broke LTP cross compilation.
> (There are people compiling LTP with cross compilation, e.g. arm folks in yocto
> and Buildroot, riscv64 on openSUSE Tumbleweed).
The application is auto generated and compiled by this script during 
syscalls files generation. It's the same approach syscalls-table project 
is using 
https://github.com/hrw/syscalls-table/blob/master/scripts/update-tables.sh#L69
>> diff --git a/include/lapi/syscalls/generate_arch.sh b/include/lapi/syscalls/generate_arch.sh
>> new file mode 100755
>> index 000000000..abdb52256
>> --- /dev/null
>> +++ b/include/lapi/syscalls/generate_arch.sh
>> @@ -0,0 +1,205 @@
>> +#!/bin/sh
>> +#
>> +# 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>
> nit: I would still use some SPDX + copyright here.
Sure
>
>> +
>> +KERNELSRC=$1
> Generally all shell variables should be quoted to avoid problems with space.
> Feel free to do that before merge.
>
> KERNELSRC="$1"
>
>> +
>> +# to keep sorting in order
>> +export LC_ALL=C
>> +
>> +if [ -z $KERNELSRC ]; then
> Also here and on other places.
>
> if [ -z "$KERNELSRC" ]; then
>
> Try run script with:
> KERNELSRC="foo bar"
>
> [: aa: unexpected operator
>
> Kind regards,
> Petr

Good point.

Andrea



More information about the ltp mailing list