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 the timer flags.



details:   https://anonhg.NetBSD.org/src/rev/1ea6f7eae9aa
branches:  trunk
changeset: 336035:1ea6f7eae9aa
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Feb 07 19:36:06 2015 +0000

description:
print the timer flags.

diffstat:

 usr.bin/netstat/Makefile |   6 +++---
 usr.bin/netstat/inet.c   |  15 ++++++++++-----
 usr.bin/netstat/inet6.c  |  15 ++++++++++-----
 3 files changed, 23 insertions(+), 13 deletions(-)

diffs (108 lines):

diff -r 461369fc32d0 -r 1ea6f7eae9aa usr.bin/netstat/Makefile
--- a/usr.bin/netstat/Makefile  Sat Feb 07 17:58:23 2015 +0000
+++ b/usr.bin/netstat/Makefile  Sat Feb 07 19:36:06 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.40 2014/11/06 21:30:09 christos Exp $
+#      $NetBSD: Makefile,v 1.41 2015/02/07 19:36:06 christos Exp $
 #      from: @(#)Makefile      8.1 (Berkeley) 6/12/93
 
 .include <bsd.own.mk>
@@ -11,8 +11,8 @@
        unix.c vtw.c rtutil.c
 BINGRP=        kmem
 BINMODE=2555
-LDADD= -lkvm
-DPADD= ${LIBKVM}
+LDADD= -lutil -lkvm
+DPADD= ${LIBUTIL} ${LIBKVM}
 CPPFLAGS+= -DIPSEC -I${.CURDIR}
 CPPFLAGS+= -I${NETBSDSRCDIR}/sys/dist/pf
 CPPFLAGS+= -I${NETBSDSRCDIR}/sbin/route
diff -r 461369fc32d0 -r 1ea6f7eae9aa usr.bin/netstat/inet.c
--- a/usr.bin/netstat/inet.c    Sat Feb 07 17:58:23 2015 +0000
+++ b/usr.bin/netstat/inet.c    Sat Feb 07 19:36:06 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inet.c,v 1.104 2013/11/23 22:01:12 christos Exp $      */
+/*     $NetBSD: inet.c,v 1.105 2015/02/07 19:36:06 christos Exp $      */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)inet.c       8.4 (Berkeley) 4/20/94";
 #else
-__RCSID("$NetBSD: inet.c,v 1.104 2013/11/23 22:01:12 christos Exp $");
+__RCSID("$NetBSD: inet.c,v 1.105 2015/02/07 19:36:06 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -87,6 +87,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <err.h>
+#include <util.h>
 #include "netstat.h"
 #include "vtw.h"
 #include "prog_ops.h"
@@ -982,10 +983,14 @@
 
        printf("Timers:\n");
        for (i = 0; i < TCPT_NTIMERS; i++) {
+               char buf[128];
                ci = (callout_impl_t *)&tcpcb.t_timer[i];
-               printf("\t%s: %d", tcptimers[i],
-                   (ci->c_flags & CALLOUT_PENDING) ?
-                   ci->c_time - hardticks : 0);
+               snprintb(buf, sizeof(buf), CALLOUT_FMT, ci->c_flags);
+               printf("\t%s\t%s", tcptimers[i], buf);
+               if (ci->c_flags & CALLOUT_PENDING)
+                       printf("\t%d\n", ci->c_time - hardticks);
+               else
+                       printf("\n");
        }
        printf("\n\n");
 
diff -r 461369fc32d0 -r 1ea6f7eae9aa usr.bin/netstat/inet6.c
--- a/usr.bin/netstat/inet6.c   Sat Feb 07 17:58:23 2015 +0000
+++ b/usr.bin/netstat/inet6.c   Sat Feb 07 19:36:06 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inet6.c,v 1.66 2013/11/23 22:01:12 christos Exp $      */
+/*     $NetBSD: inet6.c,v 1.67 2015/02/07 19:36:06 christos Exp $      */
 /*     BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp   */
 
 /*
@@ -64,7 +64,7 @@
 #if 0
 static char sccsid[] = "@(#)inet.c     8.4 (Berkeley) 4/20/94";
 #else
-__RCSID("$NetBSD: inet6.c,v 1.66 2013/11/23 22:01:12 christos Exp $");
+__RCSID("$NetBSD: inet6.c,v 1.67 2015/02/07 19:36:06 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -135,6 +135,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <util.h>
 #include "netstat.h"
 #include "vtw.h"
 #include "prog_ops.h"
@@ -1468,10 +1469,14 @@
        printf("TCP Protocol Control Block at 0x%08lx:\n\n", pcbaddr);
        printf("Timers:\n");
        for (i = 0; i < TCP6T_NTIMERS; i++) {
+               char buf[128];
                ci = (callout_impl_t *)&tcpcb.t_timer[i];
-               printf("\t%s: %d", tcptimers[i],
-                   (ci->c_flags & CALLOUT_PENDING) ?
-                   ci->c_time - hardticks : 0);
+               snprintb(buf, sizeof(buf), CALLOUT_FMT, ci->c_flags);
+               printf("\t%s\t%s", tcptimers[i], buf);
+               if (ci->c_flags & CALLOUT_PENDING)
+                       printf("\t%d\n", ci->c_time - hardticks);
+               else
+                       printf("\n");
        }
        printf("\n\n");
 



Home | Main Index | Thread Index | Old Index