procps/procps-ng-3.3.11-pmap4suse.patch

159 lines
4.6 KiB
Diff

---
pmap.c | 46 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 11 deletions(-)
--- pmap.c
+++ pmap.c 2016-01-27 09:16:14.924460617 +0000
@@ -48,7 +48,9 @@ const char *nls_Address,
*nls_Kbytes,
*nls_Mode,
*nls_RSS,
- *nls_Dirty;
+ *nls_PSS,
+ *nls_Dirty,
+ *nls_Swap;
static void nls_initialize(void)
{
@@ -72,7 +74,9 @@ static void nls_initialize(void)
nls_Kbytes = _("Kbytes");
nls_Mode = _("Mode");
nls_RSS = _("RSS");
+ nls_PSS = _("PSS");
nls_Dirty = _("Dirty");
+ nls_Swap = _("Swap");
}
static int justify_print(const char *str, int width, int right)
@@ -140,10 +144,10 @@ static int d_option;
static int n_option;
static int N_option;
static int q_option;
-static int x_option;
+static int x_option = 1;
static int X_option;
-static int map_desc_showpath;
+static int map_desc_showpath = 1;
static unsigned shm_minor = ~0u;
@@ -521,12 +525,17 @@ static int one_proc(proc_t * p)
unsigned KLONG diff = 0;
const char *cp2 = NULL;
unsigned long long rss = 0ull;
+ unsigned long long pss = 0ull;
+ unsigned long long swap = 0ull;
unsigned long long private_dirty = 0ull;
unsigned long long shared_dirty = 0ull;
unsigned long long total_rss = 0ull;
+ unsigned long long total_pss = 0ull;
+ unsigned long long total_swap = 0ull;
unsigned long long total_private_dirty = 0ull;
unsigned long long total_shared_dirty = 0ull;
int maxw1=0, maxw2=0, maxw3=0, maxw4=0, maxw5=0;
+ int maxw6=0, maxw7=0;
/* Overkill, but who knows what is proper? The "w" prog uses
* the tty width to determine this.
@@ -555,13 +564,15 @@ static int one_proc(proc_t * p)
if (x_option) {
maxw1 = 16;
if (sizeof(KLONG) == 4) maxw1 = 8;
- maxw2 = maxw3 = maxw4 = 7;
+ maxw2 = maxw3 = maxw4 = maxw6 = maxw7 = 7;
maxw5 = 5;
if (!q_option) {
maxw1 = justify_print(nls_Address, maxw1, 0);
maxw2 = justify_print(nls_Kbytes, maxw2, 1);
maxw3 = justify_print(nls_RSS, maxw3, 1);
+ maxw6 = justify_print(nls_PSS, maxw6, 1);
maxw4 = justify_print(nls_Dirty, maxw4, 1);
+ maxw7 = justify_print(nls_Swap, maxw7, 1);
maxw5 = justify_print(nls_Mode, maxw5, 0);
justify_print(nls_Mapping, 0, 0);
}
@@ -605,6 +616,11 @@ static int one_proc(proc_t * p)
total_rss += smap_value;
continue;
}
+ if (strncmp("Pss", smap_key, 3) == 0) {
+ pss = smap_value;
+ total_pss += smap_value;
+ continue;
+ }
if (strncmp("Shared_Dirty", smap_key, 12) == 0) {
shared_dirty = smap_value;
total_shared_dirty += smap_value;
@@ -616,12 +632,15 @@ static int one_proc(proc_t * p)
continue;
}
if (strncmp("Swap", smap_key, 4) == 0) {
- /*doesn't matter as long as last */
- printf("%0*" KLF "x %*lu %*llu %*llu %*s %s\n",
+ swap = smap_value;
+ total_swap += smap_value;
+ printf("%0*" KLF "x %*lu %*llu %*llu %*llu %*llu %*s %s\n",
maxw1, start,
maxw2, (unsigned long)(diff >> 10),
maxw3, rss,
+ maxw6, pss,
maxw4, (private_dirty + shared_dirty),
+ maxw7, swap,
maxw5, perms,
cp2);
/* reset some counters */
@@ -656,7 +675,6 @@ static int one_proc(proc_t * p)
if (perms[3] == 's')
total_shared += diff;
if (perms[3] == 'p') {
- perms[3] = '-';
if (perms[1] == 'w')
total_private_writeable += diff;
else
@@ -708,17 +726,21 @@ static int one_proc(proc_t * p)
justify_print("----------------", maxw1, 0);
justify_print("-------", maxw2, 1);
justify_print("-------", maxw3, 1);
+ justify_print("-------", maxw6, 1);
justify_print("-------", maxw4, 1);
+ justify_print("-------", maxw7, 1);
printf("\n");
printf("%-*s ", maxw1, _("total kB"));
- printf("%*ld %*llu %*llu\n",
+ printf("%*ld %*llu %*llu %*llu %*llu\n",
maxw2, (total_shared +
total_private_writeable +
total_private_readonly) >> 10,
maxw3, total_rss,
+ maxw6, total_pss,
maxw4, (total_shared_dirty +
- total_private_dirty));
+ total_private_dirty),
+ maxw7, total_swap);
}
if (d_option) {
printf
@@ -1025,16 +1047,18 @@ int main(int argc, char **argv)
while ((c = getopt_long(argc, argv, "xXrdqA:hVcC:nN:p", longopts, NULL)) != -1)
switch (c) {
case 'x':
- x_option = 1;
+ x_option = !x_option;
break;
case 'X':
X_option++;
+ x_option = 0;
break;
case 'r':
xwarnx(_("option -r is ignored as SunOS compatibility"));
break;
case 'd':
- d_option = 1;
+ d_option = !d_option;
+ x_option = 0;
break;
case 'q':
q_option = 1;