Re: [hwloc-devel] [PATCH] Use getmntent_r(3) to parse /proc/mounts lines

2010-03-12 Thread Bert Wesarg
On Fri, Mar 12, 2010 at 08:45, Brice Goglin wrote: > I just fixed escaped characters and used your strsep loop for parsing > options. I'll keep your patch on the side in case we find a solution > that is compatible with fsroot. Thanks a lot. Thank you. Unfortunately, I discovered as small nitch

Re: [hwloc-devel] [PATCH] Use getmntent_r(3) to parse /proc/mounts lines

2010-03-12 Thread Brice Goglin
Bert Wesarg wrote: >> Ups, what about the fsroot_fd now? I think this has something to do if >> /proc and /sys are not mounted at the root, for example in test mode, >> right? >> > > I'm right. The only way out I see is to step aside from openat and use > string operations to for this. > > I s

Re: [hwloc-devel] [PATCH] Use getmntent_r(3) to parse /proc/mounts lines

2010-03-11 Thread Bert Wesarg
On Fri, Mar 12, 2010 at 00:18, Bert Wesarg wrote: > On Fri, Mar 12, 2010 at 00:14, Bert Wesarg wrote: >> On Fri, Mar 12, 2010 at 00:03, Brice Goglin wrote: >>> >>> Did you actually test this ? The way I am reading the manpage is that >>> you need to open with setmntent and close with endmntent.

Re: [hwloc-devel] [PATCH] Use getmntent_r(3) to parse /proc/mounts lines

2010-03-11 Thread Bert Wesarg
On Fri, Mar 12, 2010 at 00:14, Bert Wesarg wrote: > On Fri, Mar 12, 2010 at 00:03, Brice Goglin wrote: >> >> Did you actually test this ? The way I am reading the manpage is that >> you need to open with setmntent and close with endmntent. > > I have read the man page, but only about getmntent, a

Re: [hwloc-devel] [PATCH] Use getmntent_r(3) to parse /proc/mounts lines

2010-03-11 Thread Bert Wesarg
On Fri, Mar 12, 2010 at 00:03, Brice Goglin wrote: > > Did you actually test this ? The way I am reading the manpage is that > you need to open with setmntent and close with endmntent. I have read the man page, but only about getmntent, and than read the source code for getmntent from glibc. So y

Re: [hwloc-devel] [PATCH] Use getmntent_r(3) to parse /proc/mounts lines

2010-03-11 Thread Samuel Thibault
Brice Goglin, le Fri 12 Mar 2010 00:03:37 +0100, a écrit : > Also, isn't getmntent (without _r) enough here? I guess it will have troubles if it is called concurrently in different threads: the value returned by getmntent is typically not dynamically allocated. Samuel

Re: [hwloc-devel] [PATCH] Use getmntent_r(3) to parse /proc/mounts lines

2010-03-11 Thread Brice Goglin
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 > " "

[hwloc-devel] [PATCH] Use getmntent_r(3) to parse /proc/mounts lines

2010-03-11 Thread Bert Wesarg
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 accurate