add error checking and a local struct instead of the cpu_total_buffer global
using "unknown" in case of failure to avoid overflow and for consistency
with other platforms
Signed-off-by: Carlo Marcelo Arenas Belon <[EMAIL PROTECTED]>
---
trunk/monitor-core/libmetrics/aix/metrics.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/trunk/monitor-core/libmetrics/aix/metrics.c
b/trunk/monitor-core/libmetrics/aix/metrics.c
index f278a25..9ffcce9 100644
--- a/trunk/monitor-core/libmetrics/aix/metrics.c
+++ b/trunk/monitor-core/libmetrics/aix/metrics.c
@@ -215,19 +215,20 @@ sys_clock_func ( void )
return val;
}
-
-
g_val_t
machine_type_func ( void )
{
g_val_t val;
+ perfstat_cpu_total_t c;
+ if (perfstat_cpu_total (NULL, &c, sizeof( perfstat_cpu_total_t), 1) == -1)
+ strcpy (val.str, "unknown");
+ else
+ strncpy( val.str, c.description, MAX_G_STRING_SIZE );
- strncpy( val.str,cpu_total_buffer.description , MAX_G_STRING_SIZE );
return val;
}
-
g_val_t
os_name_func ( void )
{
--
1.5.3.7
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers