Fix fixed value of smaps line count 95/96795/1
authorHyeongsik Min <hyeongsik.min@samsung.com>
Thu, 10 Nov 2016 07:47:29 +0000 (16:47 +0900)
committerHyeongsik Min <hyeongsik.min@samsung.com>
Thu, 10 Nov 2016 07:47:29 +0000 (16:47 +0900)
Vma line was missed, so we need to add 1 on each hardcoded value.

Change-Id: I735bc0aaa312e034655534a78b456a35c5ce9fdb
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
memps.c

diff --git a/memps.c b/memps.c
index deee6d3..12de206 100644 (file)
--- a/memps.c
+++ b/memps.c
@@ -110,7 +110,7 @@ struct geminfo {
        unsigned hcount;
 };
 
-static int smaps_field_lcnt;
+static int smaps_lcnt;
 static int sum;
 static int verbos;
 
@@ -657,7 +657,7 @@ mapinfo *load_maps(int pid)
        if (smaps == NULL)
                return 0;
 
-       while ((mi = read_mapinfo(&smaps, smaps_field_lcnt)) != 0) {
+       while ((mi = read_mapinfo(&smaps, smaps_lcnt)) != 0) {
                if (milist) {
                        if ((!strcmp(mi->name, milist->name)
                             && (mi->name[0] != '['))) {
@@ -1203,40 +1203,40 @@ int get_fixed_smaps_lcnt(void)
 
                if (buf.release[0] >= '4') {
                        if (sub_version >= 4)
-                               ret = 18;
-                               /* Size, Rss, Pss, Shared_Clean, Shard_Dirty,
+                               ret = 19;
+                               /* Vma, Size, Rss, Pss, Shared_Clean, Shard_Dirty,
                                 * Private_Clean, Private_Drity,
                                 * Referenced, Anonymous, AnonHugePages, Shared_Hugetlb,
                                 * Private_Hugetlb, Swap, SwapPss, KernelPageSize,
                                 * MMUPageSize, Locked, VmFlags */
                        else if (sub_version == 3)
-                               ret = 16;
-                               /* Size, Rss, Pss, Shared_Clean, Shard_Dirty,
+                               ret = 17;
+                               /* Vma, Size, Rss, Pss, Shared_Clean, Shard_Dirty,
                                 * Private_Clean, Private_Drity,
                                 * Referenced, Anonymous, AnonHugePages, Swap, SwapPss,
                                 * KernelPageSize, MMUPageSize, Locked, VmFlags */
                        else
-                               ret = 15;
-                               /* Size, Rss, Pss, Shared_Clean, Shard_Dirty,
+                               ret = 16;
+                               /* Vma, Size, Rss, Pss, Shared_Clean, Shard_Dirty,
                                 * Private_Clean, Private_Drity,
                                 * Referenced, Anonymous, AnonHugePages, Swap,
                                 * KernelPageSize, MMUPageSize, Locked, VmFlags */
                } else if (buf.release[0] == '3') {
                        if (sub_version >= 10)
-                               ret = 15;
-                               /* Size, Rss, Pss, Shared_Clean, Shard_Dirty,
+                               ret = 16;
+                               /* Vma, Size, Rss, Pss, Shared_Clean, Shard_Dirty,
                                 * Private_Clean, Private_Drity,
                                 * Referenced, Anonymous, AnonHugePages, Swap,
                                 * KernelPageSize, MMUPageSize, Locked, VmFlags */
                        else
-                               ret = 14;
-                               /* Size, Rss, Pss, Shared_Clean, Shard_Dirty,
+                               ret = 15;
+                               /* Vma, Size, Rss, Pss, Shared_Clean, Shard_Dirty,
                                 * Private_Clean, Private_Drity,
                                 * Referenced, Anonymous, AnonHugePages, Swap,
                                 * KernelPageSize, MMUPageSize, Locked */
                } else {
-                       ret = 11;
-                               /* Size, Rss, Pss, Shared_Clean, Shard_Dirty,
+                       ret = 12;
+                               /* Vma, Size, Rss, Pss, Shared_Clean, Shard_Dirty,
                                 * Private_Clean, Private_Drity,
                                 * Referenced, Swap, KernelPageSize, MMUPageSize */
                }
@@ -1287,7 +1287,7 @@ int main(int argc, char *argv[])
        sum = 0;
 
        if (argc > 1) {
-               smaps_field_lcnt = get_smaps_lcnt();
+               smaps_lcnt = get_smaps_lcnt();
 
                if (!strncmp(argv[1], "-r", strlen("-r")+1)) {
                        if (argc >= 3)