From 3bee311d6fd4eccf3e031578808d75876b61a3c4 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 26 Jul 2005 22:13:27 +0000 Subject: handle multi-core itanium (#163783) --- initscripts.spec | 5 ++++- src/redhat-support-check.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/initscripts.spec b/initscripts.spec index 1c8e9a22..ed487b6d 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -1,6 +1,6 @@ Summary: The inittab file and the /etc/init.d scripts. Name: initscripts -Version: 7.93.16.EL +Version: 7.93.17.EL License: GPL Group: System Environment/Base Release: 1 @@ -206,6 +206,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %attr(0664,root,utmp) /var/run/utmp %changelog +* Tue Jul 26 2005 Bill Nottingham 7.93.17.EL-1 +- redhat-support-check: handle multi-core ia64 (#163783) + * Fri Jul 22 2005 Bill Nottingham 7.93.16.EL-1 - fix invalid free (#163973, ) diff --git a/src/redhat-support-check.c b/src/redhat-support-check.c index 93ea9154..dd5bc162 100644 --- a/src/redhat-support-check.c +++ b/src/redhat-support-check.c @@ -26,7 +26,8 @@ #define _(String) gettext((String)) -#define SUPPORTINFO "/var/lib/supportinfo" +#define SUPPORTINFO "/var/lib/supportinfo" +#define CPUINFO "/proc/cpuinfo" static int min_mem = 0; static int max_mem = 0; @@ -64,9 +65,10 @@ guint64 get_memory() { unsigned int get_num_cpus() { int ncpus = sysconf(_SC_NPROCESSORS_ONLN); - u_int32_t eax = 0, ebx = 0, ecx = 0, edx = 0; #if defined(__i386__) || defined(__x86_64__) + u_int32_t eax = 0, ebx = 0, ecx = 0, edx = 0; + cpuid(0, &eax, &ebx, &ecx, &edx); if (ebx == 0x756e6547) { /* Intel */ cpuid(1, &eax, &ebx, &ecx, &edx); @@ -91,6 +93,30 @@ unsigned int get_num_cpus() { return ncpus / nsibs; } } +#endif +#if defined(__ia64__) + gchar *contents, **lines; + gsize len; + int x; + GList *list = NULL; + + g_file_get_contents(CPUINFO, &contents, &len, NULL); + if (!contents) + return ncpus; + lines = g_strsplit(contents,"\n", 0); + + len = 0; + for (x = 0; lines[x]; x++) { + if (g_str_has_prefix(lines[x],"physical id")) { + if (!g_list_find_custom(list, lines[x],g_ascii_strcasecmp)) + list = g_list_prepend(list, lines[x]); + } + } + len = g_list_length(list); + if (len) { + g_list_free(list); + ncpus = len; + } #endif return ncpus; } -- cgit v1.2.1