misc: adapt additional programs to changes, <STAT> api

This patch brings the ps program (very small impact) &
that vmstat program (major impact) into agreement with
the new <stat> API. In the case of the latter guy, the
many separate calls to 'get' should be replaced by one
single 'select' call obtaining all data in one stroke.

[ but, i was too tired to undertake that enhancement ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2016-05-06 00:00:00 -05:00
committed by Craig Small
parent 6c2b95872f
commit 21360027e5
2 changed files with 55 additions and 71 deletions

View File

@@ -91,15 +91,11 @@ extern long Hertz;
static void get_boot_time(void)
{
struct procps_stat *sys_info;
if (procps_stat_new(&sys_info) < 0)
xerrx(EXIT_FAILURE,
_("Unable to create system stat structure"));
if (procps_stat_read(sys_info,0) < 0)
xerrx(EXIT_FAILURE,
_("Unable to read system stat information"));
boot_time = procps_stat_sys_get(sys_info, PROCPS_STAT_BTIME);
procps_stat_unref(&sys_info);
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);
procps_stat_unref(&stat_info);
}
static void get_memory_total()