[LTP] [PATCH v5] Introduce ioctl_pidfd_get_info_supported() function

Petr Vorel pvorel@suse.cz
Thu Sep 25 13:45:55 CEST 2025


Hi Avinesh,

...
> +static inline int ioctl_pidfd_get_info_supported(void)

nit: I liked more the previous version v4, where 'bool' was used.
Actually both functions could use 'bool', but I'm perfectly ok with 'int'.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

> +{
> +	pid_t pid;
> +	int pidfd, ret;
> +	int supported = 0;
> +	struct pidfd_info info;
> +
> +	if (tst_kvercmp(6, 13, 0) >= 0)
> +		return 1;
> +
> +	memset(&info, 0, sizeof(struct pidfd_info));
> +
> +	pid = SAFE_FORK();
> +	if (!pid)
> +		exit(100);
> +
> +	pidfd = SAFE_PIDFD_OPEN(pid, 0);
> +
> +	ret = ioctl(pidfd, PIDFD_GET_INFO, &info);
> +	SAFE_WAITPID(pid, NULL, 0);
> +
> +	if (ret != -1)
> +		supported = 1;
> +
> +	SAFE_CLOSE(pidfd);
> +	return supported;
> +}


More information about the ltp mailing list