version 1.21, 2000/10/23 19:17:08 |
version 1.22, 2000/12/13 15:52:58 |
|
|
return; |
return; |
ifnetaddr = (u_long)ifhead.tqh_first; |
ifnetaddr = (u_long)ifhead.tqh_first; |
|
|
printf("%-7.7s %-5.5s %-11.11s %-17.17s %8.8s %5.5s %8.8s %5.5s", |
printf("%-7.7s %-5.5s %-11.11s %-17.17s ", |
"Name", "Mtu", "Network", "Address", "Ipkts", "Ierrs", |
"Name", "Mtu", "Network", "Address"); |
"Opkts", "Oerrs"); |
if (bflag) |
printf(" %5s", "Coll"); |
printf("%10.10s %10.10s", "Ibytes", "Obytes"); |
|
else |
|
printf("%8.8s %5.5s %8.8s %5.5s %5.5s", |
|
"Ipkts", "Ierrs", "Opkts", "Oerrs", "Colls"); |
if (tflag) |
if (tflag) |
printf(" %s", "Time"); |
printf(" %s", "Time"); |
if (dflag) |
if (dflag) |
|
|
} |
} |
ifaddraddr = (u_long)ifaddr.ifa.ifa_list.tqe_next; |
ifaddraddr = (u_long)ifaddr.ifa.ifa_list.tqe_next; |
} |
} |
printf("%8lu %5lu %8lu %5lu %5lu", |
if (bflag) |
ifnet.if_ipackets, ifnet.if_ierrors, |
printf("%10lu %10lu", |
ifnet.if_opackets, ifnet.if_oerrors, |
ifnet.if_ibytes, ifnet.if_obytes); |
ifnet.if_collisions); |
else |
|
printf("%8lu %5lu %8lu %5lu %5lu", |
|
ifnet.if_ipackets, ifnet.if_ierrors, |
|
ifnet.if_opackets, ifnet.if_oerrors, |
|
ifnet.if_collisions); |
if (tflag) |
if (tflag) |
printf(" %3d", ifnet.if_timer); |
printf(" %4d", ifnet.if_timer); |
if (dflag) |
if (dflag) |
printf(" %3d", ifnet.if_snd.ifq_drops); |
printf(" %4d", ifnet.if_snd.ifq_drops); |
putchar('\n'); |
putchar('\n'); |
} |
} |
} |
} |
|
|
struct iftot { |
struct iftot { |
char ift_name[IFNAMSIZ]; /* interface name */ |
char ift_name[IFNAMSIZ]; /* interface name */ |
int ift_ip; /* input packets */ |
int ift_ip; /* input packets */ |
|
int ift_ib; /* input bytes */ |
int ift_ie; /* input errors */ |
int ift_ie; /* input errors */ |
int ift_op; /* output packets */ |
int ift_op; /* output packets */ |
|
int ift_ob; /* output bytes */ |
int ift_oe; /* output errors */ |
int ift_oe; /* output errors */ |
int ift_co; /* collisions */ |
int ift_co; /* collisions */ |
int ift_dr; /* drops */ |
int ift_dr; /* drops */ |
|
|
if (kread(off, (char *)&ifnet, sizeof ifnet)) |
if (kread(off, (char *)&ifnet, sizeof ifnet)) |
break; |
break; |
bzero(ip->ift_name, sizeof(ip->ift_name)); |
bzero(ip->ift_name, sizeof(ip->ift_name)); |
snprintf(ip->ift_name, IFNAMSIZ, "(%s)", ifnet.if_xname); |
snprintf(ip->ift_name, IFNAMSIZ, "%s", ifnet.if_xname); |
if (interface && strcmp(ifnet.if_xname, interface) == 0) |
if (interface && strcmp(ifnet.if_xname, interface) == 0) |
interesting = ip; |
interesting = ip; |
ip++; |
ip++; |
|
|
signalled = NO; |
signalled = NO; |
(void)alarm(interval); |
(void)alarm(interval); |
banner: |
banner: |
printf(" input %-6.6s output ", interesting->ift_name); |
if (bflag) |
|
printf("%7.7s in %8.8s %6.6s out %5.5s", |
|
interesting->ift_name, " ", |
|
interesting->ift_name, " "); |
|
else |
|
printf("%5.5s in %5.5s%5.5s out %5.5s %5.5s", |
|
interesting->ift_name, " ", |
|
interesting->ift_name, " ", " "); |
|
if (dflag) |
|
printf(" %5.5s", " "); |
if (lastif - iftot > 0) { |
if (lastif - iftot > 0) { |
|
if (bflag) |
|
printf(" %7.7s in %8.8s %6.6s out %5.5s", |
|
"total", " ", "total", " "); |
|
else |
|
printf(" %5.5s in %5.5s%5.5s out %5.5s %5.5s", |
|
"total", " ", "total", " ", " "); |
if (dflag) |
if (dflag) |
printf(" "); |
printf(" %5.5s", " "); |
printf(" input (Total) output"); |
|
} |
} |
for (ip = iftot; ip < iftot + MAXIF; ip++) { |
for (ip = iftot; ip < iftot + MAXIF; ip++) { |
ip->ift_ip = 0; |
ip->ift_ip = 0; |
|
ip->ift_ib = 0; |
ip->ift_ie = 0; |
ip->ift_ie = 0; |
ip->ift_op = 0; |
ip->ift_op = 0; |
|
ip->ift_ob = 0; |
ip->ift_oe = 0; |
ip->ift_oe = 0; |
ip->ift_co = 0; |
ip->ift_co = 0; |
ip->ift_dr = 0; |
ip->ift_dr = 0; |
} |
} |
putchar('\n'); |
putchar('\n'); |
printf("%8.8s %5.5s %8.8s %5.5s %5.5s ", |
if (bflag) |
"packets", "errs", "packets", "errs", "colls"); |
printf("%10.10s %8.8s %10.10s %5.5s", |
|
"bytes", " ", "bytes", " "); |
|
else |
|
printf("%8.8s %5.5s %8.8s %5.5s %5.5s", |
|
"packets", "errs", "packets", "errs", "colls"); |
if (dflag) |
if (dflag) |
printf("%5.5s ", "drops"); |
|
if (lastif - iftot > 0) |
|
printf(" %8.8s %5.5s %8.8s %5.5s %5.5s", |
|
"packets", "errs", "packets", "errs", "colls"); |
|
if (dflag) |
|
printf(" %5.5s", "drops"); |
printf(" %5.5s", "drops"); |
|
if (lastif - iftot > 0) { |
|
if (bflag) |
|
printf(" %10.10s %8.8s %10.10s %5.5s", |
|
"bytes", " ", "bytes", " "); |
|
else |
|
printf(" %8.8s %5.5s %8.8s %5.5s %5.5s", |
|
"packets", "errs", "packets", "errs", "colls"); |
|
if (dflag) |
|
printf(" %5.5s", "drops"); |
|
} |
putchar('\n'); |
putchar('\n'); |
fflush(stdout); |
fflush(stdout); |
line = 0; |
line = 0; |
loop: |
loop: |
sum->ift_ip = 0; |
sum->ift_ip = 0; |
|
sum->ift_ib = 0; |
sum->ift_ie = 0; |
sum->ift_ie = 0; |
sum->ift_op = 0; |
sum->ift_op = 0; |
|
sum->ift_ob = 0; |
sum->ift_oe = 0; |
sum->ift_oe = 0; |
sum->ift_co = 0; |
sum->ift_co = 0; |
sum->ift_dr = 0; |
sum->ift_dr = 0; |
|
|
continue; |
continue; |
} |
} |
if (ip == interesting) { |
if (ip == interesting) { |
printf("%8ld %5ld %8ld %5ld %5ld", |
if (bflag) |
ifnet.if_ipackets - ip->ift_ip, |
printf("%10lu %8.8s %10lu %5.5s", |
ifnet.if_ierrors - ip->ift_ie, |
ifnet.if_ibytes - ip->ift_ib, " ", |
ifnet.if_opackets - ip->ift_op, |
ifnet.if_obytes - ip->ift_ob, " "); |
ifnet.if_oerrors - ip->ift_oe, |
else |
ifnet.if_collisions - ip->ift_co); |
printf("%8lu %5lu %8lu %5lu %5lu", |
|
ifnet.if_ipackets - ip->ift_ip, |
|
ifnet.if_ierrors - ip->ift_ie, |
|
ifnet.if_opackets - ip->ift_op, |
|
ifnet.if_oerrors - ip->ift_oe, |
|
ifnet.if_collisions - ip->ift_co); |
if (dflag) |
if (dflag) |
printf(" %5d", |
printf(" %5d", |
ifnet.if_snd.ifq_drops - ip->ift_dr); |
ifnet.if_snd.ifq_drops - ip->ift_dr); |
} |
} |
ip->ift_ip = ifnet.if_ipackets; |
ip->ift_ip = ifnet.if_ipackets; |
|
ip->ift_ib = ifnet.if_ibytes; |
ip->ift_ie = ifnet.if_ierrors; |
ip->ift_ie = ifnet.if_ierrors; |
ip->ift_op = ifnet.if_opackets; |
ip->ift_op = ifnet.if_opackets; |
|
ip->ift_ob = ifnet.if_obytes; |
ip->ift_oe = ifnet.if_oerrors; |
ip->ift_oe = ifnet.if_oerrors; |
ip->ift_co = ifnet.if_collisions; |
ip->ift_co = ifnet.if_collisions; |
ip->ift_dr = ifnet.if_snd.ifq_drops; |
ip->ift_dr = ifnet.if_snd.ifq_drops; |
sum->ift_ip += ip->ift_ip; |
sum->ift_ip += ip->ift_ip; |
|
sum->ift_ib += ip->ift_ib; |
sum->ift_ie += ip->ift_ie; |
sum->ift_ie += ip->ift_ie; |
sum->ift_op += ip->ift_op; |
sum->ift_op += ip->ift_op; |
|
sum->ift_ob += ip->ift_ob; |
sum->ift_oe += ip->ift_oe; |
sum->ift_oe += ip->ift_oe; |
sum->ift_co += ip->ift_co; |
sum->ift_co += ip->ift_co; |
sum->ift_dr += ip->ift_dr; |
sum->ift_dr += ip->ift_dr; |
off = (u_long)ifnet.if_list.tqe_next; |
off = (u_long)ifnet.if_list.tqe_next; |
} |
} |
if (lastif - iftot > 0) { |
if (lastif - iftot > 0) { |
printf(" %8d %5d %8d %5d %5d", |
if (bflag) |
sum->ift_ip - total->ift_ip, |
printf(" %10lu %8.8s %10lu %5.5s", |
sum->ift_ie - total->ift_ie, |
sum->ift_ib - total->ift_ib, " ", |
sum->ift_op - total->ift_op, |
sum->ift_ob - total->ift_ob, " "); |
sum->ift_oe - total->ift_oe, |
else |
sum->ift_co - total->ift_co); |
printf(" %8lu %5lu %8lu %5lu %5lu", |
|
sum->ift_ip - total->ift_ip, |
|
sum->ift_ie - total->ift_ie, |
|
sum->ift_op - total->ift_op, |
|
sum->ift_oe - total->ift_oe, |
|
sum->ift_co - total->ift_co); |
if (dflag) |
if (dflag) |
printf(" %5d", sum->ift_dr - total->ift_dr); |
printf(" %5d", sum->ift_dr - total->ift_dr); |
} |
} |