summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2009-03-29 21:51:54 +0000
committerkettenis <kettenis@openbsd.org>2009-03-29 21:51:54 +0000
commit6dbde6b283f159b17597afd3720c1c585274f7a4 (patch)
treea5b4299eb5cca19f3eb47ba0b0995174d33e0367
parentUpdate spf_calc() for OSPFv3. (diff)
downloadwireguard-openbsd-6dbde6b283f159b17597afd3720c1c585274f7a4.tar.xz
wireguard-openbsd-6dbde6b283f159b17597afd3720c1c585274f7a4.zip
Make sure systat mbufs prints the interface name even if an interface only
allocates clusters larger than 2k. ok deraadt@
-rw-r--r--usr.bin/systat/mbufs.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/systat/mbufs.c b/usr.bin/systat/mbufs.c
index 82d42b4cc50..4897366653e 100644
--- a/usr.bin/systat/mbufs.c
+++ b/usr.bin/systat/mbufs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbufs.c,v 1.22 2009/01/27 09:18:37 dlg Exp $ */
+/* $OpenBSD: mbufs.c,v 1.23 2009/03/29 21:51:54 kettenis Exp $ */
/*
* Copyright (c) 2008 Can Erkin Acar <canacar@openbsd.org>
*
@@ -51,8 +51,7 @@ struct if_info {
void print_mb(void);
int read_mb(void);
int select_mb(void);
-static void
-showmbuf(struct if_info *, int);
+static void showmbuf(struct if_info *, int, int);
/* Define fields */
@@ -300,11 +299,13 @@ print_mb(void)
{
int i, p, n, count = 0;
- showmbuf(interfaces, -1);
+ showmbuf(interfaces, -1, 1);
for (n = i = 0; i < num_ifs; i++) {
struct if_info *ifi = &interfaces[i];
int pcnt = count;
+ int showif = i;
+
if (maxprint > 0 && count >= maxprint)
return;
@@ -313,7 +314,8 @@ print_mb(void)
if (mp->mcl_alive == 0)
continue;
if (n++ >= dispstart) {
- showmbuf(ifi, p);
+ showmbuf(ifi, p, showif);
+ showif = 0;
count++;
}
}
@@ -321,7 +323,7 @@ print_mb(void)
if (i && pcnt == count) {
/* only print the first line */
if (n++ >= dispstart) {
- showmbuf(ifi, -1);
+ showmbuf(ifi, -1, 1);
count++;
}
}
@@ -332,13 +334,12 @@ print_mb(void)
static void
-showmbuf(struct if_info *ifi, int p)
+showmbuf(struct if_info *ifi, int p, int showif)
{
int i;
- if (p == -1 || (p == 0 && ifi != interfaces)) {
+ if (showif)
print_fld_str(FLD_MB_IFACE, ifi->name);
- }
if (p == -1 && ifi == interfaces) {
print_fld_size(FLD_MB_MSIZE, mbpool.pr_size);