summaryrefslogtreecommitdiffstats
path: root/freebsd/usr.bin
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-11-06 16:20:21 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-11-11 10:08:08 +0100
commit66659ff1ad6831b0ea7425fa6ecd8a8687523658 (patch)
tree48e22b475fa8854128e0861a33fed6f78c8094b5 /freebsd/usr.bin
parentDefine __GLOBL1() and __GLOBL() (diff)
downloadrtems-libbsd-66659ff1ad6831b0ea7425fa6ecd8a8687523658.tar.bz2
Update to FreeBSD 9.2
Diffstat (limited to 'freebsd/usr.bin')
-rw-r--r--freebsd/usr.bin/netstat/atalk.c4
-rw-r--r--freebsd/usr.bin/netstat/if.c12
-rw-r--r--freebsd/usr.bin/netstat/inet.c53
-rw-r--r--freebsd/usr.bin/netstat/inet6.c44
-rw-r--r--freebsd/usr.bin/netstat/ipsec.c4
-rw-r--r--freebsd/usr.bin/netstat/main.c26
-rw-r--r--freebsd/usr.bin/netstat/mbuf.c22
-rw-r--r--freebsd/usr.bin/netstat/netstat.h7
-rw-r--r--freebsd/usr.bin/netstat/pfkey.c4
-rw-r--r--freebsd/usr.bin/netstat/route.c4
-rw-r--r--freebsd/usr.bin/netstat/sctp.c2
-rw-r--r--freebsd/usr.bin/netstat/unix.c30
12 files changed, 115 insertions, 97 deletions
diff --git a/freebsd/usr.bin/netstat/atalk.c b/freebsd/usr.bin/netstat/atalk.c
index 811cb1ab..be73ca0c 100644
--- a/freebsd/usr.bin/netstat/atalk.c
+++ b/freebsd/usr.bin/netstat/atalk.c
@@ -12,10 +12,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
diff --git a/freebsd/usr.bin/netstat/if.c b/freebsd/usr.bin/netstat/if.c
index b39670e1..b026cb47 100644
--- a/freebsd/usr.bin/netstat/if.c
+++ b/freebsd/usr.bin/netstat/if.c
@@ -12,10 +12,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -211,7 +207,6 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
u_long ierrors;
u_long idrops;
u_long collisions;
- short timer;
int drops;
struct sockaddr *sa = NULL;
char name[IFNAMSIZ];
@@ -245,8 +240,6 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
if (bflag)
printf(" %10.10s","Obytes");
printf(" %5s", "Coll");
- if (tflag)
- printf(" %s", "Time");
if (dflag)
printf(" %s", "Drop");
putchar('\n');
@@ -298,7 +291,6 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
ierrors = ifnet.if_ierrors;
idrops = ifnet.if_iqdrops;
collisions = ifnet.if_collisions;
- timer = ifnet.if_timer;
drops = ifnet.if_snd.ifq_drops;
if (ifaddraddr == 0) {
@@ -450,8 +442,6 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
show_stat("lu", 10, obytes, link_layer|network_layer);
show_stat("NRSlu", 5, collisions, link_layer);
- if (tflag)
- show_stat("LSd", 4, timer, link_layer);
if (dflag)
show_stat("LSd", 4, drops, link_layer);
putchar('\n');
@@ -583,7 +573,7 @@ sidewaysintpr(int interval1, u_long off)
interesting = ip;
interesting_off = off;
}
- snprintf(ip->ift_name, sizeof(ip->ift_name), "(%s)", name);;
+ snprintf(ip->ift_name, sizeof(ip->ift_name), "(%s)", name);
if ((ipn = malloc(sizeof(struct iftot))) == NULL) {
printf("malloc failed\n");
exit(1);
diff --git a/freebsd/usr.bin/netstat/inet.c b/freebsd/usr.bin/netstat/inet.c
index eb734043..3dc57b08 100644
--- a/freebsd/usr.bin/netstat/inet.c
+++ b/freebsd/usr.bin/netstat/inet.c
@@ -12,10 +12,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -91,11 +87,11 @@ __FBSDID("$FreeBSD$");
char *inetname(struct in_addr *);
void inetprint(struct in_addr *, int, const char *, int);
#ifdef INET6
-static int udp_done, tcp_done;
+static int udp_done, tcp_done, sdp_done;
#endif /* INET6 */
static int
-pcblist_sysctl(int proto, char **bufp, int istcp)
+pcblist_sysctl(int proto, const char *name, char **bufp, int istcp)
{
const char *mibvar;
char *buf;
@@ -115,7 +111,8 @@ pcblist_sysctl(int proto, char **bufp, int istcp)
mibvar = "net.inet.raw.pcblist";
break;
}
-
+ if (strncmp(name, "sdp", 3) == 0)
+ mibvar = "net.inet.sdp.pcblist";
len = 0;
if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) {
if (errno != ENOENT)
@@ -314,15 +311,23 @@ protopr(u_long off, const char *name, int af1, int proto)
struct inpcb *inp;
struct xinpgen *xig, *oxig;
struct xsocket *so;
+ struct xtcp_timer *timer;
istcp = 0;
switch (proto) {
case IPPROTO_TCP:
#ifdef INET6
- if (tcp_done != 0)
- return;
- else
- tcp_done = 1;
+ if (strncmp(name, "sdp", 3) != 0) {
+ if (tcp_done != 0)
+ return;
+ else
+ tcp_done = 1;
+ } else {
+ if (sdp_done != 0)
+ return;
+ else
+ sdp_done = 1;
+ }
#endif
istcp = 1;
break;
@@ -336,7 +341,7 @@ protopr(u_long off, const char *name, int af1, int proto)
break;
}
if (live) {
- if (!pcblist_sysctl(proto, &buf, istcp))
+ if (!pcblist_sysctl(proto, name, &buf, istcp))
return;
} else {
if (!pcblist_kvm(off, &buf, istcp))
@@ -348,12 +353,14 @@ protopr(u_long off, const char *name, int af1, int proto)
xig->xig_len > sizeof(struct xinpgen);
xig = (struct xinpgen *)((char *)xig + xig->xig_len)) {
if (istcp) {
+ timer = &((struct xtcpcb *)xig)->xt_timer;
tp = &((struct xtcpcb *)xig)->xt_tp;
inp = &((struct xtcpcb *)xig)->xt_inp;
so = &((struct xtcpcb *)xig)->xt_socket;
} else {
inp = &((struct xinpcb *)xig)->xi_inp;
so = &((struct xinpcb *)xig)->xi_socket;
+ timer = NULL;
}
/* Ignore sockets for protocols other than the desired one. */
@@ -432,6 +439,9 @@ protopr(u_long off, const char *name, int af1, int proto)
"S-CLUS", "R-HIWA", "S-HIWA",
"R-LOWA", "S-LOWA", "R-BCNT",
"S-BCNT", "R-BMAX", "S-BMAX");
+ printf(" %7.7s %7.7s %7.7s %7.7s %7.7s %7.7s",
+ "rexmt", "persist", "keep",
+ "2msl", "delack", "rcvtime");
}
putchar('\n');
protopr_initialized = 1;
@@ -452,7 +462,10 @@ protopr(u_long off, const char *name, int af1, int proto)
#endif
vchar = ((inp->inp_vflag & INP_IPV4) != 0) ?
"4 " : " ";
- printf("%-3.3s%-2.2s ", name, vchar);
+ if (istcp && (tp->t_flags & TF_TOE) != 0)
+ printf("%-3.3s%-2.2s ", "toe", vchar);
+ else
+ printf("%-3.3s%-2.2s ", name, vchar);
if (Lflag) {
char buf1[15];
@@ -461,10 +474,8 @@ protopr(u_long off, const char *name, int af1, int proto)
printf("%-14.14s ", buf1);
} else if (Tflag) {
if (istcp)
- printf("%6ju %6ju %6u ",
- (uintmax_t)tp->t_sndrexmitpack,
- (uintmax_t)tp->t_rcvoopack,
- tp->t_sndzerowin);
+ printf("%6u %6u %6u ", tp->t_sndrexmitpack,
+ tp->t_rcvoopack, tp->t_sndzerowin);
} else {
printf("%6u %6u ", so->so_rcv.sb_cc, so->so_snd.sb_cc);
}
@@ -530,6 +541,14 @@ protopr(u_long off, const char *name, int af1, int proto)
so->so_rcv.sb_lowat, so->so_snd.sb_lowat,
so->so_rcv.sb_mbcnt, so->so_snd.sb_mbcnt,
so->so_rcv.sb_mbmax, so->so_snd.sb_mbmax);
+ if (timer != NULL)
+ printf(" %4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d",
+ timer->tt_rexmt / 1000, (timer->tt_rexmt % 1000) / 10,
+ timer->tt_persist / 1000, (timer->tt_persist % 1000) / 10,
+ timer->tt_keep / 1000, (timer->tt_keep % 1000) / 10,
+ timer->tt_2msl / 1000, (timer->tt_2msl % 1000) / 10,
+ timer->tt_delack / 1000, (timer->tt_delack % 1000) / 10,
+ timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
}
if (istcp && !Lflag && !xflag && !Tflag) {
if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
diff --git a/freebsd/usr.bin/netstat/inet6.c b/freebsd/usr.bin/netstat/inet6.c
index 401112d2..2d3d2db8 100644
--- a/freebsd/usr.bin/netstat/inet6.c
+++ b/freebsd/usr.bin/netstat/inet6.c
@@ -13,10 +13,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -366,15 +362,17 @@ static char *srcrule_str[] = {
void
ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{
- struct ip6stat ip6stat;
+ struct ip6stat ip6stat, zerostat;
int first, i;
size_t len;
len = sizeof ip6stat;
if (live) {
memset(&ip6stat, 0, len);
- if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len, NULL,
- 0) < 0) {
+ if (zflag)
+ memset(&zerostat, 0, len);
+ if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len,
+ zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
if (errno != ENOENT)
warn("sysctl: net.inet6.ip6.stats");
return;
@@ -412,7 +410,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
p(ip6s_cantfrag, "\t%ju datagram%s that can't be fragmented\n");
p(ip6s_badscope, "\t%ju packet%s that violated scope rules\n");
p(ip6s_notmember, "\t%ju multicast packet%s which we don't join\n");
- for (first = 1, i = 0; i < 256; i++)
+ for (first = 1, i = 0; i < IP6S_HDRCNT; i++)
if (ip6stat.ip6s_nxthist[i] != 0) {
if (first) {
printf("\tInput histogram:\n");
@@ -423,7 +421,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
}
printf("\tMbuf statistics:\n");
printf("\t\t%ju one mbuf\n", (uintmax_t)ip6stat.ip6s_m1);
- for (first = 1, i = 0; i < 32; i++) {
+ for (first = 1, i = 0; i < IP6S_M2MMAX; i++) {
char ifbuf[IFNAMSIZ];
if (ip6stat.ip6s_m2m[i] != 0) {
if (first) {
@@ -440,7 +438,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("\t\t%ju two or more ext mbuf\n",
(uintmax_t)ip6stat.ip6s_mext2m);
p(ip6s_exthdrtoolong,
- "\t%ju packet%s whose headers are not continuous\n");
+ "\t%ju packet%s whose headers are not contiguous\n");
p(ip6s_nogif, "\t%ju tunneling packet%s that can't find gif\n");
p(ip6s_toomanyhdr,
"\t%ju packet%s discarded because of too many headers\n");
@@ -449,7 +447,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
#define PRINT_SCOPESTAT(s,i) do {\
switch(i) { /* XXX hardcoding in each case */\
case 1:\
- p(s, "\t\t%ju node-local%s\n");\
+ p(s, "\t\t%ju interface-local%s\n");\
break;\
case 2:\
p(s,"\t\t%ju link-local%s\n");\
@@ -468,7 +466,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
p(ip6s_sources_none,
"\t%ju failure%s of source address selection\n");
- for (first = 1, i = 0; i < 16; i++) {
+ for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) {
if (ip6stat.ip6s_sources_sameif[i]) {
if (first) {
printf("\tsource addresses on an outgoing I/F\n");
@@ -477,7 +475,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
PRINT_SCOPESTAT(ip6s_sources_sameif[i], i);
}
}
- for (first = 1, i = 0; i < 16; i++) {
+ for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) {
if (ip6stat.ip6s_sources_otherif[i]) {
if (first) {
printf("\tsource addresses on a non-outgoing I/F\n");
@@ -486,7 +484,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
PRINT_SCOPESTAT(ip6s_sources_otherif[i], i);
}
}
- for (first = 1, i = 0; i < 16; i++) {
+ for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) {
if (ip6stat.ip6s_sources_samescope[i]) {
if (first) {
printf("\tsource addresses of same scope\n");
@@ -495,7 +493,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
PRINT_SCOPESTAT(ip6s_sources_samescope[i], i);
}
}
- for (first = 1, i = 0; i < 16; i++) {
+ for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) {
if (ip6stat.ip6s_sources_otherscope[i]) {
if (first) {
printf("\tsource addresses of a different scope\n");
@@ -504,7 +502,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
PRINT_SCOPESTAT(ip6s_sources_otherscope[i], i);
}
}
- for (first = 1, i = 0; i < 16; i++) {
+ for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) {
if (ip6stat.ip6s_sources_deprecated[i]) {
if (first) {
printf("\tdeprecated source addresses\n");
@@ -515,7 +513,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
}
printf("\tSource addresses selection rule applied:\n");
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < IP6S_RULESMAX; i++) {
if (ip6stat.ip6s_sources_rule[i])
printf("\t\t%ju %s\n",
(uintmax_t)ip6stat.ip6s_sources_rule[i],
@@ -846,15 +844,17 @@ static const char *icmp6names[] = {
void
icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{
- struct icmp6stat icmp6stat;
+ struct icmp6stat icmp6stat, zerostat;
int i, first;
size_t len;
len = sizeof icmp6stat;
if (live) {
memset(&icmp6stat, 0, len);
+ if (zflag)
+ memset(&zerostat, 0, len);
if (sysctlbyname("net.inet6.icmp6.stats", &icmp6stat, &len,
- NULL, 0) < 0) {
+ zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
if (errno != ENOENT)
warn("sysctl: net.inet6.icmp6.stats");
return;
@@ -1039,14 +1039,16 @@ pim6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
void
rip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{
- struct rip6stat rip6stat;
+ struct rip6stat rip6stat, zerostat;
u_quad_t delivered;
size_t len;
len = sizeof(rip6stat);
if (live) {
+ if (zflag)
+ memset(&zerostat, 0, len);
if (sysctlbyname("net.inet6.ip6.rip6stats", &rip6stat, &len,
- NULL, 0) < 0) {
+ zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
if (errno != ENOENT)
warn("sysctl: net.inet6.ip6.rip6stats");
return;
diff --git a/freebsd/usr.bin/netstat/ipsec.c b/freebsd/usr.bin/netstat/ipsec.c
index ef59da9f..53dfdbe1 100644
--- a/freebsd/usr.bin/netstat/ipsec.c
+++ b/freebsd/usr.bin/netstat/ipsec.c
@@ -67,10 +67,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
diff --git a/freebsd/usr.bin/netstat/main.c b/freebsd/usr.bin/netstat/main.c
index 4c76b906..557d1ca0 100644
--- a/freebsd/usr.bin/netstat/main.c
+++ b/freebsd/usr.bin/netstat/main.c
@@ -12,10 +12,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -194,6 +190,8 @@ static struct nlist nl[] = {
{ .n_name = "_mfctablesize" },
#define N_ARPSTAT 55
{ .n_name = "_arpstat" },
+#define N_UNP_SPHEAD 56
+ { .n_name = "unp_sphead" },
{ .n_name = NULL },
};
@@ -218,6 +216,10 @@ struct protox {
{ -1, N_SCTPSTAT, 1, sctp_protopr,
sctp_stats, NULL, "sctp", 1, IPPROTO_SCTP },
#endif
+#ifdef SDP
+ { -1, -1, 1, protopr,
+ NULL, NULL, "sdp", 1, IPPROTO_TCP },
+#endif
{ N_DIVCBINFO, -1, 1, protopr,
NULL, NULL, "divert", 1, IPPROTO_DIVERT },
{ N_RIPCBINFO, N_IPSTAT, 1, protopr,
@@ -258,6 +260,10 @@ static const struct protox ip6protox[] = {
ip6_stats, ip6_ifstats, "ip6", 1, IPPROTO_RAW },
{ N_RIPCBINFO, N_ICMP6STAT, 1, protopr,
icmp6_stats, icmp6_ifstats, "icmp6", 1, IPPROTO_ICMPV6 },
+#ifdef SDP
+ { -1, -1, 1, protopr,
+ NULL, NULL, "sdp", 1, IPPROTO_TCP },
+#endif
#ifdef IPSEC
{ -1, N_IPSEC6STAT, 1, NULL,
ipsec_stats, NULL, "ipsec6", 0, 0 },
@@ -355,7 +361,6 @@ int Qflag; /* show netisr information */
#endif /* __rtems__ */
int rflag; /* show routing tables (or routing stats) */
int sflag; /* show protocol statistics */
-int tflag; /* show i/f watchdog timers */
int Wflag; /* wide display */
int Tflag; /* TCP Information */
int xflag; /* extra information, includes all socket buffer info */
@@ -397,7 +402,6 @@ int rtems_bsd_command_netstat(int argc, char *argv[])
pflag = 0;
rflag = 0;
sflag = 0;
- tflag = 0;
Wflag = 0;
xflag = 0;
zflag = 0;
@@ -437,7 +441,7 @@ main(int argc, char *argv[])
af = AF_UNSPEC;
- while ((ch = getopt(argc, argv, "AaBbdf:ghI:iLlM:mN:np:Qq:rSTstuWw:xz"))
+ while ((ch = getopt(argc, argv, "AaBbdf:ghI:iLlM:mN:np:Qq:rSTsuWw:xz"))
!= -1)
switch(ch) {
case 'A':
@@ -543,9 +547,6 @@ main(int argc, char *argv[])
case 'S':
numeric_addr = 1;
break;
- case 't':
- tflag = 1;
- break;
case 'u':
af = AF_UNIX;
break;
@@ -710,7 +711,8 @@ main(int argc, char *argv[])
#ifndef __rtems__
if ((af == AF_UNIX || af == AF_UNSPEC) && !sflag)
unixpr(nl[N_UNP_COUNT].n_value, nl[N_UNP_GENCNT].n_value,
- nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value);
+ nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value,
+ nl[N_UNP_SPHEAD].n_value);
#endif
exit(0);
}
@@ -888,7 +890,7 @@ usage(void)
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
"usage: netstat [-AaLnSTWx] [-f protocol_family | -p protocol]\n"
" [-M core] [-N system]",
-" netstat -i | -I interface [-abdhntW] [-f address_family]\n"
+" netstat -i | -I interface [-abdhnW] [-f address_family]\n"
" [-M core] [-N system]",
" netstat -w wait [-I interface] [-d] [-M core] [-N system] [-q howmany]",
" netstat -s [-s] [-z] [-f protocol_family | -p protocol]\n"
diff --git a/freebsd/usr.bin/netstat/mbuf.c b/freebsd/usr.bin/netstat/mbuf.c
index 08633639..5bfbd7bb 100644
--- a/freebsd/usr.bin/netstat/mbuf.c
+++ b/freebsd/usr.bin/netstat/mbuf.c
@@ -69,16 +69,18 @@ mbpr(void *kvmd, u_long mbaddr)
struct memory_type_list *mtlp;
struct memory_type *mtp;
uintmax_t mbuf_count, mbuf_bytes, mbuf_free, mbuf_failures, mbuf_size;
+ uintmax_t mbuf_sleeps;
uintmax_t cluster_count, cluster_bytes, cluster_limit, cluster_free;
- uintmax_t cluster_failures, cluster_size;
+ uintmax_t cluster_failures, cluster_size, cluster_sleeps;
uintmax_t packet_count, packet_bytes, packet_free, packet_failures;
+ uintmax_t packet_sleeps;
uintmax_t tag_count, tag_bytes;
uintmax_t jumbop_count, jumbop_bytes, jumbop_limit, jumbop_free;
- uintmax_t jumbop_failures, jumbop_size;
+ uintmax_t jumbop_failures, jumbop_sleeps, jumbop_size;
uintmax_t jumbo9_count, jumbo9_bytes, jumbo9_limit, jumbo9_free;
- uintmax_t jumbo9_failures, jumbo9_size;
+ uintmax_t jumbo9_failures, jumbo9_sleeps, jumbo9_size;
uintmax_t jumbo16_count, jumbo16_bytes, jumbo16_limit, jumbo16_free;
- uintmax_t jumbo16_failures, jumbo16_size;
+ uintmax_t jumbo16_failures, jumbo16_sleeps, jumbo16_size;
uintmax_t bytes_inuse, bytes_incache, bytes_total;
int nsfbufs, nsfbufspeak, nsfbufsused;
struct mbstat mbstat;
@@ -127,6 +129,7 @@ mbpr(void *kvmd, u_long mbaddr)
mbuf_bytes = memstat_get_bytes(mtp);
mbuf_free = memstat_get_free(mtp);
mbuf_failures = memstat_get_failures(mtp);
+ mbuf_sleeps = memstat_get_sleeps(mtp);
mbuf_size = memstat_get_size(mtp);
mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_PACKET_MEM_NAME);
@@ -138,6 +141,7 @@ mbpr(void *kvmd, u_long mbaddr)
packet_count = memstat_get_count(mtp);
packet_bytes = memstat_get_bytes(mtp);
packet_free = memstat_get_free(mtp);
+ packet_sleeps = memstat_get_sleeps(mtp);
packet_failures = memstat_get_failures(mtp);
mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_CLUSTER_MEM_NAME);
@@ -151,6 +155,7 @@ mbpr(void *kvmd, u_long mbaddr)
cluster_limit = memstat_get_countlimit(mtp);
cluster_free = memstat_get_free(mtp);
cluster_failures = memstat_get_failures(mtp);
+ cluster_sleeps = memstat_get_sleeps(mtp);
cluster_size = memstat_get_size(mtp);
mtp = memstat_mtl_find(mtlp, ALLOCATOR_MALLOC, MBUF_TAG_MEM_NAME);
@@ -173,6 +178,7 @@ mbpr(void *kvmd, u_long mbaddr)
jumbop_limit = memstat_get_countlimit(mtp);
jumbop_free = memstat_get_free(mtp);
jumbop_failures = memstat_get_failures(mtp);
+ jumbop_sleeps = memstat_get_sleeps(mtp);
jumbop_size = memstat_get_size(mtp);
mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_JUMBO9_MEM_NAME);
@@ -186,6 +192,7 @@ mbpr(void *kvmd, u_long mbaddr)
jumbo9_limit = memstat_get_countlimit(mtp);
jumbo9_free = memstat_get_free(mtp);
jumbo9_failures = memstat_get_failures(mtp);
+ jumbo9_sleeps = memstat_get_sleeps(mtp);
jumbo9_size = memstat_get_size(mtp);
mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_JUMBO16_MEM_NAME);
@@ -199,6 +206,7 @@ mbpr(void *kvmd, u_long mbaddr)
jumbo16_limit = memstat_get_countlimit(mtp);
jumbo16_free = memstat_get_free(mtp);
jumbo16_failures = memstat_get_failures(mtp);
+ jumbo16_sleeps = memstat_get_sleeps(mtp);
jumbo16_size = memstat_get_size(mtp);
printf("%ju/%ju/%ju mbufs in use (current/cache/total)\n",
@@ -285,7 +293,13 @@ mbpr(void *kvmd, u_long mbaddr)
printf("%ju/%ju/%ju requests for mbufs denied (mbufs/clusters/"
"mbuf+clusters)\n", mbuf_failures, cluster_failures,
packet_failures);
+ printf("%ju/%ju/%ju requests for mbufs delayed (mbufs/clusters/"
+ "mbuf+clusters)\n", mbuf_sleeps, cluster_sleeps,
+ packet_sleeps);
+ printf("%ju/%ju/%ju requests for jumbo clusters delayed "
+ "(%juk/9k/16k)\n", jumbop_sleeps, jumbo9_sleeps,
+ jumbo16_sleeps, jumbop_size / 1024);
printf("%ju/%ju/%ju requests for jumbo clusters denied "
"(%juk/9k/16k)\n", jumbop_failures, jumbo9_failures,
jumbo16_failures, jumbop_size / 1024);
diff --git a/freebsd/usr.bin/netstat/netstat.h b/freebsd/usr.bin/netstat/netstat.h
index 69465cf8..0b2f42ed 100644
--- a/freebsd/usr.bin/netstat/netstat.h
+++ b/freebsd/usr.bin/netstat/netstat.h
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -56,7 +52,6 @@ extern int numeric_addr; /* show addresses numerically */
extern int numeric_port; /* show ports numerically */
extern int rflag; /* show routing tables (or routing stats) */
extern int sflag; /* show protocol statistics */
-extern int tflag; /* show i/f watchdog timers */
extern int Tflag; /* show TCP control block info */
extern int Wflag; /* wide display */
extern int xflag; /* extended display, includes all socket buffer info */
@@ -169,7 +164,7 @@ void ddp_stats(u_long, const char *, int, int);
void netgraphprotopr(u_long, const char *, int, int);
#endif
-void unixpr(u_long, u_long, u_long, u_long);
+void unixpr(u_long, u_long, u_long, u_long, u_long);
void esis_stats(u_long, const char *, int, int);
void clnp_stats(u_long, const char *, int, int);
diff --git a/freebsd/usr.bin/netstat/pfkey.c b/freebsd/usr.bin/netstat/pfkey.c
index d3fa2768..45fcb977 100644
--- a/freebsd/usr.bin/netstat/pfkey.c
+++ b/freebsd/usr.bin/netstat/pfkey.c
@@ -42,10 +42,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
diff --git a/freebsd/usr.bin/netstat/route.c b/freebsd/usr.bin/netstat/route.c
index 33374831..3fc7f92d 100644
--- a/freebsd/usr.bin/netstat/route.c
+++ b/freebsd/usr.bin/netstat/route.c
@@ -12,10 +12,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
diff --git a/freebsd/usr.bin/netstat/sctp.c b/freebsd/usr.bin/netstat/sctp.c
index f4f191d5..8f87fd5a 100644
--- a/freebsd/usr.bin/netstat/sctp.c
+++ b/freebsd/usr.bin/netstat/sctp.c
@@ -430,7 +430,7 @@ sctp_process_inpcb(struct xsctp_inpcb *xinpcb,
}
xladdr = (struct xsctp_laddr *)(buf + *offset);
if (Lflag && !is_listening) {
- (int)sctp_skip_xinpcb_ifneed(buf, buflen, offset);
+ sctp_skip_xinpcb_ifneed(buf, buflen, offset);
return;
}
diff --git a/freebsd/usr.bin/netstat/unix.c b/freebsd/usr.bin/netstat/unix.c
index 7a209ebc..afb35113 100644
--- a/freebsd/usr.bin/netstat/unix.c
+++ b/freebsd/usr.bin/netstat/unix.c
@@ -12,10 +12,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -198,21 +194,37 @@ fail:
#ifndef __rtems__
void
-unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off)
+unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off,
+ u_long sphead_off)
{
char *buf;
int ret, type;
struct xsocket *so;
struct xunpgen *xug, *oxug;
struct xunpcb *xunp;
+ u_long head_off;
for (type = SOCK_STREAM; type <= SOCK_SEQPACKET; type++) {
if (live)
ret = pcblist_sysctl(type, &buf);
- else
- ret = pcblist_kvm(count_off, gencnt_off,
- type == SOCK_STREAM ? shead_off :
- (type == SOCK_DGRAM ? dhead_off : 0), &buf);
+ else {
+ head_off = 0;
+ switch (type) {
+ case SOCK_STREAM:
+ head_off = shead_off;
+ break;
+
+ case SOCK_DGRAM:
+ head_off = dhead_off;
+ break;
+
+ case SOCK_SEQPACKET:
+ head_off = sphead_off;
+ break;
+ }
+ ret = pcblist_kvm(count_off, gencnt_off, head_off,
+ &buf);
+ }
if (ret == -1)
continue;
if (ret < 0)