Author: bdrewery
Date: Fri Jul 11 16:45:55 2014
New Revision: 268533
URL: http://svnweb.freebsd.org/changeset/base/268533

Log:
  Fix vmstat -M after r263620 renamed 'cnt' to 'vm_cnt'.
  
  This was showing as:
    vmstat: undefined symbols:
     _cnt
  
  To remain backwards compatible with older dumps, if 'vm_cnt' symbol is not
  found then try again with 'cnt'.
  
  Reported by:  pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.bin/vmstat/vmstat.c

Modified: head/usr.bin/vmstat/vmstat.c
==============================================================================
--- head/usr.bin/vmstat/vmstat.c        Fri Jul 11 16:26:51 2014        
(r268532)
+++ head/usr.bin/vmstat/vmstat.c        Fri Jul 11 16:45:55 2014        
(r268533)
@@ -80,7 +80,7 @@ static char da[] = "da";
 
 static struct nlist namelist[] = {
 #define X_SUM          0
-       { "_cnt" },
+       { "_vm_cnt" },
 #define X_HZ           1
        { "_hz" },
 #define X_STATHZ       2
@@ -259,8 +259,18 @@ main(int argc, char *argv[])
                        errx(1, "kvm_openfiles: %s", errbuf);
        }
 
+retry_nlist:
        if (kd != NULL && (c = kvm_nlist(kd, namelist)) != 0) {
                if (c > 0) {
+                       /*
+                        * 'cnt' was renamed to 'vm_cnt'. If 'vm_cnt' is not
+                        * found try looking up older 'cnt' symbol.
+                        * */
+                       if (namelist[X_SUM].n_type == 0 &&
+                           strcmp(namelist[X_SUM].n_name, "_vm_cnt") == 0) {
+                               namelist[X_SUM].n_name = "_cnt";
+                               goto retry_nlist;
+                       }
                        warnx("undefined symbols:");
                        for (c = 0;
                             c < (int)(sizeof(namelist)/sizeof(namelist[0]));
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to