[LTP] [PATCH 4/6] Add ioctl_pidfd02 test

Cyril Hrubis chrubis@suse.cz
Fri Jun 27 11:53:52 CEST 2025


Hi!
> > > +	TST_EXP_EQ_LI(info->mask & PIDFD_INFO_EXIT, PIDFD_INFO_EXIT);
> > > +	TST_EXP_EQ_LI(WIFEXITED(info->exit_code), WIFEXITED(status));
> > > +	TST_EXP_EQ_LI(WEXITSTATUS(info->exit_code), WEXITSTATUS(status));
> > 
> > And here we should check that we got the same fields set as in the
> > previous case when the process was still running plus the exit_code.
> > 
> > I suppose that we will need two info structures so that we can do the
> > comparsion. Also it wouldn't harm to clear the structures with memset
> > before use.
> 
> Ah no, if task has been reaped only exit value is available. So in the
> latter case only the PIDFD_INFO_EXIT should be set in flags.

Uff and it's the same in both of the cases actually. Since the process
is cloned into new pid namespace, we can only get the return value.

So what we should check in the first case when the process is stil
running is that the PIDFD_INFO_EXIT flag is not set, since that
indicates that the exit_code has been filled in.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list