On Tue, Feb 22, 2011 at 11:07:15AM -0800, Bernard Li wrote:
> 
> According to the bug:
> 
> http://bugzilla.ganglia.info/cgi-bin/bugzilla/show_bug.cgi?id=298
> 
> the recent patch to make slurpfile's buffer resizable doesn't seem to
> be working.

I must be missing something here since I don't see the connection.

The bug (which is IMHO invalid) is reporting that a string gets truncated
to 32 bytes, which is a current design limit for metrics as defined by
MAX_G_STRING_SIZE and the fact that a g_val_t union is used to hold the
values (both defined in gm_value.h).

The "resizable" buffer is not even used in this call, since the buffer
passed to slurpfile is a static 32 byte array (for the buffer to be
allocated and dynamically resized it should be a pointer to null), and
considering that the bug is asking for the os release name, 32 bytes
should be enough, at least to get a unique identification.

> Upon second pass, we can't seem to be able to read any
> additional characters from the file.

what second pass?

   dummy = proc_sys_kernel_osrelease;
   rval.int32 = slurpfile("/proc/sys/kernel/osrelease", &dummy,
                          MAX_G_STRING_SIZE);

why would anyone call slurpfile in a loop anyway?, and slurpfile
doesn't call itself recursively but just reads as much data as it
can into the buffer provided (second parameter).

> It would appear that the special
> files in the /proc file system are not seekable?

the files in /proc are seekable, but even if they weren't it
shouldn't matter since slurpfile (implemented in lib/file.c)
doesn't do any seeks.

> The code does work with regular files.

and so it should be working as well in this case AFAIK.

Carlo

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to