[PATCH 2/3] generate_syscall.sh: add a helper named tst_syscall_base
Gang Yan <[email protected]>
| Newsgroups | gmane.linux.ltp |
|---|---|
| Message-ID | <[email protected]> |
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; \ +}) + #define tst_syscall(NR, ...) ({ \ -intptr_t 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, #NR); \ -} \ -tst_ret; \ + intptr_t tst_ret = tst_syscall_base(NR, ##__VA_ARGS__); \ + if (tst_ret == -1 && errno == ENOSYS) { \ + TST_SYSCALL_BRK__(NR, #NR); \ + } \ + tst_ret; \ }) #define __LTP__NR_INVALID_SYSCALL -1' >${SYSCALLS_FILE} -- 2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp