27 lines
905 B
Diff
27 lines
905 B
Diff
diff -up libgtop-2.24.0/sysdeps/linux/sysinfo.c.read-cpuinfo-completely libgtop-2.24.0/sysdeps/linux/sysinfo.c
|
|
--- libgtop-2.24.0/sysdeps/linux/sysinfo.c.read-cpuinfo-completely 2008-05-23 18:13:20.000000000 -0400
|
|
+++ libgtop-2.24.0/sysdeps/linux/sysinfo.c 2008-11-09 21:04:38.000000000 -0500
|
|
@@ -36,12 +36,12 @@ static glibtop_sysinfo sysinfo = { .flag
|
|
static void
|
|
init_sysinfo (glibtop *server)
|
|
{
|
|
- char buffer [16384];
|
|
+ gchar *buffer;
|
|
gchar ** processors;
|
|
|
|
if(G_LIKELY(sysinfo.flags)) return;
|
|
|
|
- file_to_buffer(server, buffer, sizeof buffer, FILENAME);
|
|
+ if (!g_file_get_contents("/proc/cpuinfo", &buffer, NULL, NULL)) return;
|
|
|
|
/* cpuinfo records are seperated by a blank line */
|
|
processors = g_strsplit(buffer, "\n\n", 0);
|
|
@@ -87,6 +87,7 @@ init_sysinfo (glibtop *server)
|
|
}
|
|
|
|
g_strfreev(processors);
|
|
+ g_free(buffer);
|
|
|
|
sysinfo.flags = _glibtop_sysdeps_sysinfo;
|
|
}
|