]> granicus.if.org Git - procps-ng/commit
library: some tweaks to 2 file read functions, 3rd gen
authorJim Warner <james.warner@comcast.net>
Sun, 3 Jul 2016 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Wed, 6 Jul 2016 11:36:37 +0000 (21:36 +1000)
commita6115bfff4e91766d7295658d864d391cb9d73da
tree5d5eee820826b4641e9c1a7f062e42c71c02106e
parent62abd1d88ba54bb767c883c183163eaa49bff53a
library: some tweaks to 2 file read functions, 3rd gen

Ever since their introduction, plus continuing through
several evolutions, both the meminfo and vmstat 'read'
functions employed a 'do while' loop for /proc access.

However, that loop construct was wrong since identical
tests were already done (twice!) within each loop body
itself, then accompanied by its own 'break' statement.

So, we will now transform them both into forever loops
which will help us to emphasize such break statements.

[ plus, let's return an error should nothing be read ]

[ lastly, eliminate 1 erroneous PROCPS_EXPORT prefix ]

Reference(s):
. original meminfo introduction
commit a20e88e4e72067c1138721c6e15e2d1130bc9595
. original vmstat introduction
commit a410e236abb47c7c43194e61d0566686f81513af

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/meminfo.c
proc/vmstat.c