Module Name:    src
Committed By:   christos
Date:           Sat Feb  7 19:36:06 UTC 2015

Modified Files:
        src/usr.bin/netstat: Makefile inet.c inet6.c

Log Message:
print the timer flags.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/netstat/Makefile
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/netstat/inet.c
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/netstat/inet6.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/netstat/Makefile
diff -u src/usr.bin/netstat/Makefile:1.40 src/usr.bin/netstat/Makefile:1.41
--- src/usr.bin/netstat/Makefile:1.40	Thu Nov  6 16:30:09 2014
+++ src/usr.bin/netstat/Makefile	Sat Feb  7 14:36:06 2015
@@ -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 @@ SRCS=	atalk.c bpf.c fast_ipsec.c if.c in
 	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

Index: src/usr.bin/netstat/inet.c
diff -u src/usr.bin/netstat/inet.c:1.104 src/usr.bin/netstat/inet.c:1.105
--- src/usr.bin/netstat/inet.c:1.104	Sat Nov 23 17:01:12 2013
+++ src/usr.bin/netstat/inet.c	Sat Feb  7 14:36:06 2015
@@ -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 @@ __RCSID("$NetBSD: inet.c,v 1.104 2013/11
 #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 @@ tcp_dump(u_long off, const char *name, u
 
 	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");
 

Index: src/usr.bin/netstat/inet6.c
diff -u src/usr.bin/netstat/inet6.c:1.66 src/usr.bin/netstat/inet6.c:1.67
--- src/usr.bin/netstat/inet6.c:1.66	Sat Nov 23 17:01:12 2013
+++ src/usr.bin/netstat/inet6.c	Sat Feb  7 14:36:06 2015
@@ -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 @@ extern const char * const tcptimers[];
 #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 @@ tcp6_dump(u_long off, const char *name, 
 	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");
 

Reply via email to