[LTP] [PATCH v1] Replace ltp_syscall with tst_syscall

Cyril Hrubis chrubis@suse.cz
Mon Jan 24 15:44:47 CET 2022


Hi!
> diff --git a/include/lapi/syscalls/regen.sh b/include/lapi/syscalls/regen.sh
> index d7daf8ad0..8fa381c97 100755
> --- a/include/lapi/syscalls/regen.sh
> +++ b/include/lapi/syscalls/regen.sh
> @@ -35,34 +35,30 @@ cat << EOF > "${output_pid}"
>  #include <asm/unistd.h>
>  #include "cleanup.c"
>  
> -#define ltp_syscall(NR, ...) ({ \\
> -	int __ret; \\
> -	if (NR == __LTP__NR_INVALID_SYSCALL) { \\
> -		errno = ENOSYS; \\
> -		__ret = -1; \\
> -	} else { \\
> -		__ret = syscall(NR, ##__VA_ARGS__); \\
> -	} \\
> -	if (__ret == -1 && errno == ENOSYS) { \\
> -		tst_brkm(TCONF, CLEANUP, \\
> -			"syscall(%d) " #NR " not supported on your arch", \\
> -			NR); \\
> -	} \\
> -	__ret; \\
> +#ifdef TST_TEST_H__
> +#define TST_SYSCALL_BRK__(NR) ({ \
> +	tst_brk(TCONF, \
> +		"syscall(%d) " #NR " not supported on your arch", NR); \
>  })
> -
> -#define tst_syscall(NR, ...) ({ \\
> -	int tst_ret; \\
> -	if (NR == __LTP__NR_INVALID_SYSCALL) { \\
> -		errno = ENOSYS; \\
> -		tst_ret = -1; \\
> -	} else { \\
> -		tst_ret = syscall(NR, ##__VA_ARGS__); \\
> -	} \\
> -	if (tst_ret == -1 && errno == ENOSYS) { \\
> -		tst_brk(TCONF, "syscall(%d) " #NR " not supported", NR); \\
> -	} \\
> -	tst_ret; \\
> +#else
> +#define TST_SYSCALL_BRK__(NR) ({ \
> +	tst_brkm(TCONF, CLEANUP, \
> +		"syscall(%d) " #NR " not supported on your arch", NR); \
> +})
> +#endif
> +
> +#define tst_syscall(NR, ...) ({ \
> +	int tst_ret; \
> +	if (NR == __LTP__NR_INVALID_SYSCALL) { \
> +		errno = ENOSYS; \
> +		tst_ret = -1; \
> +	} else { \
> +		tst_ret = syscall(NR, ##__VA_ARGS__); \
> +	} \
> +	if (tst_ret == -1 && errno == ENOSYS) { \
> +		TST_SYSCALL_BRK__(NR); \
> +	} \
> +	tst_ret; \
>  })

Can we please keep the double backslashes here?

Both of them works, but if you put single backslash here into the script
the macro is put into one long line into the generated header, which is
really hard to decipher. With two the macro is split into lines as it
should be.

Other than that it looks good and simplifies a some of the places.

With the backslashes fixed:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list