As per Jérôme Duval's code review in issue #9337.
This replaces the use of a few BSD-specific functions, as well as the direct references to _open/_close et-al. BFS doesn't support the FTS_NOSTAT directory link count optimization, and no statfs() function is available, so we simply turn that off.