[LTP] [PATCH 4/5] Add pidfd_getfd01 test

Petr Vorel pvorel@suse.cz
Fri Feb 18 08:02:42 CET 2022


Hi Richie, Xu,

> Hi Petr
> > Hi Xu,

> > ...
> >> +++ b/testcases/kernel/syscalls/pidfd_getfd/pidfd_getfd01.c
> > ...
> >> +	remotefd = TST_RET;
> >> +	flag = fcntl(remotefd, F_GETFD);
> >> +	if (flag == -1)
> >> +		tst_brk(TFAIL | TERRNO, "fcntl(F_GETFD) failed");
> > Just:
> > flag = SAFE_FCNTL(remotefd, F_GETFD);
> Yes, I almost forgot we have this macro.
@Richie: It'd be useful if sparse checks would suggest to use SAFE_*()
functions, but not sure if easily detectable. Something like setup() and
cleanup() function and syscall followed by if (foo == -1) followed by tst_brk().

Kind regards,
Petr


More information about the ltp mailing list