aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2005-07-26 22:13:27 +0000
committerBill Nottingham <notting@redhat.com>2005-07-26 22:13:27 +0000
commit3bee311d6fd4eccf3e031578808d75876b61a3c4 (patch)
tree196e767f5fe375dc5193048cc8a773c8735eee77 /src
parent480564380fe0fa73a85feb30c4a91ea0fdb97d46 (diff)
downloadinitscripts-3bee311d6fd4eccf3e031578808d75876b61a3c4.tar
initscripts-3bee311d6fd4eccf3e031578808d75876b61a3c4.tar.gz
initscripts-3bee311d6fd4eccf3e031578808d75876b61a3c4.tar.bz2
initscripts-3bee311d6fd4eccf3e031578808d75876b61a3c4.tar.xz
initscripts-3bee311d6fd4eccf3e031578808d75876b61a3c4.zip
handle multi-core itanium (#163783)r7-93-17-EL
Diffstat (limited to 'src')
-rw-r--r--src/redhat-support-check.c30
1 files changed, 28 insertions, 2 deletions
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;
}