summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-03-29 21:51:55 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-03-29 21:51:55 +0000
commite8880d029cebac8827fe0228bf64b8a2ba3ad456 (patch)
tree29da612bc0f0d961e75e234fbfc289e03e1e4d72
parentef6e6b758d1e4ac7b958622f06ad771fd8a40068 (diff)
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);