[LTP] [PATCH v5 1/3] Refactor regen.sh script to generate syscalls

Andrea Cervesato andrea.cervesato@suse.com
Wed Oct 30 15:20:58 CET 2024


Hi Cyril,

On 10/30/24 14:47, Cyril Hrubis wrote:
> Hi!
>> +(
>> +	echo
>> +	echo "/* Common stubs */"
>> +	while IFS= read -r arch; do
>> +		while IFS= read -r line; do
>> +			set -- ${line}
>> +			syscall_nr="__NR_$1"
>> +			shift
>> +
>> +			echo "# ifndef ${syscall_nr}"
>> +			echo "#  define ${syscall_nr} __LTP__NR_INVALID_SYSCALL"
>> +			echo "# endif"
>> +		done <"${SCRIPT_DIR}/${arch}.in"
>> +	done <${SUPPORTED_ARCH}
>> +	echo "#endif"
>> +) >>${SYSCALLS_FILE}
> This will generate multiple fallback definitions, one per architecture
> for common syscall, there was a good reason why these files were parsed
> by awk with sort -u
I wrote the code a few weeks ago, so I needed to read it again to 
understand the reason.

If you take a look at the drop_bad_entries() and generate_tables() you 
will see that `sort` command is used to remove duplicates and to sort 
the entire list per architecture.

Or am I missing something?

>> -echo "#define __LTP__NR_INVALID_SYSCALL -1" >> "${output_pid}"
>> -for nr in $(awk '{print $1}' "${srcdir}/"*.in | sort -u) ; do
> This is the important part that IMHO should stay.
>
Andrea


More information about the ltp mailing list