aboutsummaryrefslogtreecommitdiffstats
path: root/packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch')
-rw-r--r--packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch149
1 files changed, 149 insertions, 0 deletions
diff --git a/packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch b/packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch
index e69de29bb2..b78a48d38a 100644
--- a/packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch
+++ b/packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch
@@ -0,0 +1,149 @@
+Index: sysinfo.c
+===================================================================
+RCS file: /cvs/gpe/base/gpe-conf/sysinfo.c,v
+retrieving revision 1.19
+diff -u -r1.19 sysinfo.c
+--- sysinfo.c 8 Sep 2004 22:14:12 -0000 1.19
++++ sysinfo.c 25 Oct 2004 12:01:01 -0000
+@@ -160,6 +160,7 @@
+ get_device_info()
+ {
+ t_deviceinfo result;
++ struct utsname uinfo;
+ #ifdef __arm__
+ char **strv;
+ int len = 0;
+@@ -173,6 +174,8 @@
+ result.ram = 0;
+ result.flash = 0;
+
++ uname(&uinfo);
++
+ #ifdef __arm__
+ /* check mach type and model */
+ if (!access(P_IPAQ,F_OK))
+@@ -235,6 +238,7 @@
+ #endif
+ #ifdef __i386__
+ result.cpu = g_strdup(_("Intel x86 or compatible"));
++ result.model = g_strdup_printf("%s, %s", _("IBM type PC"), uinfo.machine);
+ #endif
+ #ifdef __mips__
+ result.cpu = g_strdup(_("Mips"));
+@@ -246,12 +250,13 @@
+ result.cpu = g_strdup(_("IBM Power or PowerPC"));
+ #endif
+ if (!result.model)
+- result.model = g_strdup(MACHINE);
++ result.model = g_strdup_printf("%s (%s)", uinfo.machine, MACHINE);
+ #endif
+
+ /* memory and flash size */
++
+ system_memory();
+- result.ram = meminfo.total / 1024 + 1;
++ result.ram = meminfo.total;
+ result.flash = get_flash_size();
+ return result;
+ }
+Index: storage.c
+===================================================================
+RCS file: /cvs/gpe/base/gpe-conf/storage.c,v
+retrieving revision 1.17
+diff -u -r1.17 storage.c
+--- storage.c 13 Sep 2004 12:00:01 -0000 1.17
++++ storage.c 25 Oct 2004 12:01:01 -0000
+@@ -54,41 +54,32 @@
+ return FS_T_UNKNOWN;
+ }
+
+-/* from minisys */
+ int
+ system_memory (void)
+ {
+- u_int64_t my_mem_used, my_mem_max;
+- u_int64_t my_swap_max;
++ unsigned long mem_free, mem_total;
+
+- static int mem_delay = 0;
+ FILE *mem;
+- static u_int64_t aa, ab, ac, ad, ae, af, ag, ah;
+- /* put this in permanent storage instead of stack */
+- static char not_needed[2048];
+- if (mem_delay-- <= 0)
++ static char line[255];
++ mem = fopen ("/proc/meminfo", "r");
++ if (mem)
+ {
+- mem = fopen ("/proc/meminfo", "r");
+- fgets (not_needed, 2048, mem);
+-
+- fscanf (mem, "%*s %Ld %Ld %Ld %Ld %Ld %Ld", &aa, &ab, &ac,
+- &ad, &ae, &af);
+- fscanf (mem, "%*s %Ld %Ld", &ag, &ah);
++ while (fgets (line, 255, mem))
++ {
++ if (g_str_has_prefix(line, "MemTotal"))
++ sscanf(line, "%*s %lu %*s", &mem_total);
++ else if (g_str_has_prefix(line, "MemFree"))
++ {
++ sscanf(line, "%*s %lu %*s", &mem_free);
++ break;
++ }
++ }
+ fclose (mem);
+- mem_delay = 25;
+-
+- /* calculate it */
+- my_mem_max = aa; /* memory.total; */
+- my_swap_max = ag; /* swap.total; */
+-
+- my_mem_used = ah + ab - af - ae;
+-
+- meminfo.total = my_mem_max / 1024;
+- meminfo.used = my_mem_used / 1024;
+- meminfo.avail = (my_mem_max - my_mem_used) / 1024;
+- return 0;
++ meminfo.total = mem_total / 1024;
++ meminfo.used = (mem_total - mem_free) / 1024;
++ meminfo.avail = mem_free / 1024;
+ }
+- return 1;
++ return 0;
+ }
+
+
+@@ -183,13 +174,13 @@
+ /* TRANSLATORS: MB == Mega Bytes*/
+ sprintf (cnew2, "%s: <i>%4.1f</i> %s", _("Free memory"),
+ ((float) meminfo.total -
+- (float) meminfo.used) / 1024.0, _("MB"));
++ (float) meminfo.used), _("MB"));
+ gtk_label_set_markup (GTK_LABEL (meminfo.label3), cnew2);
+
+ fstr = g_strdup_printf ("%s%s %4.1f %s %s",
+ "<span foreground=\"black\">",
+ _("Total:"),
+- (float) meminfo.total / 1024.0,
++ (float) meminfo.total,
+ _("MB"), "</span>");
+ gtk_label_set_markup (GTK_LABEL (meminfo.label2), fstr);
+ g_free (fstr);
+@@ -452,7 +443,7 @@
+ (float) meminfo.total);
+ sprintf (cnew2, "%s: <i>%4.1f</i> %s", _("Free memory"),
+ ((float) meminfo.total -
+- (float) meminfo.used) / 1024.0, _("MB"));
++ (float) meminfo.used), _("MB"));
+ label1 = gtk_label_new (NULL);
+ gtk_misc_set_alignment (GTK_MISC (label1), 0.0, 0.5);
+ meminfo.label3 = label1;
+@@ -464,7 +455,7 @@
+ fstr = g_strdup_printf ("%s%s %4.1f %s %s",
+ "<span foreground=\"black\">",
+ _("Total:"),
+- (float) meminfo.total / 1024.0,
++ (float) meminfo.total,
+ _("MB"), "</span>");
+ gtk_label_set_markup (GTK_LABEL (label1), fstr);
+ g_free (fstr);