diff options
author | msmith <msmith@FreeBSD.org> | 1999-12-28 06:38:37 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1999-12-28 06:38:37 +0000 |
commit | d73a0504893e9c7c0af5ee1dd71676c3b186090c (patch) | |
tree | aee6a4fcc4c34b45ef0118254eb44a6c388ed318 /usr.bin | |
parent | 04d30dbb4986de518a295e91749baa37767b3075 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | usr.bin/netstat/mbuf.c | 14 |
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; |