[Pkg-wmaker-commits] [wmtop] 02/11: wmtop: Fix incorrect memory usage.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Mon Feb 8 15:03:20 UTC 2016
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch upstream
in repository wmtop.
commit d4588b384a51292178e9e3539178d6faa3536e36
Author: Doug Torrance <dtorrance at piedmont.edu>
Date: Sun Feb 7 21:36:17 2016 -0500
wmtop: Fix incorrect memory usage.
Patch by Dwayne C. Litzenberger <dlitz at dlitz.net> to fix Debian bug #224732.
Obtained from [1].
[1] https://sources.debian.net/src/wmtop/0.84-12/debian/patches/fix_incorrect_memory_usage.patch/
---
wmtop.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/wmtop.c b/wmtop.c
index 1c0895f..b5b8441 100644
--- a/wmtop.c
+++ b/wmtop.c
@@ -843,7 +843,7 @@ void calc_cpu_each(int total) {
#if defined(LINUX)
int calc_mem_total() {
int ps;
- char line[512];
+ char line[1024];
char *ptr;
int rc;
@@ -853,13 +853,16 @@ int calc_mem_total() {
if (rc<0)
return 0;
- if ((ptr = strstr(line, "Mem:")) == NULL) {
- return 0;
- } else {
+ if ((ptr = strstr(line, "Mem:")) != NULL) {
ptr += 4;
return atoi(ptr);
+ } else if ((ptr = strstr(line, "MemTotal:")) != NULL) {
+ /* The "Mem:" line has been removed in Linux 2.6 */
+ ptr += 9;
+ return atoi(ptr) << 10; /* MemTotal is given in kiB */
+ } else {
+ return 0;
}
-
}
#endif /* defined(LINUX) */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmtop.git
More information about the Pkg-wmaker-commits
mailing list