diff mbox series

[1/1] regen.sh: tst_syscall(): Print again syscall number as string

Message ID 20220217184554.26915-1-pvorel@suse.cz
State Accepted
Headers show
Series [1/1] regen.sh: tst_syscall(): Print again syscall number as string | expand

Commit Message

Petr Vorel Feb. 17, 2022, 6:45 p.m. UTC
Before 4913b0b298 tst_syscall() printed:
TCONF: syscall(434) __NR_pidfd_open not supported

After 4913b0b298 tst_syscall() printed only numbers:
TCONF: syscall(434) 434 not supported on your arch

Constant was passed to TST_SYSCALL_BRK__() as a number thus
stringification didn't work as expected.

Fixes: 4913b0b298 ("lapi,kernel: Replace ltp_syscall with tst_syscall")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/lapi/syscalls/regen.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Yang Xu Feb. 18, 2022, 2:03 a.m. UTC | #1
Hi Petr

Obviously correct, pushed.

Best Regards
Yang Xu
> Before 4913b0b298 tst_syscall() printed:
> TCONF: syscall(434) __NR_pidfd_open not supported
>
> After 4913b0b298 tst_syscall() printed only numbers:
> TCONF: syscall(434) 434 not supported on your arch
>
> Constant was passed to TST_SYSCALL_BRK__() as a number thus
> stringification didn't work as expected.
>
> Fixes: 4913b0b298 ("lapi,kernel: Replace ltp_syscall with tst_syscall")
>
> Signed-off-by: Petr Vorel<pvorel@suse.cz>
> ---
>   include/lapi/syscalls/regen.sh | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/lapi/syscalls/regen.sh b/include/lapi/syscalls/regen.sh
> index 0b412ef6d9..3bf38fd034 100755
> --- a/include/lapi/syscalls/regen.sh
> +++ b/include/lapi/syscalls/regen.sh
> @@ -36,14 +36,14 @@ cat<<  EOF>  "${output_pid}"
>   #include "cleanup.c"
>
>   #ifdef TST_TEST_H__
> -#define TST_SYSCALL_BRK__(NR) ({ \\
> +#define TST_SYSCALL_BRK__(NR, SNR) ({ \\
>   	tst_brk(TCONF, \\
> -		"syscall(%d) " #NR " not supported on your arch", NR); \\
> +		"syscall(%d) " SNR " not supported on your arch", NR); \\
>   })
>   #else
> -#define TST_SYSCALL_BRK__(NR) ({ \\
> +#define TST_SYSCALL_BRK__(NR, SNR) ({ \\
>   	tst_brkm(TCONF, CLEANUP, \\
> -		"syscall(%d) " #NR " not supported on your arch", NR); \\
> +		"syscall(%d) " SNR " not supported on your arch", NR); \\
>   })
>   #endif
>
> @@ -56,7 +56,7 @@ cat<<  EOF>  "${output_pid}"
>   		tst_ret = syscall(NR, ##__VA_ARGS__); \\
>   	} \\
>   	if (tst_ret == -1&&  errno == ENOSYS) { \\
> -		TST_SYSCALL_BRK__(NR); \\
> +		TST_SYSCALL_BRK__(NR, #NR); \\
>   	} \\
>   	tst_ret; \\
>   })
diff mbox series

Patch

diff --git a/include/lapi/syscalls/regen.sh b/include/lapi/syscalls/regen.sh
index 0b412ef6d9..3bf38fd034 100755
--- a/include/lapi/syscalls/regen.sh
+++ b/include/lapi/syscalls/regen.sh
@@ -36,14 +36,14 @@  cat << EOF > "${output_pid}"
 #include "cleanup.c"
 
 #ifdef TST_TEST_H__
-#define TST_SYSCALL_BRK__(NR) ({ \\
+#define TST_SYSCALL_BRK__(NR, SNR) ({ \\
 	tst_brk(TCONF, \\
-		"syscall(%d) " #NR " not supported on your arch", NR); \\
+		"syscall(%d) " SNR " not supported on your arch", NR); \\
 })
 #else
-#define TST_SYSCALL_BRK__(NR) ({ \\
+#define TST_SYSCALL_BRK__(NR, SNR) ({ \\
 	tst_brkm(TCONF, CLEANUP, \\
-		"syscall(%d) " #NR " not supported on your arch", NR); \\
+		"syscall(%d) " SNR " not supported on your arch", NR); \\
 })
 #endif
 
@@ -56,7 +56,7 @@  cat << EOF > "${output_pid}"
 		tst_ret = syscall(NR, ##__VA_ARGS__); \\
 	} \\
 	if (tst_ret == -1 && errno == ENOSYS) { \\
-		TST_SYSCALL_BRK__(NR); \\
+		TST_SYSCALL_BRK__(NR, #NR); \\
 	} \\
 	tst_ret; \\
 })