Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/netstat Print iqdrops, too. This change also fixes a...



details:   https://anonhg.NetBSD.org/src/rev/5b209f32ed4d
branches:  trunk
changeset: 320536:5b209f32ed4d
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Jul 11 07:46:20 2018 +0000

description:
Print iqdrops, too. This change also fixes a bug that Odrops prints
iqdrops when kvm read failed.

diffstat:

 usr.bin/netstat/if.c |  31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diffs (69 lines):

diff -r f0eff90ec8ab -r 5b209f32ed4d usr.bin/netstat/if.c
--- a/usr.bin/netstat/if.c      Wed Jul 11 06:25:05 2018 +0000
+++ b/usr.bin/netstat/if.c      Wed Jul 11 07:46:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.94 2017/02/23 07:57:10 ozaki-r Exp $  */
+/*     $NetBSD: if.c,v 1.95 2018/07/11 07:46:20 msaitoh Exp $  */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
 #else
-__RCSID("$NetBSD: if.c,v 1.94 2017/02/23 07:57:10 ozaki-r Exp $");
+__RCSID("$NetBSD: if.c,v 1.95 2018/07/11 07:46:20 msaitoh Exp $");
 #endif
 #endif /* not lint */
 
@@ -152,14 +152,17 @@
                               "Ibytes", "Obytes");
                } else {
                        printf("%-5.5s %-5.5s %-13.13s %-17.17s "
-                              "%8.8s %5.5s %8.8s %5.5s %5.5s",
-                              "Name", "Mtu", "Network", "Address", "Ipkts", "Ierrs",
-                              "Opkts", "Oerrs", "Colls");
+                           "%8.8s %5.5s",
+                           "Name", "Mtu", "Network", "Address", "Ipkts", "Ierrs");
+                       if (dflag)
+                               printf(" %6.6s", "Idrops");
+                       printf(" %8.8s %5.5s %5.5s",
+                           "Opkts", "Oerrs", "Colls");
                }
+               if (dflag)
+                       printf(" %6.6s", "Odrops");
                if (tflag)
                        printf(" %4.4s", "Time");
-               if (dflag)
-                       printf(" %5.5s", "Drops");
                putchar('\n');
        }
 }
@@ -617,19 +620,21 @@
                else
                        printf("%10llu", (unsigned long long)ifd->ifi_obytes);
        } else {
-               printf("%8llu %5llu %8llu %5llu %5llu",
+               printf("%8llu %5llu",
                        (unsigned long long)ifd->ifi_ipackets,
-                       (unsigned long long)ifd->ifi_ierrors,
+                       (unsigned long long)ifd->ifi_ierrors);
+               if (dflag)
+                       printf(" %6" PRIu64, ifd->ifi_iqdrops);
+               printf(" %8llu %5llu %5llu",
                        (unsigned long long)ifd->ifi_opackets,
                        (unsigned long long)ifd->ifi_oerrors,
                        (unsigned long long)ifd->ifi_collisions);
        }
+       if (dflag)
+               printf(" %6lld", ifnet ?
+                   (unsigned long long)ifnet->if_snd.ifq_drops : 0);
        if (tflag)
                printf(" %4d", ifnet ? ifnet->if_timer : 0);
-       if (dflag)
-               printf(" %5lld", ifnet ?
-                   (unsigned long long)ifnet->if_snd.ifq_drops :
-                   ifd->ifi_iqdrops);
        putchar('\n');
 }
 



Home | Main Index | Thread Index | Old Index