[Devel] [PATCH 09/10] get_num_cpu(): Use PROCCPU macros for "/proc/cpuinfo"
Igor Podlesny
openvz at poige.ru
Mon May 6 23:42:11 PDT 2013
---
include/util.h | 1 +
src/lib/util.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/util.h b/include/util.h
index ff23804..0f87e6e 100644
--- a/include/util.h
+++ b/include/util.h
@@ -26,6 +26,7 @@
#define DESTR 1
#define PROCMEM "/proc/meminfo"
+#define PROCCPU "/proc/cpuinfo"
#define PROCTHR "/proc/sys/kernel/threads-max"
#define PROCVEINFO "/proc/vz/veinfo"
diff --git a/src/lib/util.c b/src/lib/util.c
index 66c78df..83cd796 100644
--- a/src/lib/util.c
+++ b/src/lib/util.c
@@ -542,8 +542,8 @@ int get_num_cpu(void)
char str[128];
int ncpu = 0;
- if ((fd = fopen("/proc/cpuinfo", "r")) == NULL) {
- logger(-1, errno, "Cannot open /proc/cpuinfo");
+ if ((fd = fopen(PROCCPU, "r")) == NULL) {
+ logger(-1, errno, "Cannot open " PROCCPU);
return 1;
}
while (fgets(str, sizeof(str), fd)) {
--
1.7.9.5
More information about the Devel
mailing list