library: repair any broken stuff found during refactor

Rather than offer three separate patches, they've been
consolidated in this single commit. All are related in
that they surfaced while preparing a subsequent patch.

------------------------------------------------------
library: correct a broken '#if define', <SLABINFO> api

It was introduced (embarrassingly) in the patch below.

Reference(s):
commit 97d078a9af

------------------------------------------------------
library: correct a broken 'GET' macro, <DISKSTATS> api

In the patch referenced below, which purported to make
all the 'GET' macros robust, the 'DISKSTATS_GET' macro
was broken. A necessary parameter wasn't passed to the
subsequently invoked function: procps_diskstats_get().

Reference(s):
commit bef8c7fb70

------------------------------------------------------
library: correct a broken 'sort' func, <DISKSTATS> api

In the commit shown below, an attempt to normalize the
errno handling, the sort function inadvertently lost 1
crucial line of code which produces a consistent SEGV.

Reference(s):
commit 06be33b43e

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2019-03-11 00:00:00 -05:00 committed by Craig Small
parent 32f93b56b7
commit 47af06b52b
3 changed files with 6 additions and 2 deletions

View File

@ -989,7 +989,9 @@ PROCPS_EXPORT struct diskstats_stack **procps_diskstats_sort (
}
errno = 0;
parms.offset = offset;
parms.order = order;
qsort_r(stacks, numstacked, sizeof(void *), (QSR_t)Item_table[p->item].sortfunc, &parms);
return stacks;
} // end: procps_diskstats_sort

View File

@ -91,7 +91,7 @@ struct diskstats_reap {
#define DISKSTATS_TYPE_PARTITION -22222
#define DISKSTATS_GET( info, name, actual_enum, type ) ( { \
struct diskstats_result *r = procps_diskstats_get( info, actual_enum ); \
struct diskstats_result *r = procps_diskstats_get( info, name, actual_enum ); \
r ? r->result . type : 0; } )
#define DISKSTATS_VAL( relative_enum, type, stack, info ) \

View File

@ -584,6 +584,7 @@ static void slabinfo_itemize_stacks_all (
static inline int slabinfo_items_check_failed (
struct ext_support *this,
enum slabinfo_item *items,
int numitems)
{
@ -615,6 +616,7 @@ static inline int slabinfo_items_check_failed (
return 1;
if (items[i] >= SLABINFO_logical_end)
return 1;
(void)this;
#endif
}
@ -741,7 +743,7 @@ static int slabinfo_stacks_reconfig_maybe (
enum slabinfo_item *items,
int numitems)
{
if (slabinfo_items_check_failed(items, numitems))
if (slabinfo_items_check_failed(this, items, numitems))
return -1;
/* is this the first time or have things changed since we were last called?
if so, gotta' redo all of our stacks stuff ... */