diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index da66fd2a8ad9..94c0cb7606d2 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -33,7 +33,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)if.c 5.15 (Berkeley) 3/1/91";*/ -static char rcsid[] = "$Id: if.c,v 1.5 1994/03/03 22:03:33 deraadt Exp $"; +static char rcsid[] = "$Id: if.c,v 1.6 1994/03/28 10:29:31 cgd Exp $"; #endif /* not lint */ #include @@ -54,6 +54,8 @@ static char rcsid[] = "$Id: if.c,v 1.5 1994/03/03 22:03:33 deraadt Exp $"; #include #endif /* ISO */ +#include +#include #include #include @@ -99,7 +101,7 @@ intpr(interval, ifnetaddr) sidewaysintpr((unsigned)interval, ifnetaddr); return; } - kvm_read(ifnetaddr, (char *)&ifnetaddr, sizeof ifnetaddr); + kvm_read((void *)(long)ifnetaddr, (char *)&ifnetaddr, sizeof ifnetaddr); printf("%-5.5s %-5.5s %-11.11s %-15.15s %8.8s %5.5s %8.8s %5.5s", "Name", "Mtu", "Network", "Address", "Ipkts", "Ierrs", "Opkts", "Oerrs"); @@ -120,10 +122,11 @@ intpr(interval, ifnetaddr) struct in_addr inet_makeaddr(); if (ifaddraddr == 0) { - kvm_read(ifnetaddr, (char *)&ifnet, sizeof ifnet); - kvm_read((off_t)ifnet.if_name, name, 16); + kvm_read((void *)(long)ifnetaddr, (char *)&ifnet, + sizeof ifnet); + kvm_read(ifnet.if_name, name, 16); name[15] = '\0'; - ifnetaddr = (off_t) ifnet.if_next; + ifnetaddr = (off_t)(long)ifnet.if_next; if (interface != 0 && (strcmp(name, interface) != 0 || unit != ifnet.if_unit)) continue; @@ -132,16 +135,17 @@ intpr(interval, ifnetaddr) if ((ifnet.if_flags&IFF_UP) == 0) *cp++ = '*'; *cp = '\0'; - ifaddraddr = (off_t)ifnet.if_addrlist; + ifaddraddr = (off_t)(long)ifnet.if_addrlist; } printf("%-5.5s %-5d ", name, ifnet.if_mtu); if (ifaddraddr == 0) { printf("%-11.11s ", "none"); printf("%-15.15s ", "none"); } else { - kvm_read(ifaddraddr, (char *)&ifaddr, sizeof ifaddr); + kvm_read((void *)(long)ifaddraddr, (char *)&ifaddr, + sizeof ifaddr); #define CP(x) ((char *)(x)) - cp = (CP(ifaddr.ifa.ifa_addr) - CP(ifaddraddr)) + + cp = (CP(ifaddr.ifa.ifa_addr) - CP((long)ifaddraddr)) + CP(&ifaddr); sa = (struct sockaddr *)cp; switch (sa->sa_family) { case AF_UNSPEC: @@ -222,7 +226,7 @@ intpr(interval, ifnetaddr) putchar(' '); break; } - ifaddraddr = (off_t)ifaddr.ifa.ifa_next; + ifaddraddr = (off_t)(long)ifaddr.ifa.ifa_next; } printf("%8d %5d %8d %5d %5d", ifnet.if_ipackets, ifnet.if_ierrors, @@ -267,7 +271,7 @@ sidewaysintpr(interval, off) int oldmask; void catchalarm(); - kvm_read(off, (char *)&firstifnet, sizeof (off_t)); + kvm_read((void *)(long)off, (char *)&firstifnet, sizeof (off_t)); lastif = iftot; sum = iftot + MAXIF - 1; total = sum - 1; @@ -275,9 +279,9 @@ sidewaysintpr(interval, off) for (off = firstifnet, ip = iftot; off;) { char *cp; - kvm_read(off, (char *)&ifnet, sizeof ifnet); + kvm_read((void *)(long)off, (char *)&ifnet, sizeof ifnet); ip->ift_name[0] = '('; - kvm_read((off_t)ifnet.if_name, ip->ift_name + 1, 15); + kvm_read(ifnet.if_name, ip->ift_name + 1, 15); if (interface && strcmp(ip->ift_name + 1, interface) == 0 && unit == ifnet.if_unit) interesting = ip; @@ -287,7 +291,7 @@ sidewaysintpr(interval, off) ip++; if (ip >= iftot + MAXIF - 2) break; - off = (off_t) ifnet.if_next; + off = (off_t)(long)ifnet.if_next; } lastif = ip; @@ -330,7 +334,7 @@ loop: sum->ift_co = 0; sum->ift_dr = 0; for (off = firstifnet, ip = iftot; off && ip < lastif; ip++) { - kvm_read(off, (char *)&ifnet, sizeof ifnet); + kvm_read((void *)(long)off, (char *)&ifnet, sizeof ifnet); if (ip == interesting) { printf("%8d %5d %8d %5d %5d", ifnet.if_ipackets - ip->ift_ip, @@ -354,7 +358,7 @@ loop: sum->ift_oe += ip->ift_oe; sum->ift_co += ip->ift_co; sum->ift_dr += ip->ift_dr; - off = (off_t) ifnet.if_next; + off = (off_t)(long)ifnet.if_next; } if (lastif - iftot > 0) { printf(" %8d %5d %8d %5d %5d", diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 2f9becc775e1..833aa101a612 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -66,6 +66,8 @@ static char rcsid[] = "inet.c,v 1.4 1993/05/20 12:03:49 cgd Exp"; #include #include +#include +#include struct inpcb inpcb; struct tcpcb tcpcb; @@ -95,15 +97,15 @@ protopr(off, name) if (off == 0) return; istcp = strcmp(name, "tcp") == 0; - kvm_read(off, (char *)&cb, sizeof (struct inpcb)); + kvm_read((void *)(long)off, (char *)&cb, sizeof (struct inpcb)); inpcb = cb; - prev = (struct inpcb *)off; - if (inpcb.inp_next == (struct inpcb *)off) + prev = (struct inpcb *)(long)off; + if (inpcb.inp_next == (struct inpcb *)(long)off) return; - while (inpcb.inp_next != (struct inpcb *)off) { + while (inpcb.inp_next != (struct inpcb *)(long)off) { next = inpcb.inp_next; - kvm_read((off_t)next, (char *)&inpcb, sizeof (inpcb)); + kvm_read(next, (char *)&inpcb, sizeof (inpcb)); if (inpcb.inp_prev != prev) { printf("???\n"); break; @@ -113,11 +115,10 @@ protopr(off, name) prev = next; continue; } - kvm_read((off_t)inpcb.inp_socket, - (char *)&sockb, sizeof (sockb)); + kvm_read(inpcb.inp_socket, (char *)&sockb, sizeof (sockb)); if (istcp) { - kvm_read((off_t)inpcb.inp_ppcb, - (char *)&tcpcb, sizeof (tcpcb)); + kvm_read(inpcb.inp_ppcb, (char *)&tcpcb, + sizeof (tcpcb)); } if (first) { printf("Active Internet connections"); @@ -165,7 +166,7 @@ tcp_stats(off, name) if (off == 0) return; printf ("%s:\n", name); - kvm_read(off, (char *)&tcpstat, sizeof (tcpstat)); + kvm_read((void *)(long)off, (char *)&tcpstat, sizeof (tcpstat)); #define p(f, m) printf(m, tcpstat.f, plural(tcpstat.f)) #define p2(f1, f2, m) printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2, plural(tcpstat.f2)) @@ -230,7 +231,7 @@ udp_stats(off, name) if (off == 0) return; - kvm_read(off, (char *)&udpstat, sizeof (udpstat)); + kvm_read((void *)(long)off, (char *)&udpstat, sizeof (udpstat)); printf("%s:\n\t%u packet%s sent\n", name, udpstat.udps_opackets, plural(udpstat.udps_opackets)); printf("\t%u packet%s received\n", @@ -262,7 +263,7 @@ ip_stats(off, name) if (off == 0) return; - kvm_read(off, (char *)&ipstat, sizeof (ipstat)); + kvm_read((void *)(long)off, (char *)&ipstat, sizeof (ipstat)); printf("%s:\n\t%u total packets received\n", name, ipstat.ips_total); printf("\t%u bad header checksum%s\n", @@ -319,7 +320,7 @@ icmp_stats(off, name) if (off == 0) return; - kvm_read(off, (char *)&icmpstat, sizeof (icmpstat)); + kvm_read((void *)(long)off, (char *)&icmpstat, sizeof (icmpstat)); printf("%s:\n\t%u call%s to icmp_error\n", name, icmpstat.icps_error, plural(icmpstat.icps_error)); printf("\t%u error%s not generated 'cuz old message was icmp\n", @@ -373,7 +374,7 @@ igmp_stats(off, name) if (off == 0) return; - kvm_read(off, (char *)&igmpstat, sizeof (igmpstat)); + kvm_read((void *)(long)off, (char *)&igmpstat, sizeof (igmpstat)); printf("%s:\n", name ); printf("\t%u message%s received\n", igmpstat.igps_rcv_total, plural(igmpstat.igps_rcv_total)); diff --git a/usr.bin/netstat/iso.c b/usr.bin/netstat/iso.c index 74385926df72..50917f95d580 100644 --- a/usr.bin/netstat/iso.c +++ b/usr.bin/netstat/iso.c @@ -33,7 +33,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)iso.c 5.6 (Berkeley) 4/27/91";*/ -static char rcsid[] = "$Id: iso.c,v 1.6 1994/03/26 04:08:45 glass Exp $"; +static char rcsid[] = "$Id: iso.c,v 1.7 1994/03/28 10:29:43 cgd Exp $"; #endif /* not lint */ /******************************************************************************* @@ -93,6 +93,8 @@ SOFTWARE. #endif #include #include +#include +#include char *tp_sstring[] = { "ST_ERROR(0x0)", @@ -145,7 +147,8 @@ esis_stats(off, name) if (off == 0) return; - kvm_read(off, (char *)&esis_stat, sizeof (struct esis_stat)); + kvm_read((void *)(long)off, (char *)&esis_stat, + sizeof (struct esis_stat)); printf("%s:\n", name); printf("\t%d esh sent, %d esh received\n", esis_stat.es_eshsent, esis_stat.es_eshrcvd); @@ -173,7 +176,7 @@ clnp_stats(off, name) if (off == 0) return; - kvm_read(off, (char *)&clnp_stat, sizeof (clnp_stat)); + kvm_read((void *)(long)off, (char *)&clnp_stat, sizeof (clnp_stat)); printf("%s:\n\t%d total packets sent\n", name, clnp_stat.cns_sent); printf("\t%d total fragments sent\n", clnp_stat.cns_fragments); @@ -207,7 +210,7 @@ cltp_stats(off, name) if (off == 0) return; - kvm_read(off, (char *)&cltpstat, sizeof (cltpstat)); + kvm_read((void *)(long)off, (char *)&cltpstat, sizeof (cltpstat)); printf("%s:\n\t%u incomplete header%s\n", name, cltpstat.cltps_hdrops, plural(cltpstat.cltps_hdrops)); printf("\t%u bad data length field%s\n", @@ -224,7 +227,7 @@ struct sockaddr_iso siso; char data[128]; } laddr, faddr; #define kget(o, p) \ - (kvm_read((off_t)(o), (char *)&p, sizeof (p))) + (kvm_read((void *)(long)(o), (char *)&p, sizeof (p))) extern int Aflag; extern int aflag; extern int nflag; @@ -253,10 +256,10 @@ iso_protopr(off, name) } kget(off, cb); isopcb = cb; - prev = (struct isopcb *)off; - if (isopcb.isop_next == (struct isopcb *)off) + prev = (struct isopcb *)(long)off; + if (isopcb.isop_next == (struct isopcb *)(long)off) return; - while (isopcb.isop_next != (struct isopcb *)off) { + while (isopcb.isop_next != (struct isopcb *)(long)off) { next = isopcb.isop_next; kget(next, isopcb); if (isopcb.isop_prev != prev) { @@ -293,7 +296,7 @@ iso_protopr(off, name) } if (Aflag) printf("%8x ", - (istp ? (off_t)sockb.so_tpcb : (off_t)next)); + (istp ? (long)sockb.so_tpcb : (long)next)); printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc); if (isopcb.isop_laddr == 0) diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c index c7b6743dd19e..60d9cf30b080 100644 --- a/usr.bin/netstat/mbuf.c +++ b/usr.bin/netstat/mbuf.c @@ -33,10 +33,12 @@ #ifndef lint /*static char sccsid[] = "from: @(#)mbuf.c 5.10 (Berkeley) 1/30/91";*/ -static char rcsid[] = "$Id: mbuf.c,v 1.2 1993/08/01 18:10:50 mycroft Exp $"; +static char rcsid[] = "$Id: mbuf.c,v 1.3 1994/03/28 10:29:48 cgd Exp $"; #endif /* not lint */ #include +#include +#include #include #include #define YES 1 @@ -86,7 +88,7 @@ mbpr(mbaddr) printf("mbstat: symbol not in namelist\n"); return; } - if (kvm_read(mbaddr, (char *)&mbstat, sizeof (mbstat)) + if (kvm_read((void *)(long)mbaddr, (char *)&mbstat, sizeof (mbstat)) != sizeof (mbstat)) { printf("mbstat: bad read\n"); return; diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c index c2ef7a294224..c0c197a43379 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -5,10 +5,12 @@ */ #ifndef lint -static char rcsid[] = "$Id: mroute.c,v 1.1 1994/01/11 19:42:55 brezak Exp $"; +static char rcsid[] = "$Id: mroute.c,v 1.2 1994/03/28 10:29:52 cgd Exp $"; #endif /* not lint */ #include +#include +#include #include #include #include @@ -59,7 +61,7 @@ mroutepr(mrpaddr, mrtaddr, vifaddr) return; } - kvm_read(mrpaddr, (char *)&mrtproto, sizeof(mrtproto)); + kvm_read((void *)(long)mrpaddr, (char *)&mrtproto, sizeof(mrtproto)); switch (mrtproto) { case 0: printf("no multicast routing compiled into this system\n"); @@ -85,7 +87,7 @@ mroutepr(mrpaddr, mrtaddr, vifaddr) saved_nflag = nflag; nflag = 1; - kvm_read(vifaddr, (char *)viftable, sizeof(viftable)); + kvm_read((void *)(long)vifaddr, (char *)viftable, sizeof(viftable)); banner_printed = 0; for (vifi = 0, v = viftable; vifi < MAXVIFS; ++vifi, ++v) { struct in_addr v_lcl_grps[1024]; @@ -119,7 +121,7 @@ mroutepr(mrpaddr, mrtaddr, vifaddr) } if (!banner_printed) printf("\nVirtual Interface Table is empty\n"); - kvm_read(mrtaddr, (char *)mrttable, sizeof(mrttable)); + kvm_read((void *)(long)mrtaddr, (char *)mrttable, sizeof(mrttable)); banner_printed = 0; for (i = 0; i < MRTHASHSIZ; ++i) { for (mp = mrttable[i]; mp != NULL; @@ -176,7 +178,7 @@ mrt_stats(mrpaddr, mstaddr) return; } - kvm_read(mrpaddr, (char *)&mrtproto, sizeof(mrtproto)); + kvm_read((void *)(long)mrpaddr, (char *)&mrtproto, sizeof(mrtproto)); switch (mrtproto) { case 0: printf("no multicast routing compiled into this system\n"); @@ -195,7 +197,7 @@ mrt_stats(mrpaddr, mstaddr) return; } - kvm_read(mstaddr, (char *)&mrtstat, sizeof(mrtstat)); + kvm_read((void *)(long)mstaddr, (char *)&mrtstat, sizeof(mrtstat)); printf("multicast routing:\n"); printf(" %10u multicast route lookup%s\n", mrtstat.mrts_mrt_lookups, plural(mrtstat.mrts_mrt_lookups)); diff --git a/usr.bin/netstat/ns.c b/usr.bin/netstat/ns.c index 2ff83bb4f391..c36648fd1c75 100644 --- a/usr.bin/netstat/ns.c +++ b/usr.bin/netstat/ns.c @@ -33,7 +33,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)ns.c 5.13 (Berkeley) 3/1/91";*/ -static char rcsid[] = "$Id: ns.c,v 1.4 1993/08/01 18:10:49 mycroft Exp $"; +static char rcsid[] = "$Id: ns.c,v 1.5 1994/03/28 10:29:55 cgd Exp $"; #endif /* not lint */ #include @@ -60,6 +60,7 @@ static char rcsid[] = "$Id: ns.c,v 1.4 1993/08/01 18:10:49 mycroft Exp $"; #include #include +#include #include #include #include @@ -93,16 +94,16 @@ nsprotopr(off, name) if (off == 0) return; isspp = strcmp(name, "spp") == 0; - kvm_read(off, (char *)&cb, sizeof (struct nspcb)); + kvm_read((void *)(long)off, (char *)&cb, sizeof (struct nspcb)); nspcb = cb; - prev = (struct nspcb *)off; - if (nspcb.nsp_next == (struct nspcb *)off) + prev = (struct nspcb *)(long)off; + if (nspcb.nsp_next == (struct nspcb *)(long)off) return; - for (;nspcb.nsp_next != (struct nspcb *)off; prev = next) { + for (;nspcb.nsp_next != (struct nspcb *)(long)off; prev = next) { off_t ppcb; next = nspcb.nsp_next; - kvm_read((off_t)next, (char *)&nspcb, sizeof (nspcb)); + kvm_read(next, (char *)&nspcb, sizeof (nspcb)); if (nspcb.nsp_prev != prev) { printf("???\n"); break; @@ -110,12 +111,13 @@ nsprotopr(off, name) if (!aflag && ns_nullhost(nspcb.nsp_faddr) ) { continue; } - kvm_read((off_t)nspcb.nsp_socket, + kvm_read(nspcb.nsp_socket, (char *)&sockb, sizeof (sockb)); - ppcb = (off_t) nspcb.nsp_pcb; + ppcb = (off_t)(long)nspcb.nsp_pcb; if (ppcb) { if (isspp) { - kvm_read(ppcb, (char *)&sppcb, sizeof (sppcb)); + kvm_read((void *)(long)ppcb, (char *)&sppcb, + sizeof (sppcb)); } else continue; } else if (isspp) continue; @@ -165,7 +167,7 @@ spp_stats(off, name) if (off == 0) return; - kvm_read(off, (char *)&spp_istat, sizeof (spp_istat)); + kvm_read((void *)(long)off, (char *)&spp_istat, sizeof (spp_istat)); printf("%s:\n", name); ANY(spp_istat.nonucn, "connection", " dropped due to no new sockets "); ANY(spp_istat.gonawy, "connection", " terminated due to our end dying"); @@ -241,7 +243,7 @@ idp_stats(off, name) if (off == 0) return; - kvm_read(off, (char *)&idpstat, sizeof (idpstat)); + kvm_read((void *)(long)off, (char *)&idpstat, sizeof (idpstat)); printf("%s:\n", name); ANY(idpstat.idps_toosmall, "packet", " smaller than a header"); ANY(idpstat.idps_tooshort, "packet", " smaller than advertised"); @@ -279,7 +281,7 @@ nserr_stats(off, name) if (off == 0) return; - kvm_read(off, (char *)&ns_errstat, sizeof (ns_errstat)); + kvm_read((void *)(long)off, (char *)&ns_errstat, sizeof (ns_errstat)); printf("NS error statistics:\n"); ANY(ns_errstat.ns_es_error, "call", " to ns_error"); ANY(ns_errstat.ns_es_oldshort, "error", diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index f4a8c9422caa..43dbd576c0dc 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -33,7 +33,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)route.c 5.20 (Berkeley) 11/29/90";*/ -static char rcsid[] = "$Id: route.c,v 1.7 1994/03/07 09:19:56 cgd Exp $"; +static char rcsid[] = "$Id: route.c,v 1.8 1994/03/28 10:29:58 cgd Exp $"; #endif /* not lint */ #include @@ -60,6 +60,8 @@ static char rcsid[] = "$Id: route.c,v 1.7 1994/03/07 09:19:56 cgd Exp $"; #include #include +#include +#include #include extern int nflag, aflag, Aflag, af; @@ -70,7 +72,7 @@ extern char *ns_print(); #endif extern char *malloc(); #define kget(p, d) \ - (kvm_read((off_t)(p), (char *)&(d), sizeof (d))) + (kvm_read((p), (char *)&(d), sizeof (d))) /* * Definitions for showing gateway flags. @@ -132,9 +134,10 @@ routepr(hostaddr, netaddr, hashsizeaddr, treeaddr) printf("rthashsize: symbol not in namelist\n"); return; } - kget(hashsizeaddr, hashsize); + kget((void *)(long)hashsizeaddr, hashsize); routehash = (struct mbuf **)malloc( hashsize*sizeof (struct mbuf *) ); - kvm_read(hostaddr, (char *)routehash, hashsize*sizeof (struct mbuf *)); + kvm_read((void *)(long)hostaddr, (char *)routehash, + hashsize*sizeof (struct mbuf *)); again: for (i = 0; i < hashsize; i++) { if (routehash[i] == 0) @@ -149,7 +152,7 @@ again: } } if (doinghost) { - kvm_read(netaddr, (char *)routehash, + kvm_read((void *)(long)netaddr, (char *)routehash, hashsize*sizeof (struct mbuf *)); doinghost = 0; goto again; @@ -225,7 +228,7 @@ off_t rtree; if (Aflag == 0 && NewTree) return(ntreestuff()); - for (kget(rtree, rnh); rnh; rnh = head.rnh_next) { + for (kget((void *)(long)rtree, rnh); rnh; rnh = head.rnh_next) { kget(rnh, head); if (head.rnh_af == 0) { if (Aflag || af == AF_UNSPEC) { @@ -248,7 +251,7 @@ register struct sockaddr *dst; { kget(dst, pt_u.u_sa); if (pt_u.u_sa.sa_len > sizeof (pt_u.u_sa)) { - kvm_read((off_t)dst, pt_u.u_data, pt_u.u_sa.sa_len); + kvm_read(dst, pt_u.u_data, pt_u.u_sa.sa_len); } return (&pt_u.u_sa); } @@ -563,7 +566,7 @@ p_interface_nl(rt) return; } kget(rt->rt_ifp, ifnet); - kvm_read((off_t)ifnet.if_name, name, 16); + kvm_read(ifnet.if_name, name, 16); printf(" %.15s%d%s", name, ifnet.if_unit, rt->rt_nodes[0].rn_dupedkey ? " =>\n" : "\n"); } @@ -602,7 +605,7 @@ register struct ortentry *rt; return; } kget(rt->rt_ifp, ifnet); - kvm_read((off_t)ifnet.if_name, name, 16); + kvm_read(ifnet.if_name, name, 16); printf(" %.15s%d\n", name, ifnet.if_unit); } @@ -718,7 +721,7 @@ rt_stats(off) printf("rtstat: symbol not in namelist\n"); return; } - kvm_read(off, (char *)&rtstat, sizeof (rtstat)); + kvm_read((void *)(long)off, (char *)&rtstat, sizeof (rtstat)); printf("routing:\n"); printf("\t%u bad routing redirect%s\n", rtstat.rts_badredirect, plural(rtstat.rts_badredirect)); diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c index bdbda2e14e96..721a1efeeec6 100644 --- a/usr.bin/netstat/unix.c +++ b/usr.bin/netstat/unix.c @@ -33,7 +33,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)unix.c 5.11 (Berkeley) 7/1/91";*/ -static char rcsid[] = "$Id: unix.c,v 1.7 1994/01/11 23:27:10 mycroft Exp $"; +static char rcsid[] = "$Id: unix.c,v 1.8 1994/03/28 10:30:03 cgd Exp $"; #endif /* not lint */ /* @@ -53,6 +53,8 @@ struct uio; #include #include #include +#include +#include struct file *file, *fileNFILE; int nfiles; @@ -72,12 +74,12 @@ unixpr(fileheadaddr, nfilesaddr, unixsw) printf("filehead or nfiles not in namelist.\n"); return; } - if (kvm_read(nfilesaddr, (char *)&nfiles, sizeof (nfiles)) != - sizeof (nfiles)) { + if (kvm_read((void *)(long)nfilesaddr, (char *)&nfiles, + sizeof (nfiles)) != sizeof (nfiles)) { printf("nfiles: bad read.\n"); return; } - if (kvm_read(fileheadaddr, (char *)&filep, sizeof (filep)) + if (kvm_read((void *)(long)fileheadaddr, (char *)&filep, sizeof (filep)) != sizeof (filep)) { printf("File table address, bad read.\n"); return; @@ -91,7 +93,7 @@ unixpr(fileheadaddr, nfilesaddr, unixsw) filep != NULL && i-- > 0; filep = lfp->f_filef, lfp++) { - if(kvm_read((off_t)filep, (char *)lfp, sizeof (struct file)) + if(kvm_read(filep, (char *)lfp, sizeof (struct file)) != sizeof(struct file)) { printf("File table read error.\n"); return; @@ -101,7 +103,7 @@ unixpr(fileheadaddr, nfilesaddr, unixsw) for (fp = file; fp < fileNFILE; fp++) { if (fp->f_count == 0 || fp->f_type != DTYPE_SOCKET) continue; - if (kvm_read((off_t)fp->f_data, (char *)so, sizeof (*so)) + if (kvm_read(fp->f_data, (char *)so, sizeof (*so)) != sizeof (*so)) continue; /* kludge */ @@ -124,12 +126,12 @@ unixdomainpr(so, soaddr) struct sockaddr_un *sa; static int first = 1; - if (kvm_read((off_t)so->so_pcb, (char *)unp, sizeof (*unp)) + if (kvm_read(so->so_pcb, (char *)unp, sizeof (*unp)) != sizeof (*unp)) return; if (unp->unp_addr) { m = &mbuf; - if (kvm_read((off_t)unp->unp_addr, (char *)m, sizeof (*m)) + if (kvm_read(unp->unp_addr, (char *)m, sizeof (*m)) != sizeof (*m)) m = (struct mbuf *)0; sa = (struct sockaddr_un *)(m->m_dat);