misc: adapt others to the changes in 'get' return type

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-06-18 00:00:00 -05:00 committed by Craig Small
parent e41b40e6b0
commit 428ef496a6
3 changed files with 43 additions and 43 deletions

48
free.c
View File

@ -367,20 +367,20 @@ int main(int argc, char **argv)
}
printf("\n");
printf("%-7s", _("Mem:"));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_TOTAL), flags, args));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_USED), flags, args));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_FREE), flags, args));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_SHARED), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_USED, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_FREE, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_SHARED, ul_int), flags, args));
if (flags & FREE_WIDE) {
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_BUFFERS),
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_BUFFERS, ul_int),
flags, args));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_CACHED)
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_CACHED, ul_int)
, flags, args));
} else {
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_BUFFERS)+
procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_CACHED), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_BUFFERS, ul_int) +
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_CACHED, ul_int), flags, args));
}
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_AVAILABLE), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_AVAILABLE, ul_int), flags, args));
printf("\n");
/*
* Print low vs. high information, if the user requested it.
@ -390,35 +390,35 @@ int main(int argc, char **argv)
*/
if (flags & FREE_LOHI) {
printf("%-7s", _("Low:"));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEMLO_TOTAL), flags, args));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEMLO_USED), flags, args));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEMLO_FREE), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMLO_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMLO_USED, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMLO_FREE, ul_int), flags, args));
printf("\n");
printf("%-7s", _("High:"));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEMHI_TOTAL), flags, args));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEMHI_USED), flags, args));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEMHI_FREE), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMHI_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMHI_USED, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMHI_FREE, ul_int), flags, args));
printf("\n");
}
printf("%-7s", _("Swap:"));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_SWAP_TOTAL), flags, args));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_SWAP_USED), flags, args));
printf(" %11s", scale_size(procps_meminfo_get(mem_info, PROCPS_MEMINFO_SWAP_FREE), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_USED, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_FREE, ul_int), flags, args));
printf("\n");
if (flags & FREE_TOTAL) {
printf("%-7s", _("Total:"));
printf(" %11s", scale_size(
procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_TOTAL)+
procps_meminfo_get(mem_info, PROCPS_MEMINFO_SWAP_TOTAL), flags, args));
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_TOTAL, ul_int) +
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(
procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_USED)+
procps_meminfo_get(mem_info, PROCPS_MEMINFO_SWAP_USED), flags, args));
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_USED, ul_int) +
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_USED, ul_int), flags, args));
printf(" %11s", scale_size(
procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_FREE)+
procps_meminfo_get(mem_info, PROCPS_MEMINFO_SWAP_FREE), flags, args));
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_FREE, ul_int) +
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_FREE, ul_int), flags, args));
printf("\n");
}
fflush(stdout);

View File

@ -94,7 +94,7 @@ static void get_boot_time(void)
struct procps_statinfo *stat_info = NULL;
if (procps_stat_new(&stat_info) < 0)
xerrx(EXIT_FAILURE, _("Unable to create NEW ystem stat structure"));
boot_time = procps_stat_get(stat_info, PROCPS_STAT_SYS_TIME_OF_BOOT);
boot_time = PROCPS_STAT_GET(stat_info, PROCPS_STAT_SYS_TIME_OF_BOOT, ul_int);
procps_stat_unref(&stat_info);
}
@ -104,7 +104,7 @@ static void get_memory_total()
if (procps_meminfo_new(&mem_info) < 0)
xerrx(EXIT_FAILURE,
_("Unable to create meminfo structure"));
memory_total = procps_meminfo_get(mem_info, PROCPS_MEMINFO_MEM_TOTAL);
memory_total = PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_TOTAL, ul_int);
procps_meminfo_unref(&mem_info);
}

View File

