Alternate implementation of fd iteration for Linux.
It looks like std::filesystem::directory_iterator
, introduced in #32343, has an intermittent issue that causes a hang of the CI (#32524). i have not been able to reproduce this locally, and the CI situation makes it difficult to get more details about the problem.
So to work around that, this PR replaces the use of directory_iterator
with the equivalent POSIX opendir
/readdir
//closedir
usage. It is only slightly more verbose. In all testing up to now this appears to make the problem go away.