Perform fewer lstat()s on systems that support d_type (ie most Linux
systems), in order to speed up certain operations.