diff options
author | 2005-03-25 17:01:03 +0000 | |
---|---|---|
committer | 2005-03-25 17:01:03 +0000 | |
commit | a0e12d64eb9e2c9828f72578d583f17e8831c386 (patch) | |
tree | 9e3cef336e2c98a977710c813ecfc0efd9e239a4 | |
parent | Use the return value from getopt() instead of optopt in non-error (diff) | |
download | wireguard-openbsd-a0e12d64eb9e2c9828f72578d583f17e8831c386.tar.xz wireguard-openbsd-a0e12d64eb9e2c9828f72578d583f17e8831c386.zip |
kill unneeded (char *) casts. ok millert, otto
-rw-r--r-- | usr.bin/netstat/atalk.c | 14 | ||||
-rw-r--r-- | usr.bin/netstat/if.c | 22 | ||||
-rw-r--r-- | usr.bin/netstat/inet.c | 41 | ||||
-rw-r--r-- | usr.bin/netstat/inet6.c | 18 | ||||
-rw-r--r-- | usr.bin/netstat/ipx.c | 21 | ||||
-rw-r--r-- | usr.bin/netstat/main.c | 6 | ||||
-rw-r--r-- | usr.bin/netstat/mbuf.c | 10 | ||||
-rw-r--r-- | usr.bin/netstat/mroute.c | 20 | ||||
-rw-r--r-- | usr.bin/netstat/mroute6.c | 18 | ||||
-rw-r--r-- | usr.bin/netstat/netstat.h | 4 | ||||
-rw-r--r-- | usr.bin/netstat/ns.c | 19 | ||||
-rw-r--r-- | usr.bin/netstat/route.c | 10 | ||||
-rw-r--r-- | usr.bin/netstat/unix.c | 12 |
13 files changed, 105 insertions, 110 deletions
diff --git a/usr.bin/netstat/atalk.c b/usr.bin/netstat/atalk.c index fec8b7209c6..86c677a33e0 100644 --- a/usr.bin/netstat/atalk.c +++ b/usr.bin/netstat/atalk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atalk.c,v 1.12 2004/03/13 22:02:13 deraadt Exp $ */ +/* $OpenBSD: atalk.c,v 1.13 2005/03/25 17:01:03 jaredy Exp $ */ /* $NetBSD: atalk.c,v 1.2 1997/05/22 17:21:26 christos Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from @(#)atalk.c 1.1 (Whistle) 6/6/96"; #else -static char rcsid[] = "$OpenBSD: atalk.c,v 1.12 2004/03/13 22:02:13 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: atalk.c,v 1.13 2005/03/25 17:01:03 jaredy Exp $"; #endif #endif /* not lint */ @@ -251,14 +251,14 @@ atalkprotopr(u_long off, char *name) if (off == 0) return; - if (kread(off, (char *) &initial, sizeof(struct ddpcb *)) < 0) + if (kread(off, &initial, sizeof(struct ddpcb *)) < 0) return; ddpcb = cb; prev = (struct ddpcb *) off; for (next = initial; next != NULL; prev = next) { u_long ppcb = (u_long) next; - if (kread((u_long) next, (char *) &ddpcb, sizeof(ddpcb)) < 0) + if (kread((u_long) next, &ddpcb, sizeof(ddpcb)) < 0) return; next = ddpcb.ddp_next; #if 0 @@ -266,8 +266,8 @@ atalkprotopr(u_long off, char *name) continue; } #endif - if (kread((u_long) ddpcb.ddp_socket, - (char *) &sockb, sizeof(sockb)) < 0) + if (kread((u_long) ddpcb.ddp_socket, &sockb, + sizeof(sockb)) < 0) return; if (first) { printf("Active ATALK connections"); @@ -312,7 +312,7 @@ ddp_stats(u_long off, char *name) if (off == 0) return; - if (kread(off, (char *) &ddpstat, sizeof(ddpstat)) < 0) + if (kread(off, &ddpstat, sizeof(ddpstat)) < 0) return; printf("%s:\n", name); p(ddps_short, "\t%ld packet%s with short headers\n"); diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index a5c807a3d36..ac8bedf81a7 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.42 2005/03/13 16:05:50 mpf Exp $ */ +/* $OpenBSD: if.c,v 1.43 2005/03/25 17:01:03 jaredy Exp $ */ /* $NetBSD: if.c,v 1.16.4.2 1996/06/07 21:46:46 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94"; #else -static char *rcsid = "$OpenBSD: if.c,v 1.42 2005/03/13 16:05:50 mpf Exp $"; +static char *rcsid = "$OpenBSD: if.c,v 1.43 2005/03/25 17:01:03 jaredy Exp $"; #endif #endif /* not lint */ @@ -106,7 +106,7 @@ intpr(int interval, u_long ifnetaddr) * the pointer to the TAILQ_HEAD with the actual pointer * to the first list element. */ - if (kread(ifnetaddr, (char *)&ifhead, sizeof ifhead)) + if (kread(ifnetaddr, &ifhead, sizeof ifhead)) return; ifnetaddr = (u_long)ifhead.tqh_first; @@ -132,7 +132,7 @@ intpr(int interval, u_long ifnetaddr) int n, m; if (ifaddraddr == 0) { - if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet)) + if (kread(ifnetaddr, &ifnet, sizeof ifnet)) return; bcopy(ifnet.if_xname, name, IFNAMSIZ); name[IFNAMSIZ - 1] = '\0'; /* sanity */ @@ -166,7 +166,7 @@ intpr(int interval, u_long ifnetaddr) printf("%-11.11s ", "none"); printf("%-17.17s ", "none"); } else { - if (kread(ifaddraddr, (char *)&ifaddr, sizeof ifaddr)) { + if (kread(ifaddraddr, &ifaddr, sizeof ifaddr)) { ifaddraddr = 0; continue; } @@ -210,8 +210,7 @@ intpr(int interval, u_long ifnetaddr) multiaddr = (u_long)ifaddr.in.ia_multiaddrs.lh_first; while (multiaddr != 0) { - kread(multiaddr, (char *)&inm, - sizeof inm); + kread(multiaddr, &inm, sizeof inm); printf("\n%25s %-17.17s ", "", routename(inm.inm_addr.s_addr)); multiaddr = (u_long)inm.inm_list.le_next; @@ -250,8 +249,7 @@ intpr(int interval, u_long ifnetaddr) multiaddr = (u_long)ifaddr.in6.ia6_multiaddrs.lh_first; while (multiaddr != 0) { - kread(multiaddr, (char *)&inm, - sizeof inm); + kread(multiaddr, &inm, sizeof inm); memset(&m6, 0, sizeof(m6)); m6.sin6_len = sizeof(struct sockaddr_in6); m6.sin6_family = AF_INET6; @@ -401,7 +399,7 @@ sidewaysintpr(unsigned int interval, u_long off) * the pointer to the TAILQ_HEAD with the actual pointer * to the first list element. */ - if (kread(off, (char *)&ifhead, sizeof ifhead)) + if (kread(off, &ifhead, sizeof ifhead)) return; firstifnet = (u_long)ifhead.tqh_first; @@ -410,7 +408,7 @@ sidewaysintpr(unsigned int interval, u_long off) total = sum - 1; interesting = (interface == NULL) ? iftot : NULL; for (off = firstifnet, ip = iftot; off;) { - if (kread(off, (char *)&ifnet, sizeof ifnet)) + if (kread(off, &ifnet, sizeof ifnet)) break; bzero(ip->ift_name, sizeof(ip->ift_name)); snprintf(ip->ift_name, IFNAMSIZ, "%s", ifnet.if_xname); @@ -494,7 +492,7 @@ loop: sum->ift_co = 0; sum->ift_dr = 0; for (off = firstifnet, ip = iftot; off && ip < lastif; ip++) { - if (kread(off, (char *)&ifnet, sizeof ifnet)) { + if (kread(off, &ifnet, sizeof ifnet)) { off = 0; continue; } diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 26bff285170..cf6ca0a2848 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.92 2005/02/10 14:25:08 itojun Exp $ */ +/* $OpenBSD: inet.c,v 1.93 2005/03/25 17:01:03 jaredy Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -static const char *rcsid = "$OpenBSD: inet.c,v 1.92 2005/02/10 14:25:08 itojun Exp $"; +static const char *rcsid = "$OpenBSD: inet.c,v 1.93 2005/03/25 17:01:03 jaredy Exp $"; #endif #endif /* not lint */ @@ -138,13 +138,13 @@ protopr0(u_long off, char *name, int af) return; istcp = strcmp(name, "tcp") == 0; israw = strncmp(name, "ip", 2) == 0; - kread(off, (char *)&table, sizeof table); + kread(off, &table, sizeof table); prev = head = (struct inpcb *)&((struct inpcbtable *)off)->inpt_queue.cqh_first; next = table.inpt_queue.cqh_first; while (next != head) { - kread((u_long)next, (char *)&inpcb, sizeof inpcb); + kread((u_long)next, &inpcb, sizeof inpcb); if (inpcb.inp_queue.cqe_prev != prev) { printf("???\n"); break; @@ -168,10 +168,9 @@ protopr0(u_long off, char *name, int af) if (!aflag && inet_lnaof(inpcb.inp_laddr) == INADDR_ANY) continue; - kread((u_long)inpcb.inp_socket, (char *)&sockb, sizeof (sockb)); + kread((u_long)inpcb.inp_socket, &sockb, sizeof (sockb)); if (istcp) { - kread((u_long)inpcb.inp_ppcb, - (char *)&tcpcb, sizeof (tcpcb)); + kread((u_long)inpcb.inp_ppcb, &tcpcb, sizeof (tcpcb)); } if (first) { printf("Active Internet connections"); @@ -250,7 +249,7 @@ tcp_stats(u_long off, char *name) if (off == 0) return; printf("%s:\n", name); - kread(off, (char *)&tcpstat, sizeof (tcpstat)); + kread(off, &tcpstat, sizeof (tcpstat)); #define p(f, m) if (tcpstat.f || sflag <= 1) \ printf(m, tcpstat.f, plural(tcpstat.f)) @@ -366,7 +365,7 @@ udp_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&udpstat, sizeof (udpstat)); + kread(off, &udpstat, sizeof (udpstat)); printf("%s:\n", name); #define p(f, m) if (udpstat.f || sflag <= 1) \ printf(m, udpstat.f, plural(udpstat.f)) @@ -406,7 +405,7 @@ ip_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&ipstat, sizeof (ipstat)); + kread(off, &ipstat, sizeof (ipstat)); printf("%s:\n", name); #define p(f, m) if (ipstat.f || sflag <= 1) \ @@ -504,7 +503,7 @@ icmp_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&icmpstat, sizeof (icmpstat)); + kread(off, &icmpstat, sizeof (icmpstat)); printf("%s:\n", name); #define p(f, m) if (icmpstat.f || sflag <= 1) \ @@ -555,7 +554,7 @@ igmp_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&igmpstat, sizeof (igmpstat)); + kread(off, &igmpstat, sizeof (igmpstat)); printf("%s:\n", name); #define p(f, m) if (igmpstat.f || sflag <= 1) \ @@ -586,7 +585,7 @@ pim_stats(u_long off, char *name) if (off == 0) return; - if (kread(off, (char *)&pimstat, sizeof (pimstat)) != 0) { + if (kread(off, &pimstat, sizeof (pimstat)) != 0) { /* XXX: PIM is probably not enabled in the kernel */ return; } @@ -637,7 +636,7 @@ getrpcportnam(in_port_t port, int proto) if (first == 0) { first = 1; - memset((char *)&server_addr, 0, sizeof server_addr); + memset(&server_addr, 0, sizeof server_addr); server_addr.sin_family = AF_INET; if ((hp = gethostbyname("localhost")) != NULL) memmove((caddr_t)&server_addr.sin_addr, hp->h_addr, @@ -779,7 +778,7 @@ ah_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&ahstat, sizeof (ahstat)); + kread(off, &ahstat, sizeof (ahstat)); printf("%s:\n", name); #define p(f, m) if (ahstat.f || sflag <= 1) \ @@ -820,7 +819,7 @@ etherip_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)ðeripstat, sizeof (etheripstat)); + kread(off, ðeripstat, sizeof (etheripstat)); printf("%s:\n", name); #define p(f, m) if (etheripstat.f || sflag <= 1) \ @@ -848,7 +847,7 @@ esp_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&espstat, sizeof (espstat)); + kread(off, &espstat, sizeof (espstat)); printf("%s:\n", name); #define p(f, m) if (espstat.f || sflag <= 1) \ @@ -890,7 +889,7 @@ ipip_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&ipipstat, sizeof (ipipstat)); + kread(off, &ipipstat, sizeof (ipipstat)); printf("%s:\n", name); #define p(f, m) if (ipipstat.f || sflag <= 1) \ @@ -919,7 +918,7 @@ carp_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&carpstat, sizeof(carpstat)); + kread(off, &carpstat, sizeof(carpstat)); printf("%s:\n", name); #define p(f, m) if (carpstat.f || sflag <= 1) \ @@ -955,7 +954,7 @@ pfsync_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&pfsyncstat, sizeof(pfsyncstat)); + kread(off, &pfsyncstat, sizeof(pfsyncstat)); printf("%s:\n", name); #define p(f, m) if (pfsyncstat.f || sflag <= 1) \ @@ -993,7 +992,7 @@ ipcomp_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&ipcompstat, sizeof (ipcompstat)); + kread(off, &ipcompstat, sizeof (ipcompstat)); printf("%s:\n", name); #define p(f, m) if (ipcompstat.f || sflag <= 1) \ diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c index a22eab3c404..0fe8406d427 100644 --- a/usr.bin/netstat/inet6.c +++ b/usr.bin/netstat/inet6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet6.c,v 1.31 2004/11/17 01:47:20 itojun Exp $ */ +/* $OpenBSD: inet6.c,v 1.32 2005/03/25 17:01:03 jaredy Exp $ */ /* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */ /* * Copyright (c) 1983, 1988, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -/*__RCSID("$OpenBSD: inet6.c,v 1.31 2004/11/17 01:47:20 itojun Exp $");*/ +/*__RCSID("$OpenBSD: inet6.c,v 1.32 2005/03/25 17:01:03 jaredy Exp $");*/ /*__RCSID("KAME Id: inet6.c,v 1.10 2000/02/09 10:49:31 itojun Exp");*/ #endif #endif /* not lint */ @@ -352,7 +352,7 @@ ip6_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&ip6stat, sizeof (ip6stat)); + kread(off, &ip6stat, sizeof (ip6stat)); printf("%s:\n", name); #define p(f, m) if (ip6stat.f || sflag <= 1) \ @@ -523,7 +523,7 @@ ip6_ifstats(char *ifname) strlcpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name); printf("ip6 on %s:\n", ifr.ifr_name); - if (ioctl(s, SIOCGIFSTAT_IN6, (char *)&ifr) < 0) { + if (ioctl(s, SIOCGIFSTAT_IN6, &ifr) < 0) { perror("Warning: ioctl(SIOCGIFSTAT_IN6)"); goto end; } @@ -828,7 +828,7 @@ icmp6_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&icmp6stat, sizeof (icmp6stat)); + kread(off, &icmp6stat, sizeof (icmp6stat)); printf("%s:\n", name); #define p(f, m) if (icmp6stat.f || sflag <= 1) \ @@ -912,7 +912,7 @@ icmp6_ifstats(char *ifname) strlcpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name); printf("icmp6 on %s:\n", ifr.ifr_name); - if (ioctl(s, SIOCGIFSTAT_ICMP6, (char *)&ifr) < 0) { + if (ioctl(s, SIOCGIFSTAT_ICMP6, &ifr) < 0) { perror("Warning: ioctl(SIOCGIFSTAT_ICMP6)"); goto end; } @@ -968,7 +968,7 @@ pim6_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&pim6stat, sizeof(pim6stat)); + kread(off, &pim6stat, sizeof(pim6stat)); printf("%s:\n", name); #define p(f, m) if (pim6stat.f || sflag <= 1) \ @@ -995,7 +995,7 @@ rip6_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&rip6stat, sizeof(rip6stat)); + kread(off, &rip6stat, sizeof(rip6stat)); printf("%s:\n", name); #define p(f, m) if (rip6stat.f || sflag <= 1) \ @@ -1136,7 +1136,7 @@ tcp6_dump(u_long pcbaddr) struct tcp6cb tcp6cb; int i; - kread(pcbaddr, (char *)&tcp6cb, sizeof(tcp6cb)); + kread(pcbaddr, &tcp6cb, sizeof(tcp6cb)); printf("TCP Protocol Control Block at 0x%08lx:\n\n", pcbaddr); diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c index 213382f7883..a8ab5f283a1 100644 --- a/usr.bin/netstat/ipx.c +++ b/usr.bin/netstat/ipx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipx.c,v 1.15 2003/11/08 19:17:29 jmc Exp $ */ +/* $OpenBSD: ipx.c,v 1.16 2005/03/25 17:01:03 jaredy Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)ns.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: ipx.c,v 1.15 2003/11/08 19:17:29 jmc Exp $"; +static char *rcsid = "$OpenBSD: ipx.c,v 1.16 2005/03/25 17:01:03 jaredy Exp $"; #endif #endif /* not lint */ @@ -97,13 +97,13 @@ ipxprotopr(u_long off, char *name) if (off == 0) return; isspx = strcmp(name, "spx") == 0; - kread(off, (char *)&table, sizeof (table)); + kread(off, &table, sizeof (table)); prev = head = (struct ipxpcb *) &((struct ipxpcbtable *)off)->ipxpt_queue.cqh_first; next = table.ipxpt_queue.cqh_first; while (next != head) { - kread((u_long)next, (char *)&ipxpcb, sizeof (ipxpcb)); + kread((u_long)next, &ipxpcb, sizeof (ipxpcb)); if (ipxpcb.ipxp_queue.cqe_prev != prev) { printf("???\n"); break; @@ -114,11 +114,10 @@ ipxprotopr(u_long off, char *name) if (!aflag && ipx_nullhost(ipxpcb.ipxp_faddr) ) continue; - kread((u_long)ipxpcb.ipxp_socket, - (char *)&sockb, sizeof (sockb)); + kread((u_long)ipxpcb.ipxp_socket, &sockb, sizeof (sockb)); if (isspx) { - kread((u_long)ipxpcb.ipxp_ppcb, - (char *)&spxpcb, sizeof (spxpcb)); + kread((u_long)ipxpcb.ipxp_ppcb, &spxpcb, + sizeof (spxpcb)); } if (first) { printf("Active Internetwork Packet Exchange connections"); @@ -167,7 +166,7 @@ spx_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&spx_istat, sizeof (spx_istat)); + kread(off, &spx_istat, sizeof (spx_istat)); printf("%s:\n", name); ANY((long)spx_istat.nonucn, "connection", " dropped due to no new sockets "); ANY((long)spx_istat.gonawy, "connection", " terminated due to our end dying"); @@ -242,7 +241,7 @@ ipx_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&ipxstat, sizeof (ipxstat)); + kread(off, &ipxstat, sizeof (ipxstat)); printf("%s:\n", name); ANY(ipxstat.ipxs_toosmall, "packet", " smaller than a header"); ANY(ipxstat.ipxs_tooshort, "packet", " smaller than advertised"); @@ -280,7 +279,7 @@ ipxerr_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&ipx_errstat, sizeof (ipx_errstat)); + kread(off, &ipx_errstat, sizeof (ipx_errstat)); printf("IPX error statistics:\n"); ANY(ipx_errstat.ipx_es_error, "call", " to ipx_error"); ANY(ipx_errstat.ipx_es_oldshort, "error", diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 83e43082ee8..cea5bddd028 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.52 2005/02/10 14:25:08 itojun Exp $ */ +/* $OpenBSD: main.c,v 1.53 2005/03/25 17:01:04 jaredy Exp $ */ /* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ char copyright[] = #if 0 static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94"; #else -static char *rcsid = "$OpenBSD: main.c,v 1.52 2005/02/10 14:25:08 itojun Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.53 2005/03/25 17:01:04 jaredy Exp $"; #endif #endif /* not lint */ @@ -561,7 +561,7 @@ printproto(struct protox *tp, char *name) * Read kernel memory, return 0 on success. */ int -kread(u_long addr, char *buf, int size) +kread(u_long addr, void *buf, int size) { if (kvm_read(kvmd, addr, buf, size) != size) { diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c index f1942f496b5..ade56e08d17 100644 --- a/usr.bin/netstat/mbuf.c +++ b/usr.bin/netstat/mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.c,v 1.21 2004/04/16 23:06:56 tedu Exp $ */ +/* $OpenBSD: mbuf.c,v 1.22 2005/03/25 17:01:04 jaredy Exp $ */ /* $NetBSD: mbuf.c,v 1.9 1996/05/07 02:55:03 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)mbuf.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: mbuf.c,v 1.21 2004/04/16 23:06:56 tedu Exp $"; +static char *rcsid = "$OpenBSD: mbuf.c,v 1.22 2005/03/25 17:01:04 jaredy Exp $"; #endif #endif /* not lint */ @@ -105,12 +105,12 @@ mbpr(u_long mbaddr, u_long mbpooladdr, u_long mclpooladdr) return; } - if (kread(mbaddr, (char *)&mbstat, sizeof (mbstat))) + if (kread(mbaddr, &mbstat, sizeof (mbstat))) return; - if (kread(mbpooladdr, (char *)&mbpool, sizeof (mbpool))) + if (kread(mbpooladdr, &mbpool, sizeof (mbpool))) return; - if (kread(mclpooladdr, (char *)&mclpool, sizeof (mclpool))) + if (kread(mclpooladdr, &mclpool, sizeof (mclpool))) return; } else { mib[0] = CTL_KERN; diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c index c8055a7b7f7..8d98789e402 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mroute.c,v 1.12 2005/01/14 15:00:44 mcbride Exp $ */ +/* $OpenBSD: mroute.c,v 1.13 2005/03/25 17:01:04 jaredy Exp $ */ /* $NetBSD: mroute.c,v 1.10 1996/05/11 13:51:27 mycroft Exp $ */ /* @@ -103,7 +103,7 @@ mroutepr(u_long mrpaddr, u_long mfchashtbladdr, u_long mfchashaddr, u_long vifad return; } - kread(mrpaddr, (char *)&mrtproto, sizeof(mrtproto)); + kread(mrpaddr, &mrtproto, sizeof(mrtproto)); switch (mrtproto) { case 0: printf("no multicast routing compiled into this system\n"); @@ -133,7 +133,7 @@ mroutepr(u_long mrpaddr, u_long mfchashtbladdr, u_long mfchashaddr, u_long vifad saved_nflag = nflag; nflag = 1; - kread(vifaddr, (char *)&viftable, sizeof(viftable)); + kread(vifaddr, &viftable, sizeof(viftable)); banner_printed = 0; numvifs = 0; @@ -159,14 +159,14 @@ mroutepr(u_long mrpaddr, u_long mfchashtbladdr, u_long mfchashaddr, u_long vifad if (!banner_printed) printf("\nVirtual Interface Table is empty\n"); - kread(mfchashtbladdr, (char *)&mfchashtbl, sizeof(mfchashtbl)); - kread(mfchashaddr, (char *)&mfchash, sizeof(mfchash)); + kread(mfchashtbladdr, &mfchashtbl, sizeof(mfchashtbl)); + kread(mfchashaddr, &mfchash, sizeof(mfchash)); banner_printed = 0; nmfc = 0; if (mfchashtbl != 0) for (i = 0; i <= mfchash; ++i) { - kread((u_long)&mfchashtbl[i], (char *)&mfcp, sizeof(mfcp)); + kread((u_long)&mfchashtbl[i], &mfcp, sizeof(mfcp)); for (; mfcp != 0; mfcp = mfc.mfc_hash.le_next) { if (!banner_printed) { @@ -176,7 +176,7 @@ mroutepr(u_long mrpaddr, u_long mfchashtbladdr, u_long mfchashaddr, u_long vifad banner_printed = 1; } - kread((u_long)mfcp, (char *)&mfc, sizeof(mfc)); + kread((u_long)mfcp, &mfc, sizeof(mfc)); printf(" %3u %-15.15s", i, routename(mfc.mfc_origin.s_addr)); printf(" %-15.15s %7s %3u ", @@ -197,7 +197,7 @@ mroutepr(u_long mrpaddr, u_long mfchashtbladdr, u_long mfchashaddr, u_long vifad bwm = mfc.mfc_bw_meter; while (bwm) { kread((u_long)bwm, - (char *)&bw_meter, + &bw_meter, sizeof bw_meter); print_bw_meter(&bw_meter, &banner_printed2); @@ -309,7 +309,7 @@ mrt_stats(u_long mrpaddr, u_long mstaddr) return; } - kread(mrpaddr, (char *)&mrtproto, sizeof(mrtproto)); + kread(mrpaddr, &mrtproto, sizeof(mrtproto)); switch (mrtproto) { case 0: printf("no multicast routing compiled into this system\n"); @@ -328,7 +328,7 @@ mrt_stats(u_long mrpaddr, u_long mstaddr) return; } - kread(mstaddr, (char *)&mrtstat, sizeof(mrtstat)); + kread(mstaddr, &mrtstat, sizeof(mrtstat)); printf("multicast routing:\n"); printf("\t%lu datagram%s with no route for origin\n", mrtstat.mrts_no_route, plural(mrtstat.mrts_no_route)); diff --git a/usr.bin/netstat/mroute6.c b/usr.bin/netstat/mroute6.c index 4ccac5d4b70..1833dbcaa27 100644 --- a/usr.bin/netstat/mroute6.c +++ b/usr.bin/netstat/mroute6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mroute6.c,v 1.7 2003/06/03 02:56:13 millert Exp $ */ +/* $OpenBSD: mroute6.c,v 1.8 2005/03/25 17:01:04 jaredy Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -102,7 +102,7 @@ mroute6pr(u_long mrpaddr, u_long mfcaddr, u_long mifaddr) return; } - kread(mrpaddr, (char *)&mrtproto, sizeof(mrtproto)); + kread(mrpaddr, &mrtproto, sizeof(mrtproto)); switch (mrtproto) { case 0: @@ -130,7 +130,7 @@ mroute6pr(u_long mrpaddr, u_long mfcaddr, u_long mifaddr) saved_nflag = nflag; nflag = 1; - kread(mifaddr, (char *)&mif6table, sizeof(mif6table)); + kread(mifaddr, &mif6table, sizeof(mif6table)); banner_printed = 0; for (mifi = 0, mifp = mif6table; mifi < MAXMIFS; ++mifi, ++mifp) { struct ifnet ifnet; @@ -139,7 +139,7 @@ mroute6pr(u_long mrpaddr, u_long mfcaddr, u_long mifaddr) if (mifp->m6_ifp == NULL) continue; - kread((u_long)mifp->m6_ifp, (char *)&ifnet, sizeof(ifnet)); + kread((u_long)mifp->m6_ifp, &ifnet, sizeof(ifnet)); maxmif = mifi; if (!banner_printed) { printf("\nIPv6 Multicast Interface Table\n" @@ -158,12 +158,12 @@ mroute6pr(u_long mrpaddr, u_long mfcaddr, u_long mifaddr) if (!banner_printed) printf("\nIPv6 Multicast Interface Table is empty\n"); - kread(mfcaddr, (char *)&mf6ctable, sizeof(mf6ctable)); + kread(mfcaddr, &mf6ctable, sizeof(mf6ctable)); banner_printed = 0; for (i = 0; i < MF6CTBLSIZ; ++i) { mfcp = mf6ctable[i]; while (mfcp) { - kread((u_long)mfcp, (char *)&mfc, sizeof(mfc)); + kread((u_long)mfcp, &mfc, sizeof(mfc)); if (!banner_printed) { printf ("\nIPv6 Multicast Forwarding Cache\n"); printf(" %-*.*s %-*.*s %s", @@ -181,7 +181,7 @@ mroute6pr(u_long mrpaddr, u_long mfcaddr, u_long mifaddr) for (waitings = 0, rtep = mfc.mf6c_stall; rtep; ) { waitings++; - kread((u_long)rtep, (char *)&rte, sizeof(rte)); + kread((u_long)rtep, &rte, sizeof(rte)); rtep = rte.next; } printf(" %3d", waitings); @@ -217,7 +217,7 @@ mrt6_stats(u_long mrpaddr, u_long mstaddr) return; } - kread(mrpaddr, (char *)&mrtproto, sizeof(mrtproto)); + kread(mrpaddr, &mrtproto, sizeof(mrtproto)); switch (mrtproto) { case 0: printf("no IPv6 multicast routing compiled into this system\n"); @@ -237,7 +237,7 @@ mrt6_stats(u_long mrpaddr, u_long mstaddr) return; } - kread(mstaddr, (char *)&mrtstat, sizeof(mrtstat)); + kread(mstaddr, &mrtstat, sizeof(mrtstat)); printf("multicast forwarding:\n"); printf(" %10qu multicast forwarding cache lookup%s\n", mrtstat.mrt6s_mfc_lookups, plural(mrtstat.mrt6s_mfc_lookups)); diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index f4685d60d33..a0c4d1eaa8f 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.h,v 1.31 2005/02/10 14:25:08 itojun Exp $ */ +/* $OpenBSD: netstat.h,v 1.32 2005/03/25 17:01:04 jaredy Exp $ */ /* $NetBSD: netstat.h,v 1.6 1996/05/07 02:55:05 thorpej Exp $ */ /* @@ -63,7 +63,7 @@ int af; /* address family */ extern char *__progname; /* program name, from crt0.o */ -int kread(u_long addr, char *buf, int size); +int kread(u_long addr, void *buf, int size); char *plural(int); char *plurales(int); diff --git a/usr.bin/netstat/ns.c b/usr.bin/netstat/ns.c index fbaa754bf38..65bfc1c0225 100644 --- a/usr.bin/netstat/ns.c +++ b/usr.bin/netstat/ns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ns.c,v 1.11 2003/06/03 02:56:13 millert Exp $ */ +/* $OpenBSD: ns.c,v 1.12 2005/03/25 17:01:04 jaredy Exp $ */ /* $NetBSD: ns.c,v 1.8 1995/10/03 21:42:46 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)ns.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: ns.c,v 1.11 2003/06/03 02:56:13 millert Exp $"; +static char *rcsid = "$OpenBSD: ns.c,v 1.12 2005/03/25 17:01:04 jaredy Exp $"; #endif #endif /* not lint */ @@ -94,7 +94,7 @@ nsprotopr(u_long off, char *name) if (off == 0) return; isspp = strcmp(name, "spp") == 0; - kread(off, (char *)&cb, sizeof (struct nspcb)); + kread(off, &cb, sizeof (struct nspcb)); nspcb = cb; prev = (struct nspcb *)off; if (nspcb.nsp_next == (struct nspcb *)off) @@ -103,7 +103,7 @@ nsprotopr(u_long off, char *name) u_long ppcb; next = nspcb.nsp_next; - kread((u_long)next, (char *)&nspcb, sizeof (nspcb)); + kread((u_long)next, &nspcb, sizeof (nspcb)); if (nspcb.nsp_prev != prev) { printf("???\n"); break; @@ -111,12 +111,11 @@ nsprotopr(u_long off, char *name) if (!aflag && ns_nullhost(nspcb.nsp_faddr) ) { continue; } - kread((u_long)nspcb.nsp_socket, - (char *)&sockb, sizeof (sockb)); + kread((u_long)nspcb.nsp_socket, &sockb, sizeof (sockb)); ppcb = (u_long) nspcb.nsp_pcb; if (ppcb) { if (isspp) { - kread(ppcb, (char *)&sppcb, sizeof (sppcb)); + kread(ppcb, &sppcb, sizeof (sppcb)); } else continue; } else if (isspp) continue; @@ -165,7 +164,7 @@ spp_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&spp_istat, sizeof (spp_istat)); + kread(off, &spp_istat, sizeof (spp_istat)); printf("%s:\n", name); ANY((long)spp_istat.nonucn, "connection", " dropped due to no new sockets "); @@ -245,7 +244,7 @@ idp_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&idpstat, sizeof (idpstat)); + kread(off, &idpstat, sizeof (idpstat)); printf("%s:\n", name); ANY(idpstat.idps_toosmall, "packet", " smaller than a header"); ANY(idpstat.idps_tooshort, "packet", " smaller than advertised"); @@ -282,7 +281,7 @@ nserr_stats(u_long off, char *name) if (off == 0) return; - kread(off, (char *)&ns_errstat, sizeof (ns_errstat)); + kread(off, &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 95055abff04..76160ecfc13 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.66 2004/11/17 01:47:20 itojun Exp $ */ +/* $OpenBSD: route.c,v 1.67 2005/03/25 17:01:04 jaredy Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else -static char *rcsid = "$OpenBSD: route.c,v 1.66 2004/11/17 01:47:20 itojun Exp $"; +static char *rcsid = "$OpenBSD: route.c,v 1.67 2005/03/25 17:01:04 jaredy Exp $"; #endif #endif /* not lint */ @@ -77,7 +77,7 @@ static char *rcsid = "$OpenBSD: route.c,v 1.66 2004/11/17 01:47:20 itojun Exp $" #include <netinet/ip_ipsp.h> #include "netstat.h" -#define kget(p, d) (kread((u_long)(p), (char *)&(d), sizeof (d))) +#define kget(p, d) (kread((u_long)(p), &(d), sizeof (d))) /* alignment constraint for routing socket */ #define ROUNDUP(a) \ @@ -278,7 +278,7 @@ kgetsa(struct sockaddr *dst) kget(dst, pt_u.u_sa); if (pt_u.u_sa.sa_len > sizeof (pt_u.u_sa)) - kread((u_long)dst, (char *)pt_u.u_data, pt_u.u_sa.sa_len); + kread((u_long)dst, pt_u.u_data, pt_u.u_sa.sa_len); return (&pt_u.u_sa); } @@ -854,7 +854,7 @@ rt_stats(u_long off) printf("rtstat: symbol not in namelist\n"); return; } - kread(off, (char *)&rtstat, sizeof (rtstat)); + kread(off, &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 daad60ad76c..db47e7e8c54 100644 --- a/usr.bin/netstat/unix.c +++ b/usr.bin/netstat/unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unix.c,v 1.11 2004/03/13 22:02:13 deraadt Exp $ */ +/* $OpenBSD: unix.c,v 1.12 2005/03/25 17:01:04 jaredy Exp $ */ /* $NetBSD: unix.c,v 1.13 1995/10/03 21:42:48 thorpej Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)unix.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: unix.c,v 1.11 2004/03/13 22:02:13 deraadt Exp $"; +static char *rcsid = "$OpenBSD: unix.c,v 1.12 2005/03/25 17:01:04 jaredy Exp $"; #endif #endif /* not lint */ @@ -76,7 +76,7 @@ unixpr(u_long off) char *filebuf; struct protosw *unixsw = (struct protosw *)off; - filebuf = (char *)kvm_getfiles(kvmd, KERN_FILE, 0, &nfiles); + filebuf = kvm_getfiles(kvmd, KERN_FILE, 0, &nfiles); if (filebuf == NULL) { printf("Out of memory (file table).\n"); return; @@ -86,7 +86,7 @@ unixpr(u_long off) for (fp = file; fp < fileNFILE; fp++) { if (fp->f_count == 0 || fp->f_type != DTYPE_SOCKET) continue; - if (kread((u_long)fp->f_data, (char *)so, sizeof (*so))) + if (kread((u_long)fp->f_data, so, sizeof (*so))) continue; /* kludge */ if (so->so_proto >= unixsw && so->so_proto <= unixsw + 2) @@ -106,11 +106,11 @@ unixdomainpr(struct socket *so, caddr_t soaddr) struct sockaddr_un *sa = NULL; static int first = 1; - if (kread((u_long)so->so_pcb, (char *)unp, sizeof (*unp))) + if (kread((u_long)so->so_pcb, unp, sizeof (*unp))) return; if (unp->unp_addr) { m = &mbuf; - if (kread((u_long)unp->unp_addr, (char *)m, sizeof (*m))) + if (kread((u_long)unp->unp_addr, m, sizeof (*m))) m = NULL; sa = (struct sockaddr_un *)(m->m_dat); } else |