Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/netstat use the same for the route metrics part, bot...
details: https://anonhg.NetBSD.org/src/rev/cd089d466fba
branches: trunk
changeset: 329002:cd089d466fba
user: christos <christos%NetBSD.org@localhost>
date: Mon Apr 28 15:41:15 2014 +0000
description:
use the same for the route metrics part, both in the sysctl and kmem paths.
>From Takahiro HAYASHI
diffstat:
usr.bin/netstat/main.c | 5 ++---
usr.bin/netstat/netstat.h | 4 +++-
usr.bin/netstat/route.c | 45 ++++++++++++++++++++++-----------------------
usr.bin/netstat/show.c | 4 +++-
4 files changed, 30 insertions(+), 28 deletions(-)
diffs (128 lines):
diff -r 6bdc895a910f -r cd089d466fba usr.bin/netstat/main.c
--- a/usr.bin/netstat/main.c Mon Apr 28 13:39:23 2014 +0000
+++ b/usr.bin/netstat/main.c Mon Apr 28 15:41:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.89 2014/04/24 14:56:29 christos Exp $ */
+/* $NetBSD: main.c,v 1.90 2014/04/28 15:41:15 christos Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94";
#else
-__RCSID("$NetBSD: main.c,v 1.89 2014/04/24 14:56:29 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.90 2014/04/28 15:41:15 christos Exp $");
#endif
#endif /* not lint */
@@ -356,7 +356,6 @@
#ifndef SMALL
gflag ||
#endif
- (rflag && vflag) ||
(pflag && tp->pr_sindex == N_PIMSTAT) ||
Pflag) {
/* These flags are not yet supported via sysctl(3). */
diff -r 6bdc895a910f -r cd089d466fba usr.bin/netstat/netstat.h
--- a/usr.bin/netstat/netstat.h Mon Apr 28 13:39:23 2014 +0000
+++ b/usr.bin/netstat/netstat.h Mon Apr 28 15:41:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netstat.h,v 1.49 2014/04/24 14:54:51 christos Exp $ */
+/* $NetBSD: netstat.h,v 1.50 2014/04/28 15:41:15 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -116,6 +116,8 @@
void pr_rthdr(int, int);
void pr_family(int);
+struct rt_metrics;
+void pr_rtrmx(struct rt_metrics *);
void rt_stats(u_long);
char *ns_phost(struct sockaddr *);
diff -r 6bdc895a910f -r cd089d466fba usr.bin/netstat/route.c
--- a/usr.bin/netstat/route.c Mon Apr 28 13:39:23 2014 +0000
+++ b/usr.bin/netstat/route.c Mon Apr 28 15:41:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.81 2014/04/24 14:56:29 christos Exp $ */
+/* $NetBSD: route.c,v 1.82 2014/04/28 15:41:15 christos Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-__RCSID("$NetBSD: route.c,v 1.81 2014/04/24 14:56:29 christos Exp $");
+__RCSID("$NetBSD: route.c,v 1.82 2014/04/28 15:41:15 christos Exp $");
#endif
#endif /* not lint */
@@ -286,27 +286,26 @@
rt->rt_nodes[0].rn_dupedkey ? " =>" : "");
}
putchar('\n');
- if (vflag) {
- printf("\texpire %10"PRId64"%c recvpipe %10"PRIu64"%c "
- "sendpipe %10"PRIu64"%c\n",
- (int64_t)rt->rt_rmx.rmx_expire,
- (rt->rt_rmx.rmx_locks & RTV_EXPIRE) ? 'L' : ' ',
- rt->rt_rmx.rmx_recvpipe,
- (rt->rt_rmx.rmx_locks & RTV_RPIPE) ? 'L' : ' ',
- rt->rt_rmx.rmx_sendpipe,
- (rt->rt_rmx.rmx_locks & RTV_SPIPE) ? 'L' : ' ');
- printf("\tssthresh %10"PRIu64"%c rtt %10"PRIu64"%c "
- "rttvar %10"PRIu64"%c\n",
- rt->rt_rmx.rmx_ssthresh,
- (rt->rt_rmx.rmx_locks & RTV_SSTHRESH) ? 'L' : ' ',
- rt->rt_rmx.rmx_rtt,
- (rt->rt_rmx.rmx_locks & RTV_RTT) ? 'L' : ' ',
- rt->rt_rmx.rmx_rttvar,
- (rt->rt_rmx.rmx_locks & RTV_RTTVAR) ? 'L' : ' ');
- printf("\thopcount %10"PRIu64"%c\n",
- rt->rt_rmx.rmx_hopcount,
- (rt->rt_rmx.rmx_locks & RTV_HOPCOUNT) ? 'L' : ' ');
- }
+ if (vflag)
+ pr_rtrmx(&rt->rt_rmx);
+}
+
+void
+pr_rtrmx(struct rt_metrics *rmx)
+{
+ printf("\texpire %10"PRId64"%c recvpipe %10"PRIu64"%c "
+ "sendpipe %10"PRIu64"%c\n",
+ (int64_t)rmx->rmx_expire,
+ (rmx->rmx_locks & RTV_EXPIRE) ? 'L' : ' ', rmx->rmx_recvpipe,
+ (rmx->rmx_locks & RTV_RPIPE) ? 'L' : ' ', rmx->rmx_sendpipe,
+ (rmx->rmx_locks & RTV_SPIPE) ? 'L' : ' ');
+ printf("\tssthresh %10"PRIu64"%c rtt %10"PRIu64"%c "
+ "rttvar %10"PRIu64"%c\n", rmx->rmx_ssthresh,
+ (rmx->rmx_locks & RTV_SSTHRESH) ? 'L' : ' ',
+ rmx->rmx_rtt, (rmx->rmx_locks & RTV_RTT) ? 'L' : ' ',
+ rmx->rmx_rttvar, (rmx->rmx_locks & RTV_RTTVAR) ? 'L' : ' ');
+ printf("\thopcount %10"PRIu64"%c\n",
+ rmx->rmx_hopcount, (rmx->rmx_locks & RTV_HOPCOUNT) ? 'L' : ' ');
}
/*
diff -r 6bdc895a910f -r cd089d466fba usr.bin/netstat/show.c
--- a/usr.bin/netstat/show.c Mon Apr 28 13:39:23 2014 +0000
+++ b/usr.bin/netstat/show.c Mon Apr 28 15:41:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: show.c,v 1.18 2013/10/19 15:56:06 christos Exp $ */
+/* $NetBSD: show.c,v 1.19 2014/04/28 15:41:15 christos Exp $ */
/* $OpenBSD: show.c,v 1.1 2006/05/27 19:16:37 claudio Exp $ */
/*
@@ -273,6 +273,8 @@
p_tag(rti_info[RTAX_TAG]);
printf(" %.16s", if_indextoname(rtm->rtm_index, ifbuf));
putchar('\n');
+ if (vflag)
+ pr_rtrmx(&rtm->rtm_rmx);
}
/*
Home |
Main Index |
Thread Index |
Old Index