[LTP] [PATCH v3 8/8] Add ioctl_pidfd06 test
Cyril Hrubis
chrubis@suse.cz
Wed Jul 23 15:08:50 CEST 2025
Hi!
> +static void run(void)
> +{
> + int pidfd;
> + pid_t pid_child;
> +
> + memset(args, 0, sizeof(struct tst_clone_args));
> + memset(info, 0, sizeof(struct pidfd_info));
> +
> + info->mask = PIDFD_INFO_EXIT;
> +
> + args->flags = CLONE_PIDFD | CLONE_NEWUSER | CLONE_NEWPID;
> + args->pidfd = (uint64_t)&pidfd;
> + args->exit_signal = SIGCHLD;
> +
> + pid_child = SAFE_CLONE(args);
> + if (!pid_child)
> + exit(100);
> +
> + SAFE_WAITPID(pid_child, NULL, 0);
> +
> + memset(args, 0, sizeof(struct tst_clone_args));
> +
> + args->flags = CLONE_NEWUSER | CLONE_NEWPID;
> + args->exit_signal = SIGCHLD;
> +
> + if (!SAFE_CLONE(args)) {
> + TST_EXP_FAIL(ioctl(pidfd, PIDFD_GET_INFO, info), ESRCH);
> + exit(0);
> + }
SAFE_CLOSE(pid_child) here?
Otherwise we end up out of file descriptors with large enough -i
parameter.
Otherwise:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list