related: fix inconsistencies in result type references

This patch is a response to errors found in those type
references now that our library allows for validation.

In two cases, former assignments to a result structure
could no longer employ that VAL macro if validation is
active. Thus, direct reference to some stack was used.

For the record, those instances were to be found here:
. ps - uses PIDS_extra to store the cooked pcpu values
. top - uses PIDS_extra to store the forest view level

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2016-08-05 00:00:00 -05:00
committed by Craig Small
parent e3270d463d
commit 105058ae2d
4 changed files with 17 additions and 12 deletions

View File

@ -632,8 +632,8 @@ static void diskformat(void)
time_t the_time;
struct tm *tm_ptr;
char timebuf[32];
const char format[] = "%-5s %6lu %6lu %7lu %7lu %6lu %6lu %7lu %7lu %6lu %6lu";
const char wide_format[] = "%-5s %9lu %9lu %11lu %11lu %9lu %9lu %11lu %11lu %7lu %7lu";
const char format[] = "%-5s %6lu %6lu %7lu %7lu %6lu %6lu %7lu %7lu %6d %6lu";
const char wide_format[] = "%-5s %9lu %9lu %11lu %11lu %9lu %9lu %11lu %11lu %7d %7lu";
if (procps_diskstats_new(&disk_stat) < 0)
xerrx(EXIT_FAILURE, _("Unable to create diskstat structure"));
@ -664,7 +664,7 @@ static void diskformat(void)
diskVAL(disk_WRITE_MERGE, ul_int),
diskVAL(disk_WRITE_SECT, ul_int),
diskVAL(disk_WRITE_TIME, ul_int),
diskVAL(disk_IO, ul_int) / 1000,
diskVAL(disk_IO, s_int) / 1000,
diskVAL(disk_IO_TIME, ul_int) / 1000);
if (t_option)
printf(" %s\n", timebuf);
@ -775,7 +775,7 @@ static void disksum_format(void)
merged_writes += diskVAL(disk_WRITE_MERGE, ul_int);
written_sectors += diskVAL(disk_WRITE_SECT, ul_int);
milli_writing += diskVAL(disk_WRITE_TIME, ul_int);
inprogress_IO += diskVAL(disk_IO, ul_int) / 1000;
inprogress_IO += diskVAL(disk_IO, s_int) / 1000;
milli_spent_IO += diskVAL(disk_IO_TIME, ul_int) / 1000;
weighted_milli_spent_IO += diskVAL(disk_IO_WTIME, ul_int) / 1000;
}