]> granicus.if.org Git - procps-ng/commit
library: introduced 'Item_table' validation provisions
authorJim Warner <james.warner@comcast.net>
Mon, 10 Aug 2020 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Thu, 13 Aug 2020 11:08:58 +0000 (21:08 +1000)
commit92d0297e1e4d5946c5b098e37c91c7e524a0eca0
treede9283a869330be0169af608817313659c90257a
parentc865b06c304e645c05eae0f5e06a1f49ea105285
library: introduced 'Item_table' validation provisions

The recent work on updating the <meminfo> and <vmstat>
modules with some newly added linux fields reminded me
(again) of a need for some mechanism guaranteeing that
a header file agrees with the source file assumptions.

Sadly, in the past, if a table entry was omitted or if
the table and header are ordered differently, then the
library would silently return the wrong results values
or even potentially experience a SIGSEGV abnormal end.

This patch offers a much needed development assist for
ensuring that Item_table entries are synchronized with
header file enumerators in terms of number plus order.

It's intended solely for our use as libprocps evolves.

Now, by activating ITEMTABLE_DEBUG, either directly or
via ./configure CFLAGS='-DITEMTABLE_DEBUG', the number
and order will be verified. It is envisioned that this
feature will be used at least once prior to a release.

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