]> granicus.if.org Git - procps-ng/commitdiff
vmstat: Update memory statistics
authorIngo Saitz <ingo@hannover.ccc.de>
Fri, 6 Jan 2023 02:30:39 +0000 (13:30 +1100)
committerCraig Small <csmall@dropbear.xyz>
Fri, 6 Jan 2023 02:30:39 +0000 (13:30 +1100)
vmstat <n> would update most fields, but the memory statistics
were only fetched the first time.

References:
 https://bugs.debian.org/1027963

Signed-off-by: Craig Small <csmall@dropbear.xyz>
NEWS
src/vmstat.c

diff --git a/NEWS b/NEWS
index 8a2d6b0493abe27d3492c623e23706701252ea9d..d23922af03fc7fc68a284ef0e1d0e20fefe5a9d1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,10 @@
 procps-ng-NEXT
 ---------------
   * docs: Don't install English manpages twice
-  * skill: Match on -p again                               Debian #1025915
   * ps: c flag shows command name again                    Debian #1026326
+  * skill: Match on -p again                               Debian #1025915
+  * vmstat: Referesh memory statistics                     Debian #1027963
+
 procps-ng-4.0.2
 ---------------
   * library revision - 0:1:0
index 86109835b73351901d6b3342e12faf90f21f3127..d076cf219ea26611762be017806724a1801e49de 100644 (file)
@@ -468,6 +468,9 @@ static void new_format(void)
         pswpin[tog] = VMSTAT_GET(vm_info, VMSTAT_PSWPIN, ul_int);
         pswpout[tog] = VMSTAT_GET(vm_info, VMSTAT_PSWPOUT, ul_int);
 
+        if (!(mem_stack = procps_meminfo_select(mem_info, Mem_items, MAX_mem)))
+                xerrx(EXIT_FAILURE, _("Unable to select memory information"));
+
         if (t_option) {
             (void) time( &the_time );
             tm_ptr = localtime( &the_time );