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

[email protected]
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
July 14, 2026 at 7:08 PM, "Andrea Cervesato" <andrea.cervesato-IBi9RG/[email protected] mailto:andrea.cervesato-IBi9RG/[email protected]?to=%22Andrea%20Cervesato%22%20%3Candrea.cervesato%40suse.com%3E > wrote:


> 
> Hi Gang,
> 
> > 
> > From: Gang Yan <yangang-UOlijcLmZ/[email protected]>
> >  
> >  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-UOlijcLmZ/[email protected]>
> >  ---
> >  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; \
> >  +})
> > 
Hi Andrea,

Thanks for your review.

> 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.

You are right. I've confirmed that syscall(-1) returning a positive
value is a glibc or kernel bug on loongarch64, syscall(-1) should return
-1, but return 38 (ENONSYS) in my enviroment. It is not something LTP should
work around.


> 
> 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.
>

Thanks again

Cherrs
Gang 
> Regards,
> --
> Andrea Cervesato
> SUSE QE Automation Engineer Linux
> andrea.cervesato-IBi9RG/[email protected] mailto:andrea.cervesato-IBi9RG/[email protected]
>

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.