From 09de663e8e66a0ad74b5a0f83fcb263c0d30cfe3 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 25 Sep 2006 13:44:20 +0000 Subject: [PATCH] set sys_info arch, vendor_version and description --- src/os/hpux/hpux_sigar.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/os/hpux/hpux_sigar.c b/src/os/hpux/hpux_sigar.c index 2890a6dd..839731cf 100644 --- a/src/os/hpux/hpux_sigar.c +++ b/src/os/hpux/hpux_sigar.c @@ -1042,11 +1042,49 @@ int sigar_proc_port_get(sigar_t *sigar, int protocol, return SIGAR_ENOTIMPL; } + int sigar_os_sys_info_get(sigar_t *sigar, sigar_sys_info_t *sysinfo) { + char *vendor_version, *arch; + long cpu = sysconf(_SC_CPU_VERSION); + + switch (cpu) { + case CPU_PA_RISC1_0: + arch = "PA_RISC1.0"; + break; + case CPU_PA_RISC1_1: + arch = "PA_RISC1.1"; + break; + case CPU_PA_RISC2_0: + arch = "PA_RISC2.0"; + break; +#ifdef CPU_IA64_ARCHREV_0 + case CPU_IA64_ARCHREV_0: + arch = "ia64"; + break; +#endif + default: + arch = "unknown"; + break; + } + + SIGAR_SSTRCPY(sysinfo->arch, arch); + SIGAR_SSTRCPY(sysinfo->name, "HPUX"); SIGAR_SSTRCPY(sysinfo->vendor, "Hewlett-Packard"); - /* XXX fixup version */ + + if (strstr(sysinfo->version, ".11.")) { + vendor_version = "11"; + } + else { + vendor_version = sysinfo->version; + } + + SIGAR_SSTRCPY(sysinfo->vendor_version, vendor_version); + + sprintf(sysinfo->description, "%s %s", + sysinfo->vendor_name, sysinfo->vendor_version); + return SIGAR_OK; }