]> granicus.if.org Git - procps-ng/commitdiff
misc: adapt others to the changes in 'get' return type
authorJim Warner <james.warner@comcast.net>
Sat, 18 Jun 2016 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Tue, 21 Jun 2016 10:58:09 +0000 (20:58 +1000)
Signed-off-by: Jim Warner <james.warner@comcast.net>
free.c
ps/output.c
vmstat.c

diff --git a/free.c b/free.c
index baa1ac20b2ca37526396255f74c3d0443861e7b0..a37901155b8353ced88fe142af2efb6b78ae4000 100644 (file)
--- a/free.c
+++ b/free.c
@@ -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);
index 97f07f099ed402f0265490d81977905391a6918e..7318462a4d4400e244b34e444613f28014d85de9 100644 (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);
 }
 
index 2415343a6c30365cbd09b277ad2e6af24095cbd5..6bb200468f4d82c9e416d61c4d310114496849a0 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -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);
 }