procps-3.2.7-top-env-vmsize.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. diff -up procps-3.2.7/top.c.p14 procps-3.2.7/top.c
  2. --- procps-3.2.7/top.c.p14 2008-09-01 11:36:55.000000000 +0200
  3. +++ procps-3.2.7/top.c 2008-09-01 11:36:55.000000000 +0200
  4. @@ -120,6 +120,8 @@ static int No_ksyms = -1, // set t
  5. Loops = -1, // number of iterations, -1 loops forever
  6. Secure_mode = 0; // set if some functionality restricted
  7. +static int VIRT_vmsize = 0; //use vm_size for VIRT
  8. +
  9. /* Some cap's stuff to reduce runtime calls --
  10. to accomodate 'Batch' mode, they begin life as empty strings */
  11. static char Cap_clr_eol [CAPBUFSIZ],
  12. @@ -1674,6 +1676,9 @@ static void before (char *me)
  13. Fieldstab[P_PPD].fmts = pid_fmt;
  14. Fieldstab[P_PPD].head = " PPID" + 10 - pid_digits;
  15. }
  16. +
  17. + if (( getenv("STATSIZE")) && ( atoi(getenv("STATSIZE")) == 1 ))
  18. + VIRT_vmsize = 1;
  19. }
  20. @@ -2207,6 +2212,7 @@ static void reframewins (void)
  21. }
  22. if (!Frames_libflags) Frames_libflags = L_DEFAULT;
  23. if (selection_type=='p') Frames_libflags |= PROC_PID;
  24. + if (VIRT_vmsize) Frames_libflags |= L_status;
  25. }
  26. @@ -3186,7 +3192,10 @@ static void task_show (const WIN_t *q, c
  27. MKCOL(p->ruser);
  28. break;
  29. case P_VRT:
  30. - MKCOL(scale_num(PAGES_TO_KB(p->size), w, s));
  31. + if (VIRT_vmsize)
  32. + MKCOL(scale_num(PAGES_TO_KB(p->vm_size), w, s));
  33. + else
  34. + MKCOL(scale_num(PAGES_TO_KB(p->size), w, s));
  35. break;
  36. case P_WCH:
  37. if (No_ksyms) {
  38. diff -up procps-3.2.7/top.1.p14 procps-3.2.7/top.1
  39. --- procps-3.2.7/top.1.p14 2006-06-19 06:33:51.000000000 +0200
  40. +++ procps-3.2.7/top.1 2008-09-01 11:36:55.000000000 +0200
  41. @@ -401,7 +401,8 @@ A task's currently used share of availab
  42. o:\fB VIRT\fR \*(EM Virtual Image (kb)
  43. The total amount of \*(MV used by the task.
  44. It includes all code, data and shared libraries plus pages that have been
  45. -swapped out.
  46. +swapped out. (Note: you can define the STATSIZE=1 environment variable and the VIRT
  47. +will be calculated from the /proc/#/state VmSize field.)
  48. VIRT = SWAP + RES.