File extending-max-cpu-number.patch of Package libgtop

Extending the cpu number from 32 to 1024.

From: Jason Xing <xinggang861@gmail.com>

In 'Bug 323354 - Support a dynamic number of CPUs', there will be a
solution which can dynamically allocate memory for large number of
CPUs. As libgtop supports multiple operating systems, this work
may take some time.

This patch is a temporary patch, which worked before the whole
solution comes out. It only supports linux platform with CPU number
up to 1024.

There are two Macroes which limit the statistics of CPU. One is
GLIBTOP_NCPU. The other is a buffer size. This buffer used to read
/proc/stat contents into.

https://bugzilla.gnome.org/show_bug.cgi?id=323354

Signed-off-by: Jason Xing <xinggang861@gmail.com>
---
 include/glibtop/cpu.h |    2 +-
 sysdeps/linux/cpu.c   |    3 ++-
 sysdeps/linux/open.c  |    3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/glibtop/cpu.h b/include/glibtop/cpu.h
index 1d673e9..1566b29 100644
--- a/include/glibtop/cpu.h
+++ b/include/glibtop/cpu.h
@@ -54,7 +54,7 @@ G_BEGIN_DECLS
    Yes we are :)
    Nobody should really be using more than 32 processors.
 */
-#define GLIBTOP_NCPU		32
+#define GLIBTOP_NCPU		1024
 
 typedef struct _glibtop_cpu	glibtop_cpu;
 
diff --git a/sysdeps/linux/cpu.c b/sysdeps/linux/cpu.c
index bedeab5..f2cbb4e 100644
--- a/sysdeps/linux/cpu.c
+++ b/sysdeps/linux/cpu.c
@@ -66,11 +66,12 @@ _glibtop_init_cpu_s (glibtop *server)
 /* Provides information about cpu usage. */
 
 #define FILENAME	"/proc/stat"
+#define STAT_BUFSIZ     81920
 
 void
 glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
 {
-	char buffer [BUFSIZ], *p;
+	char buffer [STAT_BUFSIZ], *p;
 	int i;
 
 	memset (buf, 0, sizeof (glibtop_cpu));
diff --git a/sysdeps/linux/open.c b/sysdeps/linux/open.c
index b39b99e..61c3d58 100644
--- a/sysdeps/linux/open.c
+++ b/sysdeps/linux/open.c
@@ -61,13 +61,14 @@ static void set_linux_version(glibtop *server)
 /* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
 
 #define FILENAME	"/proc/stat"
+#define STAT_BUFSIZ     81920
 
 void
 glibtop_open_s (glibtop *server, const char *program_name,
 		const unsigned long features,
 		const unsigned flags)
 {
-	char buffer [BUFSIZ], *p = buffer;
+	char buffer [STAT_BUFSIZ], *p = buffer;
 
 	server->name = program_name;
 
From cb684f0f750c6bcbfb283a44f0db01e2cff36288 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= <bdejean@gmail.com>
Date: Sun, 13 Apr 2014 22:03:20 +0200
Subject: [PATCH] ABI breakage by efaaf6eb77e01f1ea002c19a261e4f3ac4788d25.
 Fixing libtool version to 10.0.0.

---
 configure.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index dc4e654..bc6f88f 100644
--- a/configure.in
+++ b/configure.in
@@ -8,7 +8,7 @@ m4_define([libgtop_micro_version], [6])
 m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
 
 dnl  increment if the interface has additions, changes, removals.
-m4_define([libgtop_current], [9])
+m4_define([libgtop_current], [10])
 
 dnl  increment any time the source changes; set to
 dnl  0 if you increment CURRENT
@@ -17,7 +17,7 @@ m4_define([libgtop_revision], [0])
 dnl  increment if any interfaces have been added; set to 0
 dnl  if any interfaces have been removed. removal has
 dnl  precedence over adding, so set to 0 if both happened.
-m4_define([libgtop_age], [2])
+m4_define([libgtop_age], [0])
 
 # Increase each time you change the client/server protocol.
 m4_define([libgtop_server_version], [5])
--- libgtop-2.28.5.orig/configure	2013-08-19 15:31:42.000000000 -0500
+++ libgtop-2.28.5/configure	2014-07-02 21:20:48.723764604 -0500
@@ -3386,7 +3386,7 @@
 
 
 # libtool versioning
-LT_VERSION_INFO="-version-info 9:0:2"
+LT_VERSION_INFO="-version-info 10:0:0"
 
 
 ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I ."
openSUSE Build Service is sponsored by