aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2005-09-21 19:06:54 +0000
committerBill Nottingham <notting@redhat.com>2005-09-21 19:06:54 +0000
commita555d52cf1da5828ebe7f70daa7d8c235098c474 (patch)
tree164b1d0534e64632a55de3fe5c3941deb1413474
parent1b0d34662d56f36e00941135ba917376221bd135 (diff)
downloadinitscripts-a555d52cf1da5828ebe7f70daa7d8c235098c474.tar
initscripts-a555d52cf1da5828ebe7f70daa7d8c235098c474.tar.gz
initscripts-a555d52cf1da5828ebe7f70daa7d8c235098c474.tar.bz2
initscripts-a555d52cf1da5828ebe7f70daa7d8c235098c474.tar.xz
initscripts-a555d52cf1da5828ebe7f70daa7d8c235098c474.zip
- backport ia64 multi-core support to redhat-support-check (#164305)
-rw-r--r--initscripts.spec3
-rw-r--r--src/redhat-support-check.c30
2 files changed, 31 insertions, 2 deletions
diff --git a/initscripts.spec b/initscripts.spec
index f9831f69..eec0c6d7 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -249,6 +249,9 @@ rm -rf $RPM_BUILD_ROOT
%ghost %attr(0664,root,utmp) /var/run/utmp
%changelog
+* Wed Sep 21 2005 Bill Nottingham <notting@redhat.com>
+- backport ia64 multi-core support to redhat-support-check (#164305)
+
* Thu Aug 4 2005 Bill Nottingham <notting@redhat.com> 7.31.27.EL-1
- fix invalid free (#165033)
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);
@@ -92,6 +94,30 @@ unsigned int get_num_cpus() {
}
}
#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;
}