diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2014-07-11 16:45:55 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2014-07-11 16:45:55 +0000 |
commit | e98e69f4b41326240c3a0b14b6ba2b21e619b877 (patch) | |
tree | 6448a6a976aae85b356674b4d04f2874648b29b3 /usr.bin | |
parent | 3593a45d0bb2754a64e8bab64cefa13d49e4ecb9 (diff) | |
download | FreeBSD-src-e98e69f4b41326240c3a0b14b6ba2b21e619b877.zip FreeBSD-src-e98e69f4b41326240c3a0b14b6ba2b21e619b877.tar.gz |
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
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/vmstat/vmstat.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index c089dbf..67f438e 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -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])); |