top: forest view contingency sentinal code added
authorJim Warner <james.warner@comcast.net>
Sun, 4 Dec 2011 17:50:38 +0000 (11:50 -0600)
committerCraig Small <csmall@enc.com.au>
Sun, 4 Dec 2011 21:44:46 +0000 (08:44 +1100)
top.c

diff --git a/top.c b/top.c
index c22d4f000506a4d99b0ac04106d20fca22b44e1e..49b126b5997773e14c1b217d93471f3ff4f992af 100644 (file)
--- a/top.c
+++ b/top.c
@@ -3137,6 +3137,13 @@ static void forest_create (WIN_t *q) {
       }
       while (0 == Seed_ppt[i]->ppid)        // identify trees (expect 2)
          forest_add(i++, 0);                // add parent plus children
+      if (Frame_maxtask != Tree_idx) {      // guard against contingencies
+         error_exit(fmtmk(                  // in future kernels
+            "An anomaly was encountered, please see\n\t"
+            "http://www.debian.org/Bugs/Reporting\n\t"
+            "and note: 'Frame_maxtask(%d) != Tree_idx(%d)'\n"
+               , Frame_maxtask, Tree_idx));
+      }
    }
    memcpy(Seed_ppt, Tree_ppt, sizeof(proc_t*) * Frame_maxtask);
 } // end: forest_create