]> git.proxmox.com Git - lxcfs.git/commitdiff
fix #1173: wrong /proc/meminfo content
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 19 Oct 2016 07:41:08 +0000 (09:41 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 19 Oct 2016 08:50:12 +0000 (10:50 +0200)
debian/patches/fix-Active-Inactive-proc-meminfo.patch [new file with mode: 0644]
debian/patches/fix-offsets-for-memory.stat-parsing.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/fix-Active-Inactive-proc-meminfo.patch b/debian/patches/fix-Active-Inactive-proc-meminfo.patch
new file mode 100644 (file)
index 0000000..d36f133
--- /dev/null
@@ -0,0 +1,30 @@
+From 3f4847aacd7cb56d7859f1562c81c06acf9d41d5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
+Date: Wed, 19 Oct 2016 09:16:36 +0200
+Subject: [PATCH] fix Active/Inactive /proc/meminfo
+
+---
+ bindings.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/bindings.c b/bindings.c
+index 2f78ab5..0d46fb8 100644
+--- a/bindings.c
++++ b/bindings.c
+@@ -3197,11 +3197,11 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
+               } else if (startswith(line, "SwapCached:")) {
+                       snprintf(lbuf, 100, "SwapCached:     %8lu kB\n", 0UL);
+                       printme = lbuf;
+-              } else if (startswith(line, "Active")) {
++              } else if (startswith(line, "Active:")) {
+                       snprintf(lbuf, 100, "Active:         %8lu kB\n",
+                                       active_anon + active_file);
+                       printme = lbuf;
+-              } else if (startswith(line, "Inactive")) {
++              } else if (startswith(line, "Inactive:")) {
+                       snprintf(lbuf, 100, "Inactive:       %8lu kB\n",
+                                       inactive_anon + inactive_file);
+                       printme = lbuf;
+-- 
+2.1.4
+
diff --git a/debian/patches/fix-offsets-for-memory.stat-parsing.patch b/debian/patches/fix-offsets-for-memory.stat-parsing.patch
new file mode 100644 (file)
index 0000000..ca937fa
--- /dev/null
@@ -0,0 +1,45 @@
+From 145cc4a9922aeabeecce69225c9476aaffe147ad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
+Date: Wed, 19 Oct 2016 09:06:59 +0200
+Subject: [PATCH] fix offsets for memory.stat parsing
+
+---
+ bindings.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/bindings.c b/bindings.c
+index 2f78ab5..f433ea2 100644
+--- a/bindings.c
++++ b/bindings.c
+@@ -2958,22 +2958,22 @@ static void parse_memstat(char *memstat, unsigned long *cached,
+       while (*memstat) {
+               if (startswith(memstat, "cache")) {
+-                      sscanf(memstat + 11, "%lu", cached);
++                      sscanf(memstat + sizeof("cache"), "%lu", cached);
+                       *cached /= 1024;
+               } else if (startswith(memstat, "active_anon")) {
+-                      sscanf(memstat + 11, "%lu", active_anon);
++                      sscanf(memstat + sizeof("active_anon"), "%lu", active_anon);
+                       *active_anon /= 1024;
+               } else if (startswith(memstat, "inactive_anon")) {
+-                      sscanf(memstat + 11, "%lu", inactive_anon);
++                      sscanf(memstat + sizeof("inactive_anon"), "%lu", inactive_anon);
+                       *inactive_anon /= 1024;
+               } else if (startswith(memstat, "active_file")) {
+-                      sscanf(memstat + 11, "%lu", active_file);
++                      sscanf(memstat + sizeof("active_file"), "%lu", active_file);
+                       *active_file /= 1024;
+               } else if (startswith(memstat, "inactive_file")) {
+-                      sscanf(memstat + 11, "%lu", inactive_file);
++                      sscanf(memstat + sizeof("inactive_file"), "%lu", inactive_file);
+                       *inactive_file /= 1024;
+               } else if (startswith(memstat, "unevictable")) {
+-                      sscanf(memstat + 11, "%lu", unevictable);
++                      sscanf(memstat + sizeof("unevictable"), "%lu", unevictable);
+                       *unevictable /= 1024;
+               }
+               eol = strchr(memstat, '\n');
+-- 
+2.1.4
+
index bf650b42b1037ca3c7f99c19421c9e1728402554..d226b69d912f9217899e17d7b21ed21c8918630a 100644 (file)
@@ -1 +1,3 @@
 do-not-start-without-lxcfs.patch
+fix-offsets-for-memory.stat-parsing.patch
+fix-Active-Inactive-proc-meminfo.patch