summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1997-02-12 19:33:22 +0000
committerwollman <wollman@FreeBSD.org>1997-02-12 19:33:22 +0000
commit98eca9a3c53014ebb1a2b6617f2d9d9bc9c21f6f (patch)
treee9b9a6a1d49f276c77464390a4a17ea841ced821 /usr.bin/netstat
parent26162e68c8ce4aae8503a391bc8d795aed052dc0 (diff)
downloadFreeBSD-src-98eca9a3c53014ebb1a2b6617f2d9d9bc9c21f6f.zip
FreeBSD-src-98eca9a3c53014ebb1a2b6617f2d9d9bc9c21f6f.tar.gz
When the mbuf code was changed to use a private allocator instead of
the kernel malloc, netstat was never updated to reflect the fact that there are once again allocated-but-free mbufs, just as there are clusters, and so the information presented about how much memory was allocated to the network was bogus. Fixed.
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/mbuf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c
index 54d48b6..cd751da 100644
--- a/usr.bin/netstat/mbuf.c
+++ b/usr.bin/netstat/mbuf.c
@@ -96,7 +96,7 @@ mbpr(mbaddr)
totmbufs = 0;
for (mp = mbtypes; mp->mt_name; mp++)
totmbufs += mbstat.m_mtypes[mp->mt_type];
- printf("%u mbufs in use:\n", totmbufs);
+ printf("%u/%u mbufs in use:\n", totmbufs, mbstat.m_mbufs);
for (mp = mbtypes; mp->mt_name; mp++)
if (mbstat.m_mtypes[mp->mt_type]) {
seen[mp->mt_type] = YES;
@@ -111,8 +111,9 @@ mbpr(mbaddr)
}
printf("%lu/%lu mbuf clusters in use\n",
mbstat.m_clusters - mbstat.m_clfree, mbstat.m_clusters);
- totmem = totmbufs * MSIZE + mbstat.m_clusters * MCLBYTES;
- totfree = mbstat.m_clfree * MCLBYTES;
+ totmem = mbstat.m_mbufs * MSIZE + mbstat.m_clusters * MCLBYTES;
+ totfree = mbstat.m_clfree * MCLBYTES +
+ MSIZE * (mbstat.m_mbufs - totmbufs);
printf("%u Kbytes allocated to network (%d%% in use)\n",
totmem / 1024, (totmem - totfree) * 100 / totmem);
printf("%lu requests for memory denied\n", mbstat.m_drops);
OpenPOWER on IntegriCloud