test: optimise fd closing in forks
authorKrzysztof Kanas <kkanas@marvell.com>
Tue, 12 Nov 2019 20:31:02 +0000 (21:31 +0100)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 15 Nov 2019 08:35:20 +0000 (09:35 +0100)
commit18562261abadfbdf7e19006c381bcb1d6fd6c2fe
tree3d250b328c184cd2be17491065f2aaf7033555bb
parentd25ab4b7f128610cb5310b424c1f608686173f13
test: optimise fd closing in forks

Caught while investigating timeouts on a ARM64 server.

Stracing a test process running the eal_flags_autotest, we can see that
the fork helper is checking all possible file descriptors from
getdtablesize() to 2, and close the existing ones.
We can do better by inspecting this forked process /proc/self/fd
directory.

Besides, checking file descriptors via /proc/self/fd only makes sense for
Linux. This code was a noop on FreeBSD.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Tested-by: Krzysztof Kanas <kkanas@marvell.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
app/test/process.h