diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 2a21f6a8a5dc..65d58676ba12 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $NetBSD: inet.c,v 1.53 2003/02/03 23:37:09 thorpej Exp $ */ +/* $NetBSD: inet.c,v 1.54 2003/02/04 01:22:08 thorpej Exp $ */ /* * Copyright (c) 1983, 1988, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -__RCSID("$NetBSD: inet.c,v 1.53 2003/02/03 23:37:09 thorpej Exp $"); +__RCSID("$NetBSD: inet.c,v 1.54 2003/02/04 01:22:08 thorpej Exp $"); #endif #endif /* not lint */ @@ -660,17 +660,18 @@ tcp_dump(pcbaddr) u_long pcbaddr; { struct tcpcb tcpcb; - int i; + int i, hardticks; kread(pcbaddr, (char *)&tcpcb, sizeof(tcpcb)); + hardticks = get_hardticks(); printf("TCP Protocol Control Block at 0x%08lx:\n\n", pcbaddr); printf("Timers:\n"); for (i = 0; i < TCPT_NTIMERS; i++) { - printf("\t%s: %llu", tcptimers[i], + printf("\t%s: %d", tcptimers[i], (tcpcb.t_timer[i].c_flags & CALLOUT_PENDING) ? - (unsigned long long) tcpcb.t_timer[i].c_time : 0); + tcpcb.t_timer[i].c_time - hardticks : 0); } printf("\n\n"); diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index ff5e48fcded9..da821b6af0e4 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.38 2002/07/23 23:34:39 enami Exp $ */ +/* $NetBSD: main.c,v 1.39 2003/02/04 01:22:08 thorpej Exp $ */ /* * Copyright (c) 1983, 1988, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n\ #if 0 static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94"; #else -__RCSID("$NetBSD: main.c,v 1.38 2002/07/23 23:34:39 enami Exp $"); +__RCSID("$NetBSD: main.c,v 1.39 2003/02/04 01:22:08 thorpej Exp $"); #endif #endif /* not lint */ @@ -208,6 +208,8 @@ struct nlist nl[] = { { "_ppoeinq" }, #define N_PKINTRQ 68 { "_pkintrq" }, +#define N_HARDCLOCK_TICKS 69 + { "_hardclock_ticks" }, { "" }, }; @@ -750,6 +752,16 @@ plurales(n) return (n != 1 ? "es" : ""); } +int +get_hardticks(void) +{ + int hardticks; + + kread(nl[N_HARDCLOCK_TICKS].n_value, (char *)&hardticks, + sizeof(hardticks)); + return (hardticks); +} + /* * Find the protox for the given "well-known" name. */ diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index 82909667bc95..87dae3be02f5 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -1,4 +1,4 @@ -/* $NetBSD: netstat.h,v 1.25 2002/07/03 01:42:59 enami Exp $ */ +/* $NetBSD: netstat.h,v 1.26 2003/02/04 01:22:08 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -68,6 +68,7 @@ int af; /* address family */ int kread __P((u_long addr, char *buf, int size)); char *plural __P((int)); char *plurales __P((int)); +int get_hardticks __P((void)); void protopr __P((u_long, char *)); void tcp_stats __P((u_long, char *)); diff --git a/usr.sbin/trpt/trpt.c b/usr.sbin/trpt/trpt.c index c0551d27a5d8..55bcdf4e6d72 100644 --- a/usr.sbin/trpt/trpt.c +++ b/usr.sbin/trpt/trpt.c @@ -1,4 +1,4 @@ -/* $NetBSD: trpt.c,v 1.15 2003/02/04 00:20:50 thorpej Exp $ */ +/* $NetBSD: trpt.c,v 1.16 2003/02/04 01:22:10 thorpej Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -81,7 +81,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)trpt.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: trpt.c,v 1.15 2003/02/04 00:20:50 thorpej Exp $"); +__RCSID("$NetBSD: trpt.c,v 1.16 2003/02/04 01:22:10 thorpej Exp $"); #endif #endif /* not lint */ @@ -133,9 +133,11 @@ __RCSID("$NetBSD: trpt.c,v 1.15 2003/02/04 00:20:50 thorpej Exp $"); #include struct nlist nl[] = { -#define N_TCP_DEBUG 0 +#define N_HARDCLOCK_TICKS 0 + { "_hardclock_ticks" }, +#define N_TCP_DEBUG 1 { "_tcp_debug" }, -#define N_TCP_DEBX 1 +#define N_TCP_DEBX 2 { "_tcp_debx" }, { NULL }, }; @@ -515,12 +517,17 @@ skipact: if (tflag) { register char *cp = "\t"; register int i; + int hardticks; + + if (kvm_read(kd, nl[N_HARDCLOCK_TICKS].n_value, + (char *)&hardticks, sizeof(hardticks)) != sizeof(hardticks)) + errx(3, "hardclock_ticks: %s", kvm_geterr(kd)); for (i = 0; i < TCPT_NTIMERS; i++) { if ((tp->t_timer[i].c_flags & CALLOUT_PENDING) == 0) continue; - printf("%s%s=%llu", cp, tcptimers[i], - (unsigned long long) tp->t_timer[i].c_time); + printf("%s%s=%d", cp, tcptimers[i], + tp->t_timer[i].c_time - hardticks); if (i == TCPT_REXMT) printf(" (t_rxtshft=%d)", tp->t_rxtshift); cp = ", ";