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.
This commit is contained in:
David Greenman 1995-07-29 22:34:15 +00:00
parent 61a65662e5
commit 3aa80b1d81
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9776
3 changed files with 26 additions and 18 deletions

View file

@ -340,19 +340,19 @@ sidewaysintpr(interval, off)
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 @@ sidewaysintpr(interval, off)
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');

View file

@ -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

View file

@ -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);