Re: [Ganglia-developers] Dynamically resizable buffer for slurpfile()

2011-02-27 Thread Carlo Marcelo Arenas Belon
On Thu, Feb 24, 2011 at 10:44:58PM +, Kostas Georgiou wrote: > On Thu, Feb 24, 2011 at 12:25:16PM +, Carlo Marcelo Arenas Belon wrote: > > > On Wed, Feb 23, 2011 at 09:42:56AM -0800, Bernard Li wrote: > > > > > > 123 read: > > > 124 read_len = read(fd, db, buflen); > > > 12

Re: [Ganglia-developers] Dynamically resizable buffer for slurpfile()

2011-02-24 Thread Kostas Georgiou
On Thu, Feb 24, 2011 at 12:25:16PM +, Carlo Marcelo Arenas Belon wrote: > On Wed, Feb 23, 2011 at 09:42:56AM -0800, Bernard Li wrote: > > > > 123 read: > > 124read_len = read(fd, db, buflen); > > 125if (read_len <= 0) > > 126 { > > 127 if (errno == EINTR) > > 128

Re: [Ganglia-developers] Dynamically resizable buffer for slurpfile()

2011-02-24 Thread Carlo Marcelo Arenas Belon
On Wed, Feb 23, 2011 at 09:42:56AM -0800, Bernard Li wrote: > > > 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 any

Re: [Ganglia-developers] Dynamically resizable buffer for slurpfile()

2011-02-24 Thread Carlo Marcelo Arenas Belon
On Thu, Feb 24, 2011 at 02:06:44AM +, Kostas Georgiou wrote: > > In any case the slurpfile resizable buffer doesn't really work :( obviously there is a misunderstanding about what this code does, and it is not "resizable buffer", but avoiding buffer overflows when passed more data than it can

Re: [Ganglia-developers] Dynamically resizable buffer for slurpfile()

2011-02-24 Thread Carlo Marcelo Arenas Belon
On Wed, Feb 23, 2011 at 05:12:03PM -0800, Bernard Li wrote: > > > I tested under EL5 and EL6 and it was't able to get past the initial > > buffer size. ?I believe what I did was: > > Correction. It works on EL6, but not on EL5: most likely the test is just giving inconsistent results, and that

Re: [Ganglia-developers] Dynamically resizable buffer for slurpfile()

2011-02-23 Thread Kostas Georgiou
On Wed, Feb 23, 2011 at 05:12:03PM -0800, Bernard Li wrote: > Hi Carlo: > > On Wed, Feb 23, 2011 at 9:42 AM, Bernard Li wrote: > > > I tested under EL5 and EL6 and it was't able to get past the initial > > buffer size.  I believe what I did was: > > Correction. It works on EL6, but not on EL5

Re: [Ganglia-developers] Dynamically resizable buffer for slurpfile()

2011-02-23 Thread Bernard Li
Hi Carlo: On Wed, Feb 23, 2011 at 9:42 AM, Bernard Li wrote: > I tested under EL5 and EL6 and it was't able to get past the initial > buffer size.  I believe what I did was: Correction. It works on EL6, but not on EL5: [CentOS 5.5 x86_64 with kernel 2.6.18-194.32.1.el5] read(3, "2.6.18-194.3

Re: [Ganglia-developers] Dynamically resizable buffer for slurpfile()

2011-02-23 Thread Bernard Li
Hi Carlo: On Wed, Feb 23, 2011 at 2:15 AM, Carlo Marcelo Arenas Belon wrote: > 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

Re: [Ganglia-developers] Dynamically resizable buffer for slurpfile()

2011-02-23 Thread Carlo Marcelo Arenas Belon
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

[Ganglia-developers] Dynamically resizable buffer for slurpfile()

2011-02-22 Thread Bernard Li
Hi all: 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. Upon second pass, we can't seem to be able to read any additional characters from the file. It would appear that the