Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: Re: [hwloc-devel] [PATCH] Use getmntent_r(3) to parse /proc/mounts lines
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2010-03-11 18:03:37

Bert Wesarg wrote:
> This does multiple things at once:
> I) it uses getmntent_r(3) to parse lines from /proc/mounts
> II) while doing this, it uses the correct un-escape rules for this
> file format.
> The current code converts "\ " to " ", while linux uses a "\040" to
> " " escaping rule.
> III) it accurately finds the cpuset option for a cgroups mount point.
> The current code would fail if "cpuset" would be a substring
> of an other mount option.

Did you actually test this ? The way I am reading the manpage is that
you need to open with setmntent and close with endmntent.

Also, isn't getmntent (without _r) enough here?

And finally, it seems to me that hasmntopt is probably the best way to
look for the 'cpuset' option.

Thanks a lot for the patch anyway, we should probably use something like
this instead of my manual parsing code. I see some potential configure
problems on HP-UX in Google, I might put the configure checks inside "if
Linux". We might even not need any configure checks since only Linux
uses all this so far. I'll play with all this tomorrow and probably
commit something.