procps/procps-ng-3.3.10-bnc634071_procstat2.diff

56 lines
1.6 KiB
Diff

--- proc/libprocps.sym
+++ proc/libprocps.sym 2014-05-16 10:01:38.000000000 +0000
@@ -59,6 +59,7 @@ global:
signal_name_to_number;
signal_number_to_name;
smp_num_cpus;
+ __smp_num_cpus;
sprint_uptime;
strtosig;
tty_to_dev;
--- proc/sysinfo.c
+++ proc/sysinfo.c 2015-01-27 15:17:46.241518734 +0000
@@ -37,7 +37,8 @@
#include <netinet/in.h> /* htons */
#endif
-long smp_num_cpus; /* number of CPUs */
+#undef smp_num_cpus
+long smp_num_cpus=-1; /* number of CPUs */
long page_bytes; /* this architecture's page size */
#define BAD_OPEN_MESSAGE \
@@ -1069,7 +1070,11 @@ out:
///////////////////////////////////////////////////////////////////////////
-void cpuinfo (void) {
+long __smp_num_cpus (void) {
+
+ if (smp_num_cpus != -1)
+ return(smp_num_cpus);
+
// ought to count CPUs in /proc/stat instead of relying
// on glibc, which foolishly tries to parse /proc/cpuinfo
// note: that may have been the case but now /proc/stat
@@ -1084,4 +1089,8 @@ void cpuinfo (void) {
smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
if (smp_num_cpus<1) /* SPARC glibc is buggy */
smp_num_cpus=1;
+
+ return smp_num_cpus;
}
+
+void cpuinfo (void) { (void)__smp_num_cpus(); }
--- proc/sysinfo.h
+++ proc/sysinfo.h 2015-01-27 15:18:35.169518781 +0000
@@ -8,6 +8,8 @@ EXTERN_C_BEGIN
extern unsigned long long Hertz; /* clock tick frequency */
extern long smp_num_cpus; /* number of CPUs */
+extern long __smp_num_cpus(void);
+#define smp_num_cpus __smp_num_cpus()
extern int have_privs; /* boolean, true if setuid or similar */
extern long page_bytes; /* this architecture's bytes per page */