This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin] statm should report memory as multiples of allocation_granularity instead of page_size
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 17 Nov 2016 09:51:33 -0000
- Subject: [newlib-cygwin] statm should report memory as multiples of allocation_granularity instead of page_size
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6477a48cd170b749d6eedad85944f77995edc0fb
commit 6477a48cd170b749d6eedad85944f77995edc0fb
Author: Erik M. Bray <erik.bray@lri.fr>
Date: Wed Nov 16 15:36:41 2016 +0100
statm should report memory as multiples of allocation_granularity instead of page_size
that ensures that values in statm mupltiplied by POSIX _SC_PAGESIZE give the correct values
Diff:
---
winsup/cygwin/fhandler_process.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index 02f7ca0..c5698c3 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -1251,12 +1251,16 @@ format_process_statm (void *data, char *&destbuf)
_pinfo *p = (_pinfo *) data;
unsigned long vmsize = 0UL, vmrss = 0UL, vmtext = 0UL, vmdata = 0UL,
vmlib = 0UL, vmshare = 0UL;
+ size_t page_scale;
if (!get_mem_values (p->dwProcessId, &vmsize, &vmrss, &vmtext, &vmdata,
&vmlib, &vmshare))
return 0;
+
+ page_scale = wincap.allocation_granularity() / wincap.page_size();
destbuf = (char *) crealloc_abort (destbuf, 96);
return __small_sprintf (destbuf, "%ld %ld %ld %ld %ld %ld 0\n",
- vmsize, vmrss, vmshare, vmtext, vmlib, vmdata);
+ vmsize / page_scale, vmrss / page_scale, vmshare / page_scale,
+ vmtext / page_scale, vmlib / page_scale, vmdata / page_scale);
}
extern "C" {