summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1999-12-28 06:38:37 +0000
committermsmith <msmith@FreeBSD.org>1999-12-28 06:38:37 +0000
commitd73a0504893e9c7c0af5ee1dd71676c3b186090c (patch)
treeaee6a4fcc4c34b45ef0118254eb44a6c388ed318 /usr.bin/netstat
parent04d30dbb4986de518a295e91749baa37767b3075 (diff)
downloadFreeBSD-src-d73a0504893e9c7c0af5ee1dd71676c3b186090c.zip
FreeBSD-src-d73a0504893e9c7c0af5ee1dd71676c3b186090c.tar.gz
Add display of maximum allowed mbuf count to match mbuf cluster count.
Submitted by: Bosko Milekic <bmilekic@dsuper.net>
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/mbuf.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c
index 921b31a..a761c2e 100644
--- a/usr.bin/netstat/mbuf.c
+++ b/usr.bin/netstat/mbuf.c
@@ -103,8 +103,8 @@ mbpr()
register int totmem, totfree, totmbufs;
register int i;
register struct mbtypes *mp;
- int name[3], nmbclusters;
- size_t nmbclen, mbstatlen;
+ int name[3], nmbclusters, nmbufs;
+ size_t nmbclen, nmbuflen, mbstatlen;
name[0] = CTL_KERN;
name[1] = KERN_IPC;
@@ -121,6 +121,13 @@ mbpr()
warn("sysctl: retrieving nmbclusters");
return;
}
+
+ nmbuflen = sizeof(int);
+ if (sysctlbyname("kern.ipc.nmbufs", &nmbufs, &nmbuflen, 0, 0) < 0) {
+ warn("sysctl: retrieving nmbufs");
+ return;
+ }
+
#undef MSIZE
#define MSIZE (mbstat.m_msize)
#undef MCLBYTES
@@ -134,7 +141,8 @@ mbpr()
totmbufs = 0;
for (mp = mbtypes; mp->mt_name; mp++)
totmbufs += mbstat.m_mtypes[mp->mt_type];
- printf("%u/%lu mbufs in use:\n", totmbufs, mbstat.m_mbufs);
+ printf("%u/%lu/%u mbufs in use (current/peak/max):\n", totmbufs,
+ mbstat.m_mbufs, nmbufs);
for (mp = mbtypes; mp->mt_name; mp++)
if (mbstat.m_mtypes[mp->mt_type]) {
seen[mp->mt_type] = YES;
OpenPOWER on IntegriCloud