From: Mike Karels Date: Tue, 26 Sep 1989 07:52:38 +0000 (-0800) Subject: checkpoint for alpha tape (by sklower) X-Git-Tag: BSD-4_3_Reno-Snapshot-Development~5277 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/a65693cc20b356343001e8251e1677b0288619c3?ds=inline checkpoint for alpha tape (by sklower) SCCS-vsn: usr.bin/netstat/mbuf.c 5.7 --- diff --git a/usr/src/usr.bin/netstat/mbuf.c b/usr/src/usr.bin/netstat/mbuf.c index f8889f0949..ca229c10fa 100644 --- a/usr/src/usr.bin/netstat/mbuf.c +++ b/usr/src/usr.bin/netstat/mbuf.c @@ -16,7 +16,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)mbuf.c 5.6 (Berkeley) %G%"; +static char sccsid[] = "@(#)mbuf.c 5.7 (Berkeley) %G%"; #endif /* not lint */ #include @@ -33,17 +33,19 @@ static struct mbtypes { char *mt_name; } mbtypes[] = { { MT_DATA, "data" }, + { MT_OOBDATA, "oob data" }, + { MT_CONTROL, "ancillary data" }, { MT_HEADER, "packet headers" }, - { MT_SOCKET, "socket structures" }, - { MT_PCB, "protocol control blocks" }, - { MT_RTABLE, "routing table entries" }, - { MT_HTABLE, "IMP host table entries" }, + { MT_SOCKET, "socket structures" }, /* XXX */ + { MT_PCB, "protocol control blocks" }, /* XXX */ + { MT_RTABLE, "routing table entries" }, /* XXX */ + { MT_HTABLE, "IMP host table entries" }, /* XXX */ { MT_ATABLE, "address resolution tables" }, - { MT_FTABLE, "fragment reassembly queue headers" }, + { MT_FTABLE, "fragment reassembly queue headers" }, /* XXX */ { MT_SONAME, "socket names and addresses" }, { MT_SOOPTS, "socket options" }, { MT_RIGHTS, "access rights" }, - { MT_IFADDR, "interface addresses" }, + { MT_IFADDR, "interface addresses" }, /* XXX */ { 0, 0 } }; @@ -73,30 +75,26 @@ mbpr(mbaddr) printf("mbstat: bad read\n"); return; } - printf("%u/%u mbufs in use:\n", - mbstat.m_mbufs - mbstat.m_mtypes[MT_FREE], mbstat.m_mbufs); totmbufs = 0; + for (mp = mbtypes; mp->mt_name; mp++) + totmbufs += mbstat.m_mtypes[mp->mt_type]; + printf("%u mbufs in use:\n", totmbufs); for (mp = mbtypes; mp->mt_name; mp++) if (mbstat.m_mtypes[mp->mt_type]) { seen[mp->mt_type] = YES; printf("\t%u mbufs allocated to %s\n", mbstat.m_mtypes[mp->mt_type], mp->mt_name); - totmbufs += mbstat.m_mtypes[mp->mt_type]; } seen[MT_FREE] = YES; for (i = 0; i < nmbtypes; i++) if (!seen[i] && mbstat.m_mtypes[i]) { printf("\t%u mbufs allocated to \n", mbstat.m_mtypes[i], i); - totmbufs += mbstat.m_mtypes[i]; } - if (totmbufs != mbstat.m_mbufs - mbstat.m_mtypes[MT_FREE]) - printf("*** %u mbufs missing ***\n", - (mbstat.m_mbufs - mbstat.m_mtypes[MT_FREE]) - totmbufs); printf("%u/%u mapped pages in use\n", mbstat.m_clusters - mbstat.m_clfree, mbstat.m_clusters); - totmem = mbstat.m_mbufs * MSIZE + mbstat.m_clusters * CLBYTES; - totfree = mbstat.m_mtypes[MT_FREE]*MSIZE + mbstat.m_clfree * CLBYTES; + totmem = totmbufs * MSIZE + mbstat.m_clusters * CLBYTES; + totfree = mbstat.m_clfree * CLBYTES; printf("%u Kbytes allocated to network (%d%% in use)\n", totmem / 1024, (totmem - totfree) * 100 / totmem); printf("%u requests for memory denied\n", mbstat.m_drops);