[PATCH v3 7/7] Add tests for PID namespace translation

Dmitry V. Levin ldv at altlinux.org
Sat Jul 25 22:30:11 UTC 2020


On Sat, Jul 25, 2020 at 01:12:43AM +0200, Ákos Uzonyi wrote:
[...]
> +#ifdef __NR_gettid
> +	a[3].pid = syscall(__NR_gettid);
> +#else
> +	a[3].pid_type = PT_NONE;
> +#endif

I think we can rely on __NR_gettid being universally available,
we already do in other tests.

[...]
> @@ -360,6 +402,10 @@ create_sample(void)
>  int
>  main(void)
>  {
> +#ifdef PIDNS_TRANSLATION
> +	pidns_test_init();
> +#endif
> +

I suppose we could have a macro, e.g. PIDNS_TEST_INIT, defined this way:

#ifdef PIDNS_TRANSLATION
# define PIDNS_TEST_INIT pidns_test_init()
#else
# define PIDNS_TEST_INIT do {} while (0)
#endif

This would allow a more simple usage:

	PIDNS_TEST_INIT;


-- 
ldv


More information about the Strace-devel mailing list