From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] Replace ltp_syscall with tst_syscall
Date: Mon, 24 Jan 2022 15:44:47 +0100 [thread overview]
Message-ID: <Ye67X6D1TprHrHcF@yuki> (raw)
In-Reply-To: <20220119152732.21189-1-andrea.cervesato@suse.de>
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2022-01-24 14:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 15:27 [LTP] [PATCH v1] Replace ltp_syscall with tst_syscall Andrea Cervesato
2022-01-20 12:16 ` Petr Vorel
2022-01-20 12:30 ` Andrea Cervesato via ltp
2022-01-20 12:41 ` Petr Vorel
2022-01-24 14:44 ` Cyril Hrubis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ye67X6D1TprHrHcF@yuki \
--to=chrubis@suse.cz \
--cc=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox