From 032e1cec45baf26f9fcab0835526606daebe822f Mon Sep 17 00:00:00 2001 From: yasuoka Date: Fri, 7 Jul 2023 14:17:34 +0000 Subject: [PATCH] Expand the counters in struct mbstat from u_short to u_long. ok blumn mvs --- sys/sys/mbuf.h | 4 ++-- usr.bin/netstat/mbuf.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index c2002113a98..8e8fb131f58 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.259 2023/07/04 09:47:51 jsg Exp $ */ +/* $OpenBSD: mbuf.h,v 1.260 2023/07/07 14:17:34 yasuoka Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -372,7 +372,7 @@ struct mbstat { u_long m_drops; /* times failed to find space */ u_long m_wait; /* times waited for space */ u_long m_drain; /* times drained protocols for space */ - u_short m_mtypes[256]; /* type specific mbuf allocations */ + u_long m_mtypes[256]; /* type specific mbuf allocations */ }; #define MBSTAT_TYPES MT_NTYPES diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c index b52a76f596c..dfb7695b737 100644 --- a/usr.bin/netstat/mbuf.c +++ b/usr.bin/netstat/mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.c,v 1.43 2019/07/16 17:39:02 bluhm Exp $ */ +/* $OpenBSD: mbuf.c,v 1.44 2023/07/07 14:17:35 yasuoka Exp $ */ /* $NetBSD: mbuf.c,v 1.9 1996/05/07 02:55:03 thorpej Exp $ */ /* @@ -78,7 +78,7 @@ static struct mbtypes { { 0, 0 } }; -int nmbtypes = sizeof(mbstat.m_mtypes) / sizeof(short); +int nmbtypes = sizeof(mbstat.m_mtypes) / sizeof(u_long); bool seen[256]; /* "have we seen this type yet?" */ /* @@ -172,7 +172,7 @@ mbpr(void) for (mp = mbtypes; mp->mt_name; mp++) if (mbstat.m_mtypes[mp->mt_type]) { seen[mp->mt_type] = YES; - printf("\t%u mbuf%s allocated to %s\n", + printf("\t%lu mbuf%s allocated to %s\n", mbstat.m_mtypes[mp->mt_type], plural(mbstat.m_mtypes[mp->mt_type]), mp->mt_name); @@ -180,7 +180,7 @@ mbpr(void) seen[MT_FREE] = YES; for (i = 0; i < nmbtypes; i++) if (!seen[i] && mbstat.m_mtypes[i]) { - printf("\t%u mbuf%s allocated to \n", + printf("\t%lu mbuf%s allocated to \n", mbstat.m_mtypes[i], plural(mbstat.m_mtypes[i]), i); } -- 2.20.1