diff options
author | dg <dg@FreeBSD.org> | 1995-07-29 22:34:15 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-07-29 22:34:15 +0000 |
commit | d07d67048ecfd869ae329f73245a968f13f85372 (patch) | |
tree | 20ed2bb57a4c73bef45184ea2a93cc77f2408e8f /usr.bin | |
parent | 4c0fc42609cbd3648dc9c01c1ac3cf34d5ae1b20 (diff) | |
download | FreeBSD-src-d07d67048ecfd869ae329f73245a968f13f85372.zip FreeBSD-src-d07d67048ecfd869ae329f73245a968f13f85372.tar.gz |
Output statistics as unsigned in the -w section.
Look at error return of kread() and stop on error.
Fix warning in kread() to not output "kvm_read:" twice.
Killed PCB cache misses stat as we no longer have it.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/netstat/if.c | 24 | ||||
-rw-r--r-- | usr.bin/netstat/inet.c | 18 | ||||
-rw-r--r-- | usr.bin/netstat/main.c | 2 |
3 files changed, 26 insertions, 18 deletions
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index b656681..f625740 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -340,19 +340,19 @@ loop: continue; } if (ip == interesting) { - printf("%8d %5d ", + printf("%8u %5u ", ifnet.if_ipackets - ip->ift_ip, ifnet.if_ierrors - ip->ift_ie); if (bflag) - printf("%10d ", ifnet.if_ibytes - ip->ift_ib); - printf("%8d %5d ", + printf("%10u ", ifnet.if_ibytes - ip->ift_ib); + printf("%8u %5u ", ifnet.if_opackets - ip->ift_op, ifnet.if_oerrors - ip->ift_oe); if (bflag) - printf("%10d ", ifnet.if_obytes - ip->ift_ob); - printf("%5d", ifnet.if_collisions - ip->ift_co); + printf("%10u ", ifnet.if_obytes - ip->ift_ob); + printf("%5u", ifnet.if_collisions - ip->ift_co); if (dflag) - printf(" %5d", + printf(" %5u", ifnet.if_snd.ifq_drops - ip->ift_dr); } ip->ift_ip = ifnet.if_ipackets; @@ -374,19 +374,19 @@ loop: off = (u_long) ifnet.if_next; } if (lastif - iftot > 0) { - printf(" %8d %5d", + printf(" %8u %5u", sum->ift_ip - total->ift_ip, sum->ift_ie - total->ift_ie); if (bflag) - printf(" %10d", sum->ift_ib - total->ift_ib); - printf(" %8d %5d", + printf(" %10u", sum->ift_ib - total->ift_ib); + printf(" %8u %5u", sum->ift_op - total->ift_op, sum->ift_oe - total->ift_oe); if (bflag) - printf(" %10d", sum->ift_ob - total->ift_ob); - printf(" %5d", sum->ift_co - total->ift_co); + printf(" %10u", sum->ift_ob - total->ift_ob); + printf(" %5u", sum->ift_co - total->ift_co); if (dflag) - printf(" %5d", sum->ift_dr - total->ift_dr); + printf(" %5u", sum->ift_dr - total->ift_dr); } *total = *sum; putchar('\n'); diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 5875667..ae61b8f 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -100,16 +100,25 @@ protopr(off, name) prev = (struct inpcb *)off; for (next = head.lh_first; next != NULL; next = inpcb.inp_list.le_next) { - kread((u_long)next, (char *)&inpcb, sizeof (inpcb)); + if (kread((u_long)next, (char *)&inpcb, sizeof (inpcb))) { + printf("???\n"); + break; + } if (!aflag && inet_lnaof(inpcb.inp_laddr) == INADDR_ANY) { prev = next; continue; } - kread((u_long)inpcb.inp_socket, (char *)&sockb, sizeof (sockb)); + if (kread((u_long)inpcb.inp_socket, (char *)&sockb, sizeof (sockb))) { + printf("???\n"); + break; + }; if (istcp) { - kread((u_long)inpcb.inp_ppcb, - (char *)&tcpcb, sizeof (tcpcb)); + if (kread((u_long)inpcb.inp_ppcb, + (char *)&tcpcb, sizeof (tcpcb))) { + printf("???\n"); + break; + }; } if (first) { printf("Active Internet connections"); @@ -227,7 +236,6 @@ tcp_stats(off, name) p(tcps_keepdrops, "\t\t%d connection%s dropped by keepalive\n"); p(tcps_predack, "\t%d correct ACK header prediction%s\n"); p(tcps_preddat, "\t%d correct data packet header prediction%s\n"); - p3(tcps_pcbcachemiss, "\t%d PCB cache miss%s\n"); #undef p #undef p2 #undef p3 diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index f03974a..fbff429 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -431,7 +431,7 @@ kread(addr, buf, size) { if (kvm_read(kvmd, addr, buf, size) != size) { - warnx("kvm_read: %s", kvm_geterr(kvmd)); + warnx("%s", kvm_geterr(kvmd)); return (-1); } return (0); |