add routine to get hardware model using ODM

This commit is contained in:
Doug MacEachern 2004-07-02 22:55:59 +00:00
parent ad495656ee
commit 3575b1319f
1 changed files with 26 additions and 0 deletions

View File

@ -21,6 +21,11 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <net/if.h> #include <net/if.h>
/* for odm api */
#include <sys/cfgodm.h>
#include <sys/cfgdb.h>
#include <cf.h>
#include "user_v5.h" #include "user_v5.h"
#include "utmp_v5.h" #include "utmp_v5.h"
@ -112,6 +117,8 @@ int sigar_os_open(sigar_t **sigar)
} }
} }
(*sigar)->model[0] = '\0';
return SIGAR_OK; return SIGAR_OK;
} }
@ -986,6 +993,25 @@ int sigar_file_system_usage_get(sigar_t *sigar,
#define POWER_5 0x2000 #define POWER_5 0x2000
#endif #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, int sigar_cpu_infos_get(sigar_t *sigar,
sigar_cpu_infos_t *cpu_infos) sigar_cpu_infos_t *cpu_infos)
{ {