]> granicus.if.org Git - procps-ng/commit
pmap: fixing broken indentation in the -X/-XX modes
authorJaromir Capik <jcapik@redhat.com>
Wed, 6 Feb 2013 22:01:54 +0000 (23:01 +0100)
committerJaromir Capik <jcapik@redhat.com>
Fri, 15 Feb 2013 17:51:13 +0000 (18:51 +0100)
commit20ce346ebde81acc091007a7e1bf3328a51a9d8f
tree8099fac8dba126addc61f2346c7f436bdcef73d1
parentca76af22ca2fc8e880317ad9dfd303ea791a2bd3
pmap: fixing broken indentation in the -X/-XX modes

This commit changes the processing principle of the -X/-XX modes
from 1-pass to 2-pass. A separate width measurement stage has been
added, so that the real maximum widths can be measured and used
for correct indentation.

The firstmapping variable now has a new value (2) used for the
width measurement stage (1st pass). The printing is disabled
in this stage. The file position is reset to the beginning
of the file once the end of file is reached and the printing stage
(2nd pass) begins.
It's questionable if this approach is sensitive to Read-after-Write
race conditions. Anyway, this feature is a good candidate for
a complete redesign in the future.

Additionally this commit introduces a final cleaning of the list
used for the evaluation of totals in the -X/-XX modes.
pmap.c