[PATCH v3 6/6] tests/pidfd_getfd.c: test decoding of targetfd

Dmitry V. Levin ldv at altlinux.org
Sun May 31 17:45:33 UTC 2020


On Sun, May 24, 2020 at 12:41:38PM +0200, Ákos Uzonyi wrote:
> * tests/pidfd_getfd.c (k_pidfd_getfd): rename argument: pid -> pidfd
> (main): test decoding of targetfd
> * tests/gen_tests.in: add "-e signal=none" argument to pidfd_getfd tests
> 
> Signed-off-by: Uzonyi Ákos <uzonyi.akos at gmail.com>
> ---
>  tests/gen_tests.in  |  6 +++---
>  tests/pidfd_getfd.c | 35 ++++++++++++++++++++++++++++++-----
>  2 files changed, 33 insertions(+), 8 deletions(-)
[...]
> @@ -62,12 +80,19 @@ main(void)
>  #else
>  	const char *pidfd_str = PIDFD_PATH;
>  #endif
> -	rc = k_pidfd_getfd(pidfd, 0, 0);
> -	printf("pidfd_getfd(%d%s, 0, 0) = %s%s\n",
> +	rc = k_pidfd_getfd(pidfd, dupfd, 0);
> +	printf("pidfd_getfd(%d%s, %d%s, 0) = %s%s\n",
>  	       pidfd, pidfd >= 0 ? pidfd_str : "",
> +	       dupfd, FD0_PATH,
>  	       errstr, rc >= 0 ? FD0_PATH : "");

This hunk didn't work well with pidfd < 0, so I changed
	dupfd, FD0_PATH,
to
	dupfd, pidfd >= 0 ? FD0_PATH : "",


-- 
ldv


More information about the Strace-devel mailing list