@ -313,10 +313,10 @@ static void new_format(void)
cpu_iow = TICv(stat_IOW);
cpu_sto = TICv(stat_STO);
pgpgin[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGIN);
pgpgout[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGOUT);
pswpin[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPIN);
pswpout[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPOUT);
pgpgin[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGIN, ul_int);
pgpgout[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGOUT, ul_int);
pswpin[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPIN, ul_int);
pswpout[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPOUT, ul_int);
if ((mem_stack = procps_meminfo_select(mem_info, Mem_items, 6)) ==
NULL)
@ -337,10 +337,10 @@ static void new_format(void)
unitConvert(MEMv(mem_FREE)),
unitConvert((a_option?MEMv(mem_INA):MEMv(mem_BUF))),
unitConvert((a_option?MEMv(mem_ACT):MEMv(mem_CAC))),
(unsigned)( (unitConvert(procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPIN) * kb_per_page) * hz + divo2) / Div ),
(unsigned)( (unitConvert(procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPOUT) * kb_per_page) * hz + divo2) / Div ),
(unsigned)( (procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGIN) * hz + divo2) / Div ),
(unsigned)( (procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGOUT) * hz + divo2) / Div ),
(unsigned)( (unitConvert(PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPIN, ul_int) * kb_per_page) * hz + divo2) / Div ),
(unsigned)( (unitConvert(PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPOUT, ul_int) * kb_per_page) * hz + divo2) / Div ),
(unsigned)( (PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGIN, ul_int) * hz + divo2) / Div ),
(unsigned)( (PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGOUT, ul_int) * hz + divo2) / Div ),
(unsigned)( (SYSv(stat_INT) * hz + divo2) / Div ),
(unsigned)( (SYSv(stat_CTX) * hz + divo2) / Div ),
(unsigned)( (100*cpu_use + divo2) / Div ),
@ -372,10 +372,10 @@ static void new_format(void)
cpu_idl = DTICv(stat_IDL);
cpu_iow = DTICv(stat_IOW);
cpu_sto = DTICv(stat_STO);
pgpgin[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGIN);
pgpgout[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGOUT);
pswpin[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPIN);
pswpout[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPOUT);
pgpgin[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGIN, ul_int);
pgpgout[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGOUT, ul_int);
pswpin[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPIN, ul_int);
pswpout[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPOUT, ul_int);
if (t_option) {
(void) time( &the_time );
@ -846,10 +846,10 @@ static void sum_format(void)
printf(_("%13lld stolen cpu ticks\n"), TICv(sstat_STO));
printf(_("%13lld non-nice guest cpu ticks\n"), TICv(sstat_GST));
printf(_("%13lld nice guest cpu ticks\n"), TICv(sstat_GNI));
printf(_("%13lu pages paged in\n"), procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGIN));
printf(_("%13lu pages paged out\n"), procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGOUT));
printf(_("%13lu pages swapped in\n"), procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPIN));
printf(_("%13lu pages swapped out\n"), procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPOUT));
printf(_("%13lu pages paged in\n"), PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGIN, ul_int));
printf(_("%13lu pages paged out\n"), PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGOUT, ul_int));
printf(_("%13lu pages swapped in\n"), PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPIN, ul_int));
printf(_("%13lu pages swapped out\n"), PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPOUT, ul_int));
printf(_("%13lu interrupts\n"), SYSv(sstat_INT));
printf(_("%13lu CPU context switches\n"), SYSv(sstat_CTX));
printf(_("%13lu boot time\n"), SYSv(sstat_TOB));
@ -872,7 +872,7 @@ static void fork_format(void)
xerrx(EXIT_FAILURE,
_("Unable to create system stat structure"));
printf(_("%13lld forks\n"), procps_stat_get(sys_info, PROCPS_STAT_SYS_PROC_CREATED));
printf(_("%13lu forks\n"), PROCPS_STAT_GET(sys_info, PROCPS_STAT_SYS_PROC_CREATED, ul_int));
/* Cleanup */
procps_stat_unref(&sys_info);
}