misc: use 'VAL' macros to benefit from type validation

These 2 programs accessed newlib stacks directly which
meant incorrect result type specifications couldn't be
detected using our new result type validation feature.

And, while the usage was correct, to put each on a par
with all of our other programs, they now rely on those
newlib offered VAL macros for accessing stack results.

[ the ps and top programs retain direct stack access ]
[ when assignment to some result struct is necessary ]

[ PIDS_extra is used by top to store the forest view ]
[ level, while ps uses it for cooked cpu percentages ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2016-08-10 07:08:09 -05:00
committed by Craig Small
parent 3927600e0f
commit 41f7a90afd
2 changed files with 41 additions and 38 deletions

View File

@ -700,6 +700,7 @@ static void slabheader(void)
static void slabformat (void)
{
#define MAX_ITEMS (int)(sizeof(node_items) / sizeof(node_items[0]))
#define slabVAL(e,t) SLABINFO_VAL(e, t, p, slab_info)
struct slabinfo_info *slab_info;
struct slabinfo_reap *reaped;
int i, j;
@ -727,17 +728,18 @@ static void slabformat (void)
if (moreheaders && ((j % height) == 0))
slabheader();
printf("%-24.24s %6u %6u %6u %6u\n",
p->head[slab_NAME ].result.str,
p->head[slab_AOBJS].result.u_int,
p->head[slab_OBJS ].result.u_int,
p->head[slab_OSIZE].result.u_int,
p->head[slab_OPS ].result.u_int);
slabVAL(slab_NAME, str),
slabVAL(slab_AOBJS, u_int),
slabVAL(slab_OBJS, u_int),
slabVAL(slab_OSIZE, u_int),
slabVAL(slab_OPS, u_int));
}
if (infinite_updates || i+1 < num_updates)
sleep(sleep_time);
}
procps_slabinfo_unref(&slab_info);
#undef MAX_ITEMS
#undef slabVAL
}
static void disksum_format(void)