[LTP] [PATCH v1] Extract libclone from testcases/kernel/containers

Petr Vorel pvorel@suse.cz
Wed Feb 2 08:56:47 CET 2022


Hi Andrea,

[ Cc Richie, Li ]
https://lore.kernel.org/ltp/20220201142230.20243-1-andrea.cervesato@suse.de/

> libclone has been added to the libs folder and updated with the new
> LTP API. This library will be used by containers tests, which will be
> updated to the new LTP API as well.
I suppose you want to use it for containers (still use legacy API), which
already use it. I remember Richie not considering libclone.h as a good source
and suggesting to use SAFE_CLONE() for simple cases.

https://lore.kernel.org/ltp/878s7k59tk.fsf@suse.de/

We probably need some wrapper for containers, but we should recheck, whether
we want to take a different approach. Code in the functions is really a bit weird.

...
> +#ifndef SYS_unshare
> +#ifdef __NR_unshare
> +#define SYS_unshare __NR_unshare
> +#elif __i386__
> +#define SYS_unshare 310
> +#elif __ia64__
> +#define SYS_unshare 1296
> +#elif __x86_64__
> +#define SYS_unshare 272
> +#elif __s390x__ || __s390__
> +#define SYS_unshare 303
> +#elif __powerpc__
> +#define SYS_unshare 282
> +#else
> +#error "unshare not supported on this architecure."
> +#endif
> +#endif

nit: we usually put space before define for a readability.

#ifndef SYS_unshare
#ifdef __NR_unshare
# define SYS_unshare __NR_unshare
#elif __i386__
# define SYS_unshare 310
#elif __ia64__
# define SYS_unshare 1296
...

Kind regards,
Petr


More information about the ltp mailing list