summaryrefslogtreecommitdiff
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2002-06-30 20:27:17 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2002-06-30 20:27:17 +0000
commit523fd93fc29a97311a0b5c7d5ded450ee5d67a6b (patch)
tree11981e00458a220d88f932ba722a165ebb040ac9 /usr.bin/netstat
parent94d35d4de3f7126e8722e6cb5b21e6148dc7dfaa (diff)
Correctly retrieve mbuf statistics from the kernel.
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/mbuf.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c
index 53e73938834..5c813dc8ae1 100644
--- a/usr.bin/netstat/mbuf.c
+++ b/usr.bin/netstat/mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.c,v 1.15 2002/06/24 17:51:05 angelos Exp $ */
+/* $OpenBSD: mbuf.c,v 1.16 2002/06/30 20:27:16 angelos Exp $ */
/* $NetBSD: mbuf.c,v 1.9 1996/05/07 02:55:03 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)mbuf.c 8.1 (Berkeley) 6/6/93";
#else
-static char *rcsid = "$OpenBSD: mbuf.c,v 1.15 2002/06/24 17:51:05 angelos Exp $";
+static char *rcsid = "$OpenBSD: mbuf.c,v 1.16 2002/06/30 20:27:16 angelos Exp $";
#endif
#endif /* not lint */
@@ -119,6 +119,16 @@ mbpr(mbaddr, mbpooladdr, mclpooladdr)
return;
} else {
mib[0] = CTL_KERN;
+ mib[1] = KERN_MBSTAT;
+ size = sizeof(mbstat);
+
+ if (sysctl(mib, 2, &mbstat, &size, NULL, 0) < 0) {
+ printf("Can't retrieve mbuf statistics from the kernel: %s\n",
+ strerror(errno));
+ return;
+ }
+
+ mib[0] = CTL_KERN;
mib[1] = KERN_POOL;
mib[2] = KERN_POOL_NPOOLS;
size = sizeof(npools);