[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1285277887-14190-2-git-send-email-sbohrer@rgmadvisors.com>
Date: Thu, 23 Sep 2010 16:38:06 -0500
From: Shawn Bohrer <sbohrer@...advisors.com>
To: arjan@...ux.intel.com, nhorman@...driver.com
Cc: tomk@...advisors.com, danb@...advisors.com,
linux-kernel@...r.kernel.org,
Shawn Bohrer <sbohrer@...advisors.com>
Subject: [PATCH 1/2] Fix detection of CPUs in sysfs
Only count directories that match /sys/devices/system/cpu/cpu[0-9]+ as
CPUs. Previously any directory that started with cpu was counted which
caused cpufreq and cpuidle to be counted as CPUs.
Signed-off-by: Shawn Bohrer <sbohrer@...advisors.com>
---
cputree.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/cputree.c b/cputree.c
index 3b0c982..b879785 100644
--- a/cputree.c
+++ b/cputree.c
@@ -25,6 +25,7 @@
*/
#include "config.h"
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -321,7 +322,7 @@ void parse_cpu_tree(void)
return;
do {
entry = readdir(dir);
- if (entry && strlen(entry->d_name)>3 && strstr(entry->d_name,"cpu")) {
+ if (entry && !strncmp(entry->d_name,"cpu", 3) && isdigit(entry->d_name[3])) {
char new_path[PATH_MAX];
sprintf(new_path, "/sys/devices/system/cpu/%s", entry->d_name);
do_one_cpu(new_path);
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists