fixup cpu vendor+model

This commit is contained in:
Doug MacEachern 2008-04-11 03:48:38 +00:00
parent a7a7c13727
commit b1d8e39106
1 changed files with 4 additions and 5 deletions

View File

@ -2055,11 +2055,12 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
mhz /= 1000000; mhz /= 1000000;
} }
#ifdef __OpenBSD__
strcpy(model, "Unknown");
#else
size = sizeof(model); size = sizeof(model);
#ifdef __OpenBSD__
if (1) {
#else
if (sysctlbyname("hw.model", &model, &size, NULL, 0) < 0) { if (sysctlbyname("hw.model", &model, &size, NULL, 0) < 0) {
#endif
int mib[] = { CTL_HW, HW_MODEL }; int mib[] = { CTL_HW, HW_MODEL };
size = sizeof(model); size = sizeof(model);
if (sysctl(mib, NMIB(mib), &model[0], &size, NULL, 0) < 0) { if (sysctl(mib, NMIB(mib), &model[0], &size, NULL, 0) < 0) {
@ -2070,7 +2071,6 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
#endif #endif
} }
} }
#endif
if (mhz == SIGAR_FIELD_NOTIMPL) { if (mhz == SIGAR_FIELD_NOTIMPL) {
/* freebsd4 */ /* freebsd4 */
@ -2091,7 +2091,6 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
#endif #endif
if ((ptr = strchr(model, ' '))) { if ((ptr = strchr(model, ' '))) {
*ptr = '\0';
if (strstr(model, "Intel")) { if (strstr(model, "Intel")) {
SIGAR_SSTRCPY(vendor, "Intel"); SIGAR_SSTRCPY(vendor, "Intel");
} }