From 3575b1319fbbd8f5622e10abb4ebe82683c06425 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 2 Jul 2004 22:55:59 +0000 Subject: [PATCH] add routine to get hardware model using ODM --- src/os/aix/aix_sigar.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/os/aix/aix_sigar.c b/src/os/aix/aix_sigar.c index cb630794..c4486e71 100644 --- a/src/os/aix/aix_sigar.c +++ b/src/os/aix/aix_sigar.c @@ -21,6 +21,11 @@ #include #include +/* for odm api */ +#include +#include +#include + #include "user_v5.h" #include "utmp_v5.h" @@ -112,6 +117,8 @@ int sigar_os_open(sigar_t **sigar) } } + (*sigar)->model[0] = '\0'; + return SIGAR_OK; } @@ -986,6 +993,25 @@ int sigar_file_system_usage_get(sigar_t *sigar, #define POWER_5 0x2000 #endif +static char *sigar_get_odm_model(sigar_t *sigar) +{ + if (sigar->model[0] == '\0') { + struct CuAt *odm_obj; + int num; + + odm_initialize(); + + if ((odm_obj = getattr("proc0", "type", 0, &num))) { + SIGAR_SSTRCPY(sigar->model, odm_obj->value); + free(odm_obj); + } + + odm_terminate(); + } + + return sigar->model; +} + int sigar_cpu_infos_get(sigar_t *sigar, sigar_cpu_infos_t *cpu_infos) {