hurd-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memstat-0.9 hurd patch (PATH_MAX)


From: Tanguy LE CARROUR
Subject: memstat-0.9 hurd patch (PATH_MAX)
Date: Fri, 20 Jan 2012 22:32:56 +0100

Dear Hurd developers,

Here is my first attempt to fix a PATH_MAX related FTBFS. So please, be indulgent!

1) Why memstat?
Because of PATH_MAX, I though would be easy to fix. Also because the source code was relatively small.
This package maybe useless but I needed something to start with...

2) Parts to fix
 a) use of PATH_MAX to create a char[] to store a path 
 b) use of PATH_MAX to read line from a file (that contains 1 file path on each line) in a char[] buffer 
 c) use of readlink(str1, str2, PATH_MAX)

3) Fix...
 a) "piece of cake" (TM), but include <math.h> (for log10() function) to get an accurate length for the buffer... which may be an overhead!
 b) read file lines in a dynamically re-sized buffer
 c) use lstat as described in readlink man page

4) Results
The code build on Hurd. dpkg-buildpackage successful.

5) But...
 - memstat uses /proc/XYZ/exe and /proc/XYZ/maps... and the output of memstat on Hurd is different than the one on Linux
 - implement (copy/paste mostly) a get_line function. Might have been better to use the GNU get_line()... or not?!

Feel free to make comments on everything (code, decisions, style), I know that I still have a lot to learn! 

Hope to be more helpful in the future,
Tanguy

Attachment: memstat-0.9.hurd.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]