Le 21/11/2010 20:34, Christopher Samuel a écrit :
> In look_powerpc_device_tree() I did similar and found that it
> never proceeds past this loop:
>
>     if (('.' == dirent->d_name[0]) || (0 == (dirent->d_type & DT_DIR)))
>       continue;
>
> Adding some debugging to print the name and type and whether
> they were used or skipped I see that when it fails the
> dirent->d_type is always '0', but when it works it's '4'.
>
> The manual page for readdir(3) says:
>
> #  Currently,  only  some  file  systems  (among them: Btrfs,
> #  ext2, ext3, and ext4) have full support returning the file
> #  type in d_type.   All  applications must properly handle
> #  a return of DT_UNKNOWN.
>
> So I'm guessing that reiserfs and GPFS (both of which are
> available on this PPC64 box) are returning DT_UNKNOWN (0).
>
> So the above loop will need to catch that and, if it is
> DT_UNKNOWN, do a stat or lstat on the entry to find out
> what it is. :-(

Awesome! Thanks a looooot Chris. Can you remove your debugging stuff, my
debug patch, and apply the attached patch. What it does is:
* gather empty dirs in hwloc-gather-topology (already pushed to trunk)
* don't use sysfs when cpu0/topology contains nothing (pushed too)
* use stat.st_mode instead of dirent->d_type (seems to not break
anything in our standard PPC tarballs, but needs more testing)

I hope make check works now. And "lstopo" with and without the
HWLOC_FSROOT should also both use the cpuinfo code (you should see "*
Topology extraction from /proc/cpuinfo *" very early in the debug output).

Brice

Reply via email to