[LTP] [PATCH v2 1/2] syscalls/pidfd_open01.c: Add check for close-on-exec flag
Petr Vorel
pvorel@suse.cz
Wed May 13 12:30:32 CEST 2020
Hi Yang,
> Thanks a lot for your quick reply.
Thanks for a patience (we're not working just on LTP unfortunately).
> Resetting errno may not necessary because errno will be set again when
> fd == -1.
Agree, I'm just careful, thus asking :).
> > > 2) tst_syscall() is enough to check the support of pidfd_open() and I
> > > don't want to define check function as fsopen_supported_by_kernel()
> > > does.
> > > Do you think so?
> > > BTW:
> > > I don't like the implementation of fsopen_supported_by_kernel():
> > > a) syscall()/tst_syscall() is enough to check the support of
> > > pidfd_open(2) and 'tst_kvercmp(5, 2, 0))< 0' will skip the check if
> > +1 for tst_syscall()
> > > a kernel on distribution is newer than v5.2 but drop the support of
> > > pidfd_open(2) on purpose.
> > "drop support of pidfd_open(2) on purpose": would anybody has a reason to do
> > that?
> As my pervious mail said, It is just a possible situation, for example:
> Upstream kernel introduces btrfs filesystem long long ago but the
> kernel of RHEL8 drops btrfs filesystem because of some reasons.
I guess filesystem changes are the most frequent. But as I said, I wouldn't mind
this implementation:
void fsopen_supported_by_kernel(void)
{
TEST(tst_syscall(__NR_fsopen, NULL, 0));
if (TST_RET != -1)
SAFE_CLOSE(TST_RET);
}
> It is just a reason used to explain why I want to drop the kernel version
> check.
...
> > How about to call the function pidfd_open_supported_by_kernel()?
> OK
> > Than you can remove the comment (which BTW should use C style /* */).
> OK
> > And IMHO you don't have to assign pidfd to -1.
> In pidfd_open_supported_by_kernel(), do you want to drop 'pidfd = -1'
> directly or drop 'pidfd = -1' by using TEST()?
I meant (as it's always assigned by the call, it's just a nit.):
-int pidfd = -1;
+int pidfd;
Kind regards,
Petr
More information about the ltp
mailing list