[LTP] [PATCH 2/3] generate_syscall.sh: add a helper named tst_syscall_base

Andrea Cervesato andrea.cervesato@suse.com
Tue Jul 14 13:08:11 CEST 2026


Hi Gang,

> From: Gang Yan <yangang@kylinos.cn>
> 
> This patch adds a helper named tst_syscall_base, it can check the
> syscall on older distros without tst_brk.
> 
> Signed-off-by: Gang Yan <yangang@kylinos.cn>
> ---
>  include/lapi/syscalls/generate_syscalls.sh | 27 +++++++++++++---------
>  1 file changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/include/lapi/syscalls/generate_syscalls.sh b/include/lapi/syscalls/generate_syscalls.sh
> index 19f280dfb..95c2c9aeb 100755
> --- a/include/lapi/syscalls/generate_syscalls.sh
> +++ b/include/lapi/syscalls/generate_syscalls.sh
> @@ -49,18 +49,23 @@ tst_brkm(TCONF, dummy_cleanup, \
>  })
>  #endif
>  
> +#define tst_syscall_base(NR, ...) ({ \
> +    intptr_t tst_ret; \
> +    if (NR == __LTP__NR_INVALID_SYSCALL) { \
> +        errno = ENOSYS; \
> +        tst_ret = -1; \
> +    } else { \
> +        tst_ret = syscall(NR, ##__VA_ARGS__); \
> +    } \
> +    tst_ret; \
> +})

Do we really need this? If we don't define memfd_secret, we really want
to get a TCONF. And the function is used in a weird way.

If you need to add the support for memfd_secret, please just update the
syscalls files via:

./include/lapi/syscalls/generate_arch.sh <path to linux sources>

We don't update .in files manually since it's error prone.

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list