diff options
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r-- | usr.bin/netstat/Makefile | 1 | ||||
-rw-r--r-- | usr.bin/netstat/atalk.c | 1 | ||||
-rw-r--r-- | usr.bin/netstat/bpf.c | 1 | ||||
-rw-r--r-- | usr.bin/netstat/if.c | 39 | ||||
-rw-r--r-- | usr.bin/netstat/inet.c | 59 | ||||
-rw-r--r-- | usr.bin/netstat/inet6.c | 317 | ||||
-rw-r--r-- | usr.bin/netstat/ipsec.c | 53 | ||||
-rw-r--r-- | usr.bin/netstat/ipx.c | 1 | ||||
-rw-r--r-- | usr.bin/netstat/main.c | 8 | ||||
-rw-r--r-- | usr.bin/netstat/mbuf.c | 47 | ||||
-rw-r--r-- | usr.bin/netstat/mcast.c | 1 | ||||
-rw-r--r-- | usr.bin/netstat/mroute.c | 9 | ||||
-rw-r--r-- | usr.bin/netstat/mroute6.c | 37 | ||||
-rw-r--r-- | usr.bin/netstat/netgraph.c | 1 | ||||
-rw-r--r-- | usr.bin/netstat/netstat.h | 6 | ||||
-rw-r--r-- | usr.bin/netstat/pfkey.c | 45 | ||||
-rw-r--r-- | usr.bin/netstat/route.c | 1 | ||||
-rw-r--r-- | usr.bin/netstat/unix.c | 1 |
18 files changed, 321 insertions, 307 deletions
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile index 913acfa0364d..6168b6311f5e 100644 --- a/usr.bin/netstat/Makefile +++ b/usr.bin/netstat/Makefile @@ -8,7 +8,6 @@ SRCS= if.c inet.c main.c mbuf.c mcast.c mroute.c route.c \ unix.c atalk.c netgraph.c mroute6.c ipsec.c bpf.c pfkey.c WARNS?= 2 -NO_WERROR= CFLAGS+=-DIPSEC CFLAGS+=-DFAST_IPSEC diff --git a/usr.bin/netstat/atalk.c b/usr.bin/netstat/atalk.c index 517325c7a645..8353e1399d42 100644 --- a/usr.bin/netstat/atalk.c +++ b/usr.bin/netstat/atalk.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <nlist.h> #include <netdb.h> +#include <stdint.h> #include <stdio.h> #include <string.h> #include "netstat.h" diff --git a/usr.bin/netstat/bpf.c b/usr.bin/netstat/bpf.c index 1fdc5c32f14b..9546ac0fede6 100644 --- a/usr.bin/netstat/bpf.c +++ b/usr.bin/netstat/bpf.c @@ -39,6 +39,7 @@ #include <err.h> #include <errno.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index 1aeb6070d2a9..693978850667 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <libutil.h> #include <signal.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -101,26 +102,26 @@ pfsync_stats(u_long off __unused, const char *name, int af1 __unused) printf("%s:\n", name); #define p(f, m) if (pfsyncstat.f || sflag <= 1) \ - printf(m, (unsigned long long)pfsyncstat.f, plural(pfsyncstat.f)) + printf(m, (uintmax_t)pfsyncstat.f, plural(pfsyncstat.f)) #define p2(f, m) if (pfsyncstat.f || sflag <= 1) \ - printf(m, (unsigned long long)pfsyncstat.f) - - p(pfsyncs_ipackets, "\t%llu packet%s received (IPv4)\n"); - p(pfsyncs_ipackets6, "\t%llu packet%s received (IPv6)\n"); - p(pfsyncs_badif, "\t\t%llu packet%s discarded for bad interface\n"); - p(pfsyncs_badttl, "\t\t%llu packet%s discarded for bad ttl\n"); - p(pfsyncs_hdrops, "\t\t%llu packet%s shorter than header\n"); - p(pfsyncs_badver, "\t\t%llu packet%s discarded for bad version\n"); - p(pfsyncs_badauth, "\t\t%llu packet%s discarded for bad HMAC\n"); - p(pfsyncs_badact,"\t\t%llu packet%s discarded for bad action\n"); - p(pfsyncs_badlen, "\t\t%llu packet%s discarded for short packet\n"); - p(pfsyncs_badval, "\t\t%llu state%s discarded for bad values\n"); - p(pfsyncs_stale, "\t\t%llu stale state%s\n"); - p(pfsyncs_badstate, "\t\t%llu failed state lookup/insert%s\n"); - p(pfsyncs_opackets, "\t%llu packet%s sent (IPv4)\n"); - p(pfsyncs_opackets6, "\t%llu packet%s sent (IPv6)\n"); - p2(pfsyncs_onomem, "\t\t%llu send failed due to mbuf memory error\n"); - p2(pfsyncs_oerrors, "\t\t%llu send error\n"); + printf(m, (uintmax_t)pfsyncstat.f) + + p(pfsyncs_ipackets, "\t%ju packet%s received (IPv4)\n"); + p(pfsyncs_ipackets6, "\t%ju packet%s received (IPv6)\n"); + p(pfsyncs_badif, "\t\t%ju packet%s discarded for bad interface\n"); + p(pfsyncs_badttl, "\t\t%ju packet%s discarded for bad ttl\n"); + p(pfsyncs_hdrops, "\t\t%ju packet%s shorter than header\n"); + p(pfsyncs_badver, "\t\t%ju packet%s discarded for bad version\n"); + p(pfsyncs_badauth, "\t\t%ju packet%s discarded for bad HMAC\n"); + p(pfsyncs_badact,"\t\t%ju packet%s discarded for bad action\n"); + p(pfsyncs_badlen, "\t\t%ju packet%s discarded for short packet\n"); + p(pfsyncs_badval, "\t\t%ju state%s discarded for bad values\n"); + p(pfsyncs_stale, "\t\t%ju stale state%s\n"); + p(pfsyncs_badstate, "\t\t%ju failed state lookup/insert%s\n"); + p(pfsyncs_opackets, "\t%ju packet%s sent (IPv4)\n"); + p(pfsyncs_opackets6, "\t%ju packet%s sent (IPv6)\n"); + p2(pfsyncs_onomem, "\t\t%ju send failed due to mbuf memory error\n"); + p2(pfsyncs_oerrors, "\t\t%ju send error\n"); #undef p #undef p2 } diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 671010e68bdc..d1683860d986 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <libutil.h> #include <netdb.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -548,23 +549,23 @@ carp_stats(u_long off, const char *name, int af1 __unused) printf("%s:\n", name); #define p(f, m) if (carpstat.f || sflag <= 1) \ - printf(m, (unsigned long long)carpstat.f, plural((int)carpstat.f)) + printf(m, (uintmax_t)carpstat.f, plural(carpstat.f)) #define p2(f, m) if (carpstat.f || sflag <= 1) \ - printf(m, (unsigned long long)carpstat.f) - - p(carps_ipackets, "\t%llu packet%s received (IPv4)\n"); - p(carps_ipackets6, "\t%llu packet%s received (IPv6)\n"); - p(carps_badttl, "\t\t%llu packet%s discarded for wrong TTL\n"); - p(carps_hdrops, "\t\t%llu packet%s shorter than header\n"); - p(carps_badsum, "\t\t%llu discarded for bad checksum%s\n"); - p(carps_badver, "\t\t%llu discarded packet%s with a bad version\n"); - p2(carps_badlen, "\t\t%llu discarded because packet too short\n"); - p2(carps_badauth, "\t\t%llu discarded for bad authentication\n"); - p2(carps_badvhid, "\t\t%llu discarded for bad vhid\n"); - p2(carps_badaddrs, "\t\t%llu discarded because of a bad address list\n"); - p(carps_opackets, "\t%llu packet%s sent (IPv4)\n"); - p(carps_opackets6, "\t%llu packet%s sent (IPv6)\n"); - p2(carps_onomem, "\t\t%llu send failed due to mbuf memory error\n"); + printf(m, (uintmax_t)carpstat.f) + + p(carps_ipackets, "\t%ju packet%s received (IPv4)\n"); + p(carps_ipackets6, "\t%ju packet%s received (IPv6)\n"); + p(carps_badttl, "\t\t%ju packet%s discarded for wrong TTL\n"); + p(carps_hdrops, "\t\t%ju packet%s shorter than header\n"); + p(carps_badsum, "\t\t%ju discarded for bad checksum%s\n"); + p(carps_badver, "\t\t%ju discarded packet%s with a bad version\n"); + p2(carps_badlen, "\t\t%ju discarded because packet too short\n"); + p2(carps_badauth, "\t\t%ju discarded for bad authentication\n"); + p2(carps_badvhid, "\t\t%ju discarded for bad vhid\n"); + p2(carps_badaddrs, "\t\t%ju discarded because of a bad address list\n"); + p(carps_opackets, "\t%ju packet%s sent (IPv4)\n"); + p(carps_opackets6, "\t%ju packet%s sent (IPv6)\n"); + p2(carps_onomem, "\t\t%ju send failed due to mbuf memory error\n"); #if notyet p(carps_ostates, "\t\t%s state update%s sent\n"); #endif @@ -787,20 +788,20 @@ pim_stats(u_long off __unused, const char *name, int af1 __unused) printf("%s:\n", name); #define p(f, m) if (pimstat.f || sflag <= 1) \ - printf(m, pimstat.f, plural(pimstat.f)) + printf(m, (uintmax_t)pimstat.f, plural(pimstat.f)) #define py(f, m) if (pimstat.f || sflag <= 1) \ - printf(m, pimstat.f, pimstat.f != 1 ? "ies" : "y") - p(pims_rcv_total_msgs, "\t%llu message%s received\n"); - p(pims_rcv_total_bytes, "\t%llu byte%s received\n"); - p(pims_rcv_tooshort, "\t%llu message%s received with too few bytes\n"); - p(pims_rcv_badsum, "\t%llu message%s received with bad checksum\n"); - p(pims_rcv_badversion, "\t%llu message%s received with bad version\n"); - p(pims_rcv_registers_msgs, "\t%llu data register message%s received\n"); - p(pims_rcv_registers_bytes, "\t%llu data register byte%s received\n"); - p(pims_rcv_registers_wrongiif, "\t%llu data register message%s received on wrong iif\n"); - p(pims_rcv_badregisters, "\t%llu bad register%s received\n"); - p(pims_snd_registers_msgs, "\t%llu data register message%s sent\n"); - p(pims_snd_registers_bytes, "\t%llu data register byte%s sent\n"); + printf(m, (uintmax_t)pimstat.f, pimstat.f != 1 ? "ies" : "y") + p(pims_rcv_total_msgs, "\t%ju message%s received\n"); + p(pims_rcv_total_bytes, "\t%ju byte%s received\n"); + p(pims_rcv_tooshort, "\t%ju message%s received with too few bytes\n"); + p(pims_rcv_badsum, "\t%ju message%s received with bad checksum\n"); + p(pims_rcv_badversion, "\t%ju message%s received with bad version\n"); + p(pims_rcv_registers_msgs, "\t%ju data register message%s received\n"); + p(pims_rcv_registers_bytes, "\t%ju data register byte%s received\n"); + p(pims_rcv_registers_wrongiif, "\t%ju data register message%s received on wrong iif\n"); + p(pims_rcv_badregisters, "\t%ju bad register%s received\n"); + p(pims_snd_registers_msgs, "\t%ju data register message%s sent\n"); + p(pims_snd_registers_bytes, "\t%ju data register byte%s sent\n"); #undef p #undef py } diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c index 677d82d918f4..f6526979913c 100644 --- a/usr.bin/netstat/inet6.c +++ b/usr.bin/netstat/inet6.c @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include <arpa/inet.h> #include <netdb.h> +#include <stdint.h> #include <stdio.h> #include <errno.h> #include <string.h> @@ -75,7 +76,6 @@ __FBSDID("$FreeBSD$"); struct socket sockb; char *inet6name(struct in6_addr *); -const char *pluralies(int); static char ntop_buf[INET6_ADDRSTRLEN]; @@ -380,44 +380,44 @@ ip6_stats(u_long off __unused, const char *name, int af1 __unused) printf("%s:\n", name); #define p(f, m) if (ip6stat.f || sflag <= 1) \ - printf(m, (unsigned long long)ip6stat.f, plural(ip6stat.f)) + printf(m, (uintmax_t)ip6stat.f, plural(ip6stat.f)) #define p1a(f, m) if (ip6stat.f || sflag <= 1) \ - printf(m, (unsigned long long)ip6stat.f) + printf(m, (uintmax_t)ip6stat.f) - p(ip6s_total, "\t%llu total packet%s received\n"); - p1a(ip6s_toosmall, "\t%llu with size smaller than minimum\n"); - p1a(ip6s_tooshort, "\t%llu with data size < data length\n"); - p1a(ip6s_badoptions, "\t%llu with bad options\n"); - p1a(ip6s_badvers, "\t%llu with incorrect version number\n"); - p(ip6s_fragments, "\t%llu fragment%s received\n"); - p(ip6s_fragdropped, "\t%llu fragment%s dropped (dup or out of space)\n"); - p(ip6s_fragtimeout, "\t%llu fragment%s dropped after timeout\n"); - p(ip6s_fragoverflow, "\t%llu fragment%s that exceeded limit\n"); - p(ip6s_reassembled, "\t%llu packet%s reassembled ok\n"); - p(ip6s_delivered, "\t%llu packet%s for this host\n"); - p(ip6s_forward, "\t%llu packet%s forwarded\n"); - p(ip6s_cantforward, "\t%llu packet%s not forwardable\n"); - p(ip6s_redirectsent, "\t%llu redirect%s sent\n"); - p(ip6s_localout, "\t%llu packet%s sent from this host\n"); - p(ip6s_rawout, "\t%llu packet%s sent with fabricated ip header\n"); - p(ip6s_odropped, "\t%llu output packet%s dropped due to no bufs, etc.\n"); - p(ip6s_noroute, "\t%llu output packet%s discarded due to no route\n"); - p(ip6s_fragmented, "\t%llu output datagram%s fragmented\n"); - p(ip6s_ofragments, "\t%llu fragment%s created\n"); - p(ip6s_cantfrag, "\t%llu datagram%s that can't be fragmented\n"); - p(ip6s_badscope, "\t%llu packet%s that violated scope rules\n"); - p(ip6s_notmember, "\t%llu multicast packet%s which we don't join\n"); + p(ip6s_total, "\t%ju total packet%s received\n"); + p1a(ip6s_toosmall, "\t%ju with size smaller than minimum\n"); + p1a(ip6s_tooshort, "\t%ju with data size < data length\n"); + p1a(ip6s_badoptions, "\t%ju with bad options\n"); + p1a(ip6s_badvers, "\t%ju with incorrect version number\n"); + p(ip6s_fragments, "\t%ju fragment%s received\n"); + p(ip6s_fragdropped, "\t%ju fragment%s dropped (dup or out of space)\n"); + p(ip6s_fragtimeout, "\t%ju fragment%s dropped after timeout\n"); + p(ip6s_fragoverflow, "\t%ju fragment%s that exceeded limit\n"); + p(ip6s_reassembled, "\t%ju packet%s reassembled ok\n"); + p(ip6s_delivered, "\t%ju packet%s for this host\n"); + p(ip6s_forward, "\t%ju packet%s forwarded\n"); + p(ip6s_cantforward, "\t%ju packet%s not forwardable\n"); + p(ip6s_redirectsent, "\t%ju redirect%s sent\n"); + p(ip6s_localout, "\t%ju packet%s sent from this host\n"); + p(ip6s_rawout, "\t%ju packet%s sent with fabricated ip header\n"); + p(ip6s_odropped, "\t%ju output packet%s dropped due to no bufs, etc.\n"); + p(ip6s_noroute, "\t%ju output packet%s discarded due to no route\n"); + p(ip6s_fragmented, "\t%ju output datagram%s fragmented\n"); + p(ip6s_ofragments, "\t%ju fragment%s created\n"); + p(ip6s_cantfrag, "\t%ju datagram%s that can't be fragmented\n"); + p(ip6s_badscope, "\t%ju packet%s that violated scope rules\n"); + p(ip6s_notmember, "\t%ju multicast packet%s which we don't join\n"); for (first = 1, i = 0; i < 256; i++) if (ip6stat.ip6s_nxthist[i] != 0) { if (first) { printf("\tInput histogram:\n"); first = 0; } - printf("\t\t%s: %llu\n", ip6nh[i], - (unsigned long long)ip6stat.ip6s_nxthist[i]); + printf("\t\t%s: %ju\n", ip6nh[i], + (uintmax_t)ip6stat.ip6s_nxthist[i]); } printf("\tMbuf statistics:\n"); - printf("\t\t%llu one mbuf\n", (unsigned long long)ip6stat.ip6s_m1); + printf("\t\t%ju one mbuf\n", (uintmax_t)ip6stat.ip6s_m1); for (first = 1, i = 0; i < 32; i++) { char ifbuf[IFNAMSIZ]; if (ip6stat.ip6s_m2m[i] != 0) { @@ -425,44 +425,44 @@ ip6_stats(u_long off __unused, const char *name, int af1 __unused) printf("\t\ttwo or more mbuf:\n"); first = 0; } - printf("\t\t\t%s= %llu\n", + printf("\t\t\t%s= %ju\n", if_indextoname(i, ifbuf), - (unsigned long long)ip6stat.ip6s_m2m[i]); + (uintmax_t)ip6stat.ip6s_m2m[i]); } } - printf("\t\t%llu one ext mbuf\n", - (unsigned long long)ip6stat.ip6s_mext1); - printf("\t\t%llu two or more ext mbuf\n", - (unsigned long long)ip6stat.ip6s_mext2m); + printf("\t\t%ju one ext mbuf\n", + (uintmax_t)ip6stat.ip6s_mext1); + printf("\t\t%ju two or more ext mbuf\n", + (uintmax_t)ip6stat.ip6s_mext2m); p(ip6s_exthdrtoolong, - "\t%llu packet%s whose headers are not continuous\n"); - p(ip6s_nogif, "\t%llu tunneling packet%s that can't find gif\n"); + "\t%ju packet%s whose headers are not continuous\n"); + p(ip6s_nogif, "\t%ju tunneling packet%s that can't find gif\n"); p(ip6s_toomanyhdr, - "\t%llu packet%s discarded because of too many headers\n"); + "\t%ju packet%s discarded because of too many headers\n"); /* for debugging source address selection */ #define PRINT_SCOPESTAT(s,i) do {\ switch(i) { /* XXX hardcoding in each case */\ case 1:\ - p(s, "\t\t%llu node-local%s\n");\ + p(s, "\t\t%ju node-local%s\n");\ break;\ case 2:\ - p(s,"\t\t%llu link-local%s\n");\ + p(s,"\t\t%ju link-local%s\n");\ break;\ case 5:\ - p(s,"\t\t%llu site-local%s\n");\ + p(s,"\t\t%ju site-local%s\n");\ break;\ case 14:\ - p(s,"\t\t%llu global%s\n");\ + p(s,"\t\t%ju global%s\n");\ break;\ default:\ - printf("\t\t%llu addresses scope=%x\n",\ - (unsigned long long)ip6stat.s, i);\ + printf("\t\t%ju addresses scope=%x\n",\ + (uintmax_t)ip6stat.s, i);\ }\ } while (0); p(ip6s_sources_none, - "\t%llu failure%s of source address selection\n"); + "\t%ju failure%s of source address selection\n"); for (first = 1, i = 0; i < 16; i++) { if (ip6stat.ip6s_sources_sameif[i]) { if (first) { @@ -509,12 +509,13 @@ ip6_stats(u_long off __unused, const char *name, int af1 __unused) } } - p1a(ip6s_forward_cachehit, "\t%llu forward cache hit\n"); - p1a(ip6s_forward_cachemiss, "\t%llu forward cache miss\n"); + p1a(ip6s_forward_cachehit, "\t%ju forward cache hit\n"); + p1a(ip6s_forward_cachemiss, "\t%ju forward cache miss\n"); printf("\tSource addresses selection rule applied:\n"); for (i = 0; i < 16; i++) { if (ip6stat.ip6s_sources_rule[i]) - printf("\t\t%llu %s\n", ip6stat.ip6s_sources_rule[i], + printf("\t\t%ju %s\n", + (uintmax_t)ip6stat.ip6s_sources_rule[i], srcrule_str[i]); } #undef p @@ -530,9 +531,9 @@ ip6_ifstats(char *ifname) struct in6_ifreq ifr; int s; #define p(f, m) if (ifr.ifr_ifru.ifru_stat.f || sflag <= 1) \ - printf(m, (unsigned long long)ifr.ifr_ifru.ifru_stat.f, plural(ifr.ifr_ifru.ifru_stat.f)) + printf(m, (uintmax_t)ifr.ifr_ifru.ifru_stat.f, plural(ifr.ifr_ifru.ifru_stat.f)) #define p_5(f, m) if (ifr.ifr_ifru.ifru_stat.f || sflag <= 1) \ - printf(m, (unsigned long long)ip6stat.f) + printf(m, (uintmax_t)ip6stat.f) if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { perror("Warning: socket(AF_INET6)"); @@ -547,28 +548,28 @@ ip6_ifstats(char *ifname) goto end; } - p(ifs6_in_receive, "\t%llu total input datagram%s\n"); - p(ifs6_in_hdrerr, "\t%llu datagram%s with invalid header received\n"); - p(ifs6_in_toobig, "\t%llu datagram%s exceeded MTU received\n"); - p(ifs6_in_noroute, "\t%llu datagram%s with no route received\n"); - p(ifs6_in_addrerr, "\t%llu datagram%s with invalid dst received\n"); - p(ifs6_in_protounknown, "\t%llu datagram%s with unknown proto received\n"); - p(ifs6_in_truncated, "\t%llu truncated datagram%s received\n"); - p(ifs6_in_discard, "\t%llu input datagram%s discarded\n"); + p(ifs6_in_receive, "\t%ju total input datagram%s\n"); + p(ifs6_in_hdrerr, "\t%ju datagram%s with invalid header received\n"); + p(ifs6_in_toobig, "\t%ju datagram%s exceeded MTU received\n"); + p(ifs6_in_noroute, "\t%ju datagram%s with no route received\n"); + p(ifs6_in_addrerr, "\t%ju datagram%s with invalid dst received\n"); + p(ifs6_in_protounknown, "\t%ju datagram%s with unknown proto received\n"); + p(ifs6_in_truncated, "\t%ju truncated datagram%s received\n"); + p(ifs6_in_discard, "\t%ju input datagram%s discarded\n"); p(ifs6_in_deliver, - "\t%llu datagram%s delivered to an upper layer protocol\n"); - p(ifs6_out_forward, "\t%llu datagram%s forwarded to this interface\n"); + "\t%ju datagram%s delivered to an upper layer protocol\n"); + p(ifs6_out_forward, "\t%ju datagram%s forwarded to this interface\n"); p(ifs6_out_request, - "\t%llu datagram%s sent from an upper layer protocol\n"); - p(ifs6_out_discard, "\t%llu total discarded output datagram%s\n"); - p(ifs6_out_fragok, "\t%llu output datagram%s fragmented\n"); - p(ifs6_out_fragfail, "\t%llu output datagram%s failed on fragment\n"); - p(ifs6_out_fragcreat, "\t%llu output datagram%s succeeded on fragment\n"); - p(ifs6_reass_reqd, "\t%llu incoming datagram%s fragmented\n"); - p(ifs6_reass_ok, "\t%llu datagram%s reassembled\n"); - p(ifs6_reass_fail, "\t%llu datagram%s failed on reassembly\n"); - p(ifs6_in_mcast, "\t%llu multicast datagram%s received\n"); - p(ifs6_out_mcast, "\t%llu multicast datagram%s sent\n"); + "\t%ju datagram%s sent from an upper layer protocol\n"); + p(ifs6_out_discard, "\t%ju total discarded output datagram%s\n"); + p(ifs6_out_fragok, "\t%ju output datagram%s fragmented\n"); + p(ifs6_out_fragfail, "\t%ju output datagram%s failed on fragment\n"); + p(ifs6_out_fragcreat, "\t%ju output datagram%s succeeded on fragment\n"); + p(ifs6_reass_reqd, "\t%ju incoming datagram%s fragmented\n"); + p(ifs6_reass_ok, "\t%ju datagram%s reassembled\n"); + p(ifs6_reass_fail, "\t%ju datagram%s failed on reassembly\n"); + p(ifs6_in_mcast, "\t%ju multicast datagram%s received\n"); + p(ifs6_out_mcast, "\t%ju multicast datagram%s sent\n"); end: close(s); @@ -859,14 +860,14 @@ icmp6_stats(u_long off __unused, const char *name, int af1 __unused) printf("%s:\n", name); #define p(f, m) if (icmp6stat.f || sflag <= 1) \ - printf(m, (unsigned long long)icmp6stat.f, plural(icmp6stat.f)) -#define p_5(f, m) printf(m, (unsigned long long)icmp6stat.f) + printf(m, (uintmax_t)icmp6stat.f, plural(icmp6stat.f)) +#define p_5(f, m) printf(m, (uintmax_t)icmp6stat.f) - p(icp6s_error, "\t%llu call%s to icmp6_error\n"); + p(icp6s_error, "\t%ju call%s to icmp6_error\n"); p(icp6s_canterror, - "\t%llu error%s not generated in response to an icmp6 message\n"); + "\t%ju error%s not generated in response to an icmp6 message\n"); p(icp6s_toofreq, - "\t%llu error%s not generated because of rate limitation\n"); + "\t%ju error%s not generated because of rate limitation\n"); #define NELEM (int)(sizeof(icmp6stat.icp6s_outhist)/sizeof(icmp6stat.icp6s_outhist[0])) for (first = 1, i = 0; i < NELEM; i++) if (icmp6stat.icp6s_outhist[i] != 0) { @@ -874,14 +875,14 @@ icmp6_stats(u_long off __unused, const char *name, int af1 __unused) printf("\tOutput histogram:\n"); first = 0; } - printf("\t\t%s: %llu\n", icmp6names[i], - (unsigned long long)icmp6stat.icp6s_outhist[i]); + printf("\t\t%s: %ju\n", icmp6names[i], + (uintmax_t)icmp6stat.icp6s_outhist[i]); } #undef NELEM - p(icp6s_badcode, "\t%llu message%s with bad code fields\n"); - p(icp6s_tooshort, "\t%llu message%s < minimum length\n"); - p(icp6s_checksum, "\t%llu bad checksum%s\n"); - p(icp6s_badlen, "\t%llu message%s with bad length\n"); + p(icp6s_badcode, "\t%ju message%s with bad code fields\n"); + p(icp6s_tooshort, "\t%ju message%s < minimum length\n"); + p(icp6s_checksum, "\t%ju bad checksum%s\n"); + p(icp6s_badlen, "\t%ju message%s with bad length\n"); #define NELEM (int)(sizeof(icmp6stat.icp6s_inhist)/sizeof(icmp6stat.icp6s_inhist[0])) for (first = 1, i = 0; i < NELEM; i++) if (icmp6stat.icp6s_inhist[i] != 0) { @@ -889,34 +890,34 @@ icmp6_stats(u_long off __unused, const char *name, int af1 __unused) printf("\tInput histogram:\n"); first = 0; } - printf("\t\t%s: %llu\n", icmp6names[i], - (unsigned long long)icmp6stat.icp6s_inhist[i]); + printf("\t\t%s: %ju\n", icmp6names[i], + (uintmax_t)icmp6stat.icp6s_inhist[i]); } #undef NELEM printf("\tHistogram of error messages to be generated:\n"); - p_5(icp6s_odst_unreach_noroute, "\t\t%llu no route\n"); - p_5(icp6s_odst_unreach_admin, "\t\t%llu administratively prohibited\n"); - p_5(icp6s_odst_unreach_beyondscope, "\t\t%llu beyond scope\n"); - p_5(icp6s_odst_unreach_addr, "\t\t%llu address unreachable\n"); - p_5(icp6s_odst_unreach_noport, "\t\t%llu port unreachable\n"); - p_5(icp6s_opacket_too_big, "\t\t%llu packet too big\n"); - p_5(icp6s_otime_exceed_transit, "\t\t%llu time exceed transit\n"); - p_5(icp6s_otime_exceed_reassembly, "\t\t%llu time exceed reassembly\n"); - p_5(icp6s_oparamprob_header, "\t\t%llu erroneous header field\n"); - p_5(icp6s_oparamprob_nextheader, "\t\t%llu unrecognized next header\n"); - p_5(icp6s_oparamprob_option, "\t\t%llu unrecognized option\n"); - p_5(icp6s_oredirect, "\t\t%llu redirect\n"); - p_5(icp6s_ounknown, "\t\t%llu unknown\n"); + p_5(icp6s_odst_unreach_noroute, "\t\t%ju no route\n"); + p_5(icp6s_odst_unreach_admin, "\t\t%ju administratively prohibited\n"); + p_5(icp6s_odst_unreach_beyondscope, "\t\t%ju beyond scope\n"); + p_5(icp6s_odst_unreach_addr, "\t\t%ju address unreachable\n"); + p_5(icp6s_odst_unreach_noport, "\t\t%ju port unreachable\n"); + p_5(icp6s_opacket_too_big, "\t\t%ju packet too big\n"); + p_5(icp6s_otime_exceed_transit, "\t\t%ju time exceed transit\n"); + p_5(icp6s_otime_exceed_reassembly, "\t\t%ju time exceed reassembly\n"); + p_5(icp6s_oparamprob_header, "\t\t%ju erroneous header field\n"); + p_5(icp6s_oparamprob_nextheader, "\t\t%ju unrecognized next header\n"); + p_5(icp6s_oparamprob_option, "\t\t%ju unrecognized option\n"); + p_5(icp6s_oredirect, "\t\t%ju redirect\n"); + p_5(icp6s_ounknown, "\t\t%ju unknown\n"); - p(icp6s_reflect, "\t%llu message response%s generated\n"); - p(icp6s_nd_toomanyopt, "\t%llu message%s with too many ND options\n"); - p(icp6s_nd_badopt, "\t%llu message%s with bad ND options\n"); - p(icp6s_badns, "\t%llu bad neighbor solicitation message%s\n"); - p(icp6s_badna, "\t%llu bad neighbor advertisement message%s\n"); - p(icp6s_badrs, "\t%llu bad router solicitation message%s\n"); - p(icp6s_badra, "\t%llu bad router advertisement message%s\n"); - p(icp6s_badredirect, "\t%llu bad redirect message%s\n"); - p(icp6s_pmtuchg, "\t%llu path MTU change%s\n"); + p(icp6s_reflect, "\t%ju message response%s generated\n"); + p(icp6s_nd_toomanyopt, "\t%ju message%s with too many ND options\n"); + p(icp6s_nd_badopt, "\t%ju message%s with bad ND options\n"); + p(icp6s_badns, "\t%ju bad neighbor solicitation message%s\n"); + p(icp6s_badna, "\t%ju bad neighbor advertisement message%s\n"); + p(icp6s_badrs, "\t%ju bad router solicitation message%s\n"); + p(icp6s_badra, "\t%ju bad router advertisement message%s\n"); + p(icp6s_badredirect, "\t%ju bad redirect message%s\n"); + p(icp6s_pmtuchg, "\t%ju path MTU change%s\n"); #undef p #undef p_5 } @@ -930,9 +931,9 @@ icmp6_ifstats(char *ifname) struct in6_ifreq ifr; int s; #define p(f, m) if (ifr.ifr_ifru.ifru_icmp6stat.f || sflag <= 1) \ - printf(m, (unsigned long long)ifr.ifr_ifru.ifru_icmp6stat.f, plural(ifr.ifr_ifru.ifru_icmp6stat.f)) + printf(m, (uintmax_t)ifr.ifr_ifru.ifru_icmp6stat.f, plural(ifr.ifr_ifru.ifru_icmp6stat.f)) #define p2(f, m) if (ifr.ifr_ifru.ifru_icmp6stat.f || sflag <= 1) \ - printf(m, (unsigned long long)ifr.ifr_ifru.ifru_icmp6stat.f, pluralies(ifr.ifr_ifru.ifru_icmp6stat.f)) + printf(m, (uintmax_t)ifr.ifr_ifru.ifru_icmp6stat.f, pluralies(ifr.ifr_ifru.ifru_icmp6stat.f)) if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { perror("Warning: socket(AF_INET6)"); @@ -947,41 +948,41 @@ icmp6_ifstats(char *ifname) goto end; } - p(ifs6_in_msg, "\t%llu total input message%s\n"); - p(ifs6_in_error, "\t%llu total input error message%s\n"); - p(ifs6_in_dstunreach, "\t%llu input destination unreachable error%s\n"); - p(ifs6_in_adminprohib, "\t%llu input administratively prohibited error%s\n"); - p(ifs6_in_timeexceed, "\t%llu input time exceeded error%s\n"); - p(ifs6_in_paramprob, "\t%llu input parameter problem error%s\n"); - p(ifs6_in_pkttoobig, "\t%llu input packet too big error%s\n"); - p(ifs6_in_echo, "\t%llu input echo request%s\n"); - p2(ifs6_in_echoreply, "\t%llu input echo repl%s\n"); - p(ifs6_in_routersolicit, "\t%llu input router solicitation%s\n"); - p(ifs6_in_routeradvert, "\t%llu input router advertisement%s\n"); - p(ifs6_in_neighborsolicit, "\t%llu input neighbor solicitation%s\n"); - p(ifs6_in_neighboradvert, "\t%llu input neighbor advertisement%s\n"); - p(ifs6_in_redirect, "\t%llu input redirect%s\n"); - p2(ifs6_in_mldquery, "\t%llu input MLD quer%s\n"); - p(ifs6_in_mldreport, "\t%llu input MLD report%s\n"); - p(ifs6_in_mlddone, "\t%llu input MLD done%s\n"); + p(ifs6_in_msg, "\t%ju total input message%s\n"); + p(ifs6_in_error, "\t%ju total input error message%s\n"); + p(ifs6_in_dstunreach, "\t%ju input destination unreachable error%s\n"); + p(ifs6_in_adminprohib, "\t%ju input administratively prohibited error%s\n"); + p(ifs6_in_timeexceed, "\t%ju input time exceeded error%s\n"); + p(ifs6_in_paramprob, "\t%ju input parameter problem error%s\n"); + p(ifs6_in_pkttoobig, "\t%ju input packet too big error%s\n"); + p(ifs6_in_echo, "\t%ju input echo request%s\n"); + p2(ifs6_in_echoreply, "\t%ju input echo repl%s\n"); + p(ifs6_in_routersolicit, "\t%ju input router solicitation%s\n"); + p(ifs6_in_routeradvert, "\t%ju input router advertisement%s\n"); + p(ifs6_in_neighborsolicit, "\t%ju input neighbor solicitation%s\n"); + p(ifs6_in_neighboradvert, "\t%ju input neighbor advertisement%s\n"); + p(ifs6_in_redirect, "\t%ju input redirect%s\n"); + p2(ifs6_in_mldquery, "\t%ju input MLD quer%s\n"); + p(ifs6_in_mldreport, "\t%ju input MLD report%s\n"); + p(ifs6_in_mlddone, "\t%ju input MLD done%s\n"); - p(ifs6_out_msg, "\t%llu total output message%s\n"); - p(ifs6_out_error, "\t%llu total output error message%s\n"); - p(ifs6_out_dstunreach, "\t%llu output destination unreachable error%s\n"); - p(ifs6_out_adminprohib, "\t%llu output administratively prohibited error%s\n"); - p(ifs6_out_timeexceed, "\t%llu output time exceeded error%s\n"); - p(ifs6_out_paramprob, "\t%llu output parameter problem error%s\n"); - p(ifs6_out_pkttoobig, "\t%llu output packet too big error%s\n"); - p(ifs6_out_echo, "\t%llu output echo request%s\n"); - p2(ifs6_out_echoreply, "\t%llu output echo repl%s\n"); - p(ifs6_out_routersolicit, "\t%llu output router solicitation%s\n"); - p(ifs6_out_routeradvert, "\t%llu output router advertisement%s\n"); - p(ifs6_out_neighborsolicit, "\t%llu output neighbor solicitation%s\n"); - p(ifs6_out_neighboradvert, "\t%llu output neighbor advertisement%s\n"); - p(ifs6_out_redirect, "\t%llu output redirect%s\n"); - p2(ifs6_out_mldquery, "\t%llu output MLD quer%s\n"); - p(ifs6_out_mldreport, "\t%llu output MLD report%s\n"); - p(ifs6_out_mlddone, "\t%llu output MLD done%s\n"); + p(ifs6_out_msg, "\t%ju total output message%s\n"); + p(ifs6_out_error, "\t%ju total output error message%s\n"); + p(ifs6_out_dstunreach, "\t%ju output destination unreachable error%s\n"); + p(ifs6_out_adminprohib, "\t%ju output administratively prohibited error%s\n"); + p(ifs6_out_timeexceed, "\t%ju output time exceeded error%s\n"); + p(ifs6_out_paramprob, "\t%ju output parameter problem error%s\n"); + p(ifs6_out_pkttoobig, "\t%ju output packet too big error%s\n"); + p(ifs6_out_echo, "\t%ju output echo request%s\n"); + p2(ifs6_out_echoreply, "\t%ju output echo repl%s\n"); + p(ifs6_out_routersolicit, "\t%ju output router solicitation%s\n"); + p(ifs6_out_routeradvert, "\t%ju output router advertisement%s\n"); + p(ifs6_out_neighborsolicit, "\t%ju output neighbor solicitation%s\n"); + p(ifs6_out_neighboradvert, "\t%ju output neighbor advertisement%s\n"); + p(ifs6_out_redirect, "\t%ju output redirect%s\n"); + p2(ifs6_out_mldquery, "\t%ju output MLD quer%s\n"); + p(ifs6_out_mldreport, "\t%ju output MLD report%s\n"); + p(ifs6_out_mlddone, "\t%ju output MLD done%s\n"); end: close(s); @@ -1003,14 +1004,14 @@ pim6_stats(u_long off __unused, const char *name, int af1 __unused) printf("%s:\n", name); #define p(f, m) if (pim6stat.f || sflag <= 1) \ - printf(m, (unsigned long long)pim6stat.f, plural(pim6stat.f)) - p(pim6s_rcv_total, "\t%llu message%s received\n"); - p(pim6s_rcv_tooshort, "\t%llu message%s received with too few bytes\n"); - p(pim6s_rcv_badsum, "\t%llu message%s received with bad checksum\n"); - p(pim6s_rcv_badversion, "\t%llu message%s received with bad version\n"); - p(pim6s_rcv_registers, "\t%llu register%s received\n"); - p(pim6s_rcv_badregisters, "\t%llu bad register%s received\n"); - p(pim6s_snd_registers, "\t%llu register%s sent\n"); + printf(m, (uintmax_t)pim6stat.f, plural(pim6stat.f)) + p(pim6s_rcv_total, "\t%ju message%s received\n"); + p(pim6s_rcv_tooshort, "\t%ju message%s received with too few bytes\n"); + p(pim6s_rcv_badsum, "\t%ju message%s received with bad checksum\n"); + p(pim6s_rcv_badversion, "\t%ju message%s received with bad version\n"); + p(pim6s_rcv_registers, "\t%ju register%s received\n"); + p(pim6s_rcv_badregisters, "\t%ju bad register%s received\n"); + p(pim6s_snd_registers, "\t%ju register%s sent\n"); #undef p } @@ -1040,23 +1041,23 @@ rip6_stats(u_long off __unused, const char *name, int af1 __unused) printf("%s:\n", name); #define p(f, m) if (rip6stat.f || sflag <= 1) \ - printf(m, (unsigned long long)rip6stat.f, plural(rip6stat.f)) - p(rip6s_ipackets, "\t%llu message%s received\n"); - p(rip6s_isum, "\t%llu checksum calcuration%s on inbound\n"); - p(rip6s_badsum, "\t%llu message%s with bad checksum\n"); - p(rip6s_nosock, "\t%llu message%s dropped due to no socket\n"); + printf(m, (uintmax_t)rip6stat.f, plural(rip6stat.f)) + p(rip6s_ipackets, "\t%ju message%s received\n"); + p(rip6s_isum, "\t%ju checksum calcuration%s on inbound\n"); + p(rip6s_badsum, "\t%ju message%s with bad checksum\n"); + p(rip6s_nosock, "\t%ju message%s dropped due to no socket\n"); p(rip6s_nosockmcast, - "\t%llu multicast message%s dropped due to no socket\n"); + "\t%ju multicast message%s dropped due to no socket\n"); p(rip6s_fullsock, - "\t%llu message%s dropped due to full socket buffers\n"); + "\t%ju message%s dropped due to full socket buffers\n"); delivered = rip6stat.rip6s_ipackets - rip6stat.rip6s_badsum - rip6stat.rip6s_nosock - rip6stat.rip6s_nosockmcast - rip6stat.rip6s_fullsock; if (delivered || sflag <= 1) - printf("\t%llu delivered\n", (unsigned long long)delivered); - p(rip6s_opackets, "\t%llu datagram%s output\n"); + printf("\t%ju delivered\n", (uintmax_t)delivered); + p(rip6s_opackets, "\t%ju datagram%s output\n"); #undef p } diff --git a/usr.bin/netstat/ipsec.c b/usr.bin/netstat/ipsec.c index c7135c4192c7..63bdd52121a0 100644 --- a/usr.bin/netstat/ipsec.c +++ b/usr.bin/netstat/ipsec.c @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); #include <netipsec/ipcomp_var.h> #endif +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> @@ -204,10 +205,10 @@ ipsec_hist(const u_quad_t *hist, size_t histmax, const struct val2str *name, break; } if (p && p->str) { - printf("\t\t%s: %llu\n", p->str, (unsigned long long)hist[proto]); + printf("\t\t%s: %ju\n", p->str, (uintmax_t)hist[proto]); } else { - printf("\t\t#%ld: %llu\n", (long)proto, - (unsigned long long)hist[proto]); + printf("\t\t#%ld: %ju\n", (long)proto, + (uintmax_t)hist[proto]); } } } @@ -216,39 +217,39 @@ static void print_ipsecstats(const struct ipsecstat *ipsecstat) { #define p(f, m) if (ipsecstat->f || sflag <= 1) \ - printf(m, (unsigned long long)ipsecstat->f, plural(ipsecstat->f)) + printf(m, (uintmax_t)ipsecstat->f, plural(ipsecstat->f)) #define pes(f, m) if (ipsecstat->f || sflag <= 1) \ - printf(m, (unsigned long long)ipsecstat->f, plurales(ipsecstat->f)) + printf(m, (uintmax_t)ipsecstat->f, plurales(ipsecstat->f)) #define hist(f, n, t) \ ipsec_hist((f), sizeof(f)/sizeof(f[0]), (n), (t)); - p(in_success, "\t%llu inbound packet%s processed successfully\n"); - p(in_polvio, "\t%llu inbound packet%s violated process security " + p(in_success, "\t%ju inbound packet%s processed successfully\n"); + p(in_polvio, "\t%ju inbound packet%s violated process security " "policy\n"); - p(in_nosa, "\t%llu inbound packet%s with no SA available\n"); - p(in_inval, "\t%llu invalid inbound packet%s\n"); - p(in_nomem, "\t%llu inbound packet%s failed due to insufficient memory\n"); - p(in_badspi, "\t%llu inbound packet%s failed getting SPI\n"); - p(in_ahreplay, "\t%llu inbound packet%s failed on AH replay check\n"); - p(in_espreplay, "\t%llu inbound packet%s failed on ESP replay check\n"); - p(in_ahauthsucc, "\t%llu inbound packet%s considered authentic\n"); - p(in_ahauthfail, "\t%llu inbound packet%s failed on authentication\n"); + p(in_nosa, "\t%ju inbound packet%s with no SA available\n"); + p(in_inval, "\t%ju invalid inbound packet%s\n"); + p(in_nomem, "\t%ju inbound packet%s failed due to insufficient memory\n"); + p(in_badspi, "\t%ju inbound packet%s failed getting SPI\n"); + p(in_ahreplay, "\t%ju inbound packet%s failed on AH replay check\n"); + p(in_espreplay, "\t%ju inbound packet%s failed on ESP replay check\n"); + p(in_ahauthsucc, "\t%ju inbound packet%s considered authentic\n"); + p(in_ahauthfail, "\t%ju inbound packet%s failed on authentication\n"); hist(ipsecstat->in_ahhist, ipsec_ahnames, "AH input"); hist(ipsecstat->in_esphist, ipsec_espnames, "ESP input"); hist(ipsecstat->in_comphist, ipsec_compnames, "IPComp input"); - p(out_success, "\t%llu outbound packet%s processed successfully\n"); - p(out_polvio, "\t%llu outbound packet%s violated process security " + p(out_success, "\t%ju outbound packet%s processed successfully\n"); + p(out_polvio, "\t%ju outbound packet%s violated process security " "policy\n"); - p(out_nosa, "\t%llu outbound packet%s with no SA available\n"); - p(out_inval, "\t%llu invalid outbound packet%s\n"); - p(out_nomem, "\t%llu outbound packet%s failed due to insufficient memory\n"); - p(out_noroute, "\t%llu outbound packet%s with no route\n"); + p(out_nosa, "\t%ju outbound packet%s with no SA available\n"); + p(out_inval, "\t%ju invalid outbound packet%s\n"); + p(out_nomem, "\t%ju outbound packet%s failed due to insufficient memory\n"); + p(out_noroute, "\t%ju outbound packet%s with no route\n"); hist(ipsecstat->out_ahhist, ipsec_ahnames, "AH output"); hist(ipsecstat->out_esphist, ipsec_espnames, "ESP output"); hist(ipsecstat->out_comphist, ipsec_compnames, "IPComp output"); - p(spdcachelookup, "\t%llu SPD cache lookup%s\n"); - pes(spdcachemiss, "\t%llu SPD cache miss%s\n"); + p(spdcachelookup, "\t%ju SPD cache lookup%s\n"); + pes(spdcachemiss, "\t%ju SPD cache miss%s\n"); #undef p #undef pes #undef hist @@ -352,7 +353,7 @@ print_ahstats(const struct ahstat *ahstat) #define p32(f, m) if (ahstat->f || sflag <= 1) \ printf("\t%u" m, (unsigned int)ahstat->f, plural(ahstat->f)) #define p64(f, m) if (ahstat->f || sflag <= 1) \ - printf("\t%llu" m, (unsigned long long)ahstat->f, plural(ahstat->f)) + printf("\t%ju" m, (uintmax_t)ahstat->f, plural(ahstat->f)) #define hist(f, n, t) \ ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t)); @@ -401,7 +402,7 @@ print_espstats(const struct espstat *espstat) #define p32(f, m) if (espstat->f || sflag <= 1) \ printf("\t%u" m, (unsigned int)espstat->f, plural(espstat->f)) #define p64(f, m) if (espstat->f || sflag <= 1) \ - printf("\t%llu" m, (unsigned long long)espstat->f, plural(espstat->f)) + printf("\t%ju" m, (uintmax_t)espstat->f, plural(espstat->f)) #define hist(f, n, t) \ ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t)); @@ -451,7 +452,7 @@ print_ipcompstats(const struct ipcompstat *ipcompstat) #define p32(f, m) if (ipcompstat->f || sflag <= 1) \ printf("\t%u" m, (unsigned int)ipcompstat->f, plural(ipcompstat->f)) #define p64(f, m) if (ipcompstat->f || sflag <= 1) \ - printf("\t%llu" m, (unsigned long long)ipcompstat->f, plural(ipcompstat->f)) + printf("\t%ju" m, (uintmax_t)ipcompstat->f, plural(ipcompstat->f)) #define hist(f, n, t) \ ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t)); diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c index 04ba023ee399..8b71dbd8fbbd 100644 --- a/usr.bin/netstat/ipx.c +++ b/usr.bin/netstat/ipx.c @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include <nlist.h> #include <errno.h> +#include <stdint.h> #include <stdio.h> #include <string.h> #include "netstat.h" diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 9861d6e6a92c..a2cd7e2730a7 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include <netdb.h> #include <nlist.h> #include <paths.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -273,7 +274,6 @@ struct protox *protoprotox[] = { #endif atalkprotox, NULL }; -const char *pluralies(int); static void printproto(struct protox *, const char *); static void usage(void); static struct protox *name2protox(char *); @@ -657,19 +657,19 @@ kread(u_long addr, char *buf, int size) } const char * -plural(int n) +plural(uintmax_t n) { return (n != 1 ? "s" : ""); } const char * -plurales(int n) +plurales(uintmax_t n) { return (n != 1 ? "es" : ""); } const char * -pluralies(int n) +pluralies(uintmax_t n) { return (n != 1 ? "ies" : "y"); } diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c index bd8d626a7580..911fc1f7da27 100644 --- a/usr.bin/netstat/mbuf.c +++ b/usr.bin/netstat/mbuf.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include <err.h> #include <kvm.h> #include <memstat.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -64,18 +65,18 @@ mbpr(void *kvmd, u_long mbaddr) { struct memory_type_list *mtlp; struct memory_type *mtp; - u_int64_t mbuf_count, mbuf_bytes, mbuf_free, mbuf_failures, mbuf_size; - u_int64_t cluster_count, cluster_bytes, cluster_limit, cluster_free; - u_int64_t cluster_failures, cluster_size; - u_int64_t packet_count, packet_bytes, packet_free, packet_failures; - u_int64_t tag_count, tag_bytes; - u_int64_t jumbop_count, jumbop_bytes, jumbop_limit, jumbop_free; - u_int64_t jumbop_failures, jumbop_size; - u_int64_t jumbo9_count, jumbo9_bytes, jumbo9_limit, jumbo9_free; - u_int64_t jumbo9_failures, jumbo9_size; - u_int64_t jumbo16_count, jumbo16_bytes, jumbo16_limit, jumbo16_free; - u_int64_t jumbo16_failures, jumbo16_size; - u_int64_t bytes_inuse, bytes_incache, bytes_total; + uintmax_t mbuf_count, mbuf_bytes, mbuf_free, mbuf_failures, mbuf_size; + uintmax_t cluster_count, cluster_bytes, cluster_limit, cluster_free; + uintmax_t cluster_failures, cluster_size; + uintmax_t packet_count, packet_bytes, packet_free, packet_failures; + uintmax_t tag_count, tag_bytes; + uintmax_t jumbop_count, jumbop_bytes, jumbop_limit, jumbop_free; + uintmax_t jumbop_failures, jumbop_size; + uintmax_t jumbo9_count, jumbo9_bytes, jumbo9_limit, jumbo9_free; + uintmax_t jumbo9_failures, jumbo9_size; + uintmax_t jumbo16_count, jumbo16_bytes, jumbo16_limit, jumbo16_free; + uintmax_t jumbo16_failures, jumbo16_size; + uintmax_t bytes_inuse, bytes_incache, bytes_total; int nsfbufs, nsfbufspeak, nsfbufsused; struct mbstat mbstat; size_t mlen; @@ -194,36 +195,36 @@ mbpr(void *kvmd, u_long mbaddr) jumbo16_failures = memstat_get_failures(mtp); jumbo16_size = memstat_get_size(mtp); - printf("%llu/%llu/%llu mbufs in use (current/cache/total)\n", + printf("%ju/%ju/%ju mbufs in use (current/cache/total)\n", mbuf_count + packet_count, mbuf_free + packet_free, mbuf_count + packet_count + mbuf_free + packet_free); - printf("%llu/%llu/%llu/%llu mbuf clusters in use " + printf("%ju/%ju/%ju/%ju mbuf clusters in use " "(current/cache/total/max)\n", cluster_count - packet_free, cluster_free + packet_free, cluster_count + cluster_free, cluster_limit); - printf("%llu/%llu mbuf+clusters out of packet secondary zone in use " + printf("%ju/%ju mbuf+clusters out of packet secondary zone in use " "(current/cache)\n", packet_count, packet_free); - printf("%llu/%llu/%llu/%llu %lluk (page size) jumbo clusters in use " + printf("%ju/%ju/%ju/%ju %juk (page size) jumbo clusters in use " "(current/cache/total/max)\n", jumbop_count, jumbop_free, jumbop_count + jumbop_free, jumbop_limit, jumbop_size / 1024); - printf("%llu/%llu/%llu/%llu 9k jumbo clusters in use " + printf("%ju/%ju/%ju/%ju 9k jumbo clusters in use " "(current/cache/total/max)\n", jumbo9_count, jumbo9_free, jumbo9_count + jumbo9_free, jumbo9_limit); - printf("%llu/%llu/%llu/%llu 16k jumbo clusters in use " + printf("%ju/%ju/%ju/%ju 16k jumbo clusters in use " "(current/cache/total/max)\n", jumbo16_count, jumbo16_free, jumbo16_count + jumbo16_free, jumbo16_limit); #if 0 - printf("%llu mbuf tags in use\n", tag_count); + printf("%ju mbuf tags in use\n", tag_count); #endif /*- @@ -271,16 +272,16 @@ mbpr(void *kvmd, u_long mbaddr) */ bytes_total = bytes_inuse + bytes_incache; - printf("%lluK/%lluK/%lluK bytes allocated to network " + printf("%juK/%juK/%juK bytes allocated to network " "(current/cache/total)\n", bytes_inuse / 1024, bytes_incache / 1024, bytes_total / 1024); - printf("%llu/%llu/%llu requests for mbufs denied (mbufs/clusters/" + printf("%ju/%ju/%ju requests for mbufs denied (mbufs/clusters/" "mbuf+clusters)\n", mbuf_failures, cluster_failures, packet_failures); - printf("%llu/%llu/%llu requests for jumbo clusters denied " - "(%lluk/9k/16k)\n", jumbop_failures, jumbo9_failures, + printf("%ju/%ju/%ju requests for jumbo clusters denied " + "(%juk/9k/16k)\n", jumbop_failures, jumbo9_failures, jumbo16_failures, jumbop_size / 1024); if (live) { diff --git a/usr.bin/netstat/mcast.c b/usr.bin/netstat/mcast.c index 2b2a5cd1bb70..afd382a8bc13 100644 --- a/usr.bin/netstat/mcast.c +++ b/usr.bin/netstat/mcast.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include <stddef.h> #include <stdarg.h> #include <stdlib.h> +#include <stdint.h> #include <stdio.h> #include <string.h> diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c index 4b73005b20d7..6a60582bcbd6 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip_mroute.h> #include <err.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include "netstat.h" @@ -207,11 +208,11 @@ print_bw_meter(struct bw_meter *bw_meter, int *banner_printed) /* The measured values */ if (bw_meter->bm_flags & BW_METER_UNIT_PACKETS) - sprintf(s1, "%llu", bw_meter->bm_measured.b_packets); + sprintf(s1, "%ju", (uintmax_t)bw_meter->bm_measured.b_packets); else sprintf(s1, "?"); if (bw_meter->bm_flags & BW_METER_UNIT_BYTES) - sprintf(s2, "%llu", bw_meter->bm_measured.b_bytes); + sprintf(s2, "%ju", (uintmax_t)bw_meter->bm_measured.b_bytes); else sprintf(s2, "?"); sprintf(s0, "%lu.%lu|%s|%s", @@ -230,11 +231,11 @@ print_bw_meter(struct bw_meter *bw_meter, int *banner_printed) /* The threshold values */ if (bw_meter->bm_flags & BW_METER_UNIT_PACKETS) - sprintf(s1, "%llu", bw_meter->bm_threshold.b_packets); + sprintf(s1, "%ju", (uintmax_t)bw_meter->bm_threshold.b_packets); else sprintf(s1, "?"); if (bw_meter->bm_flags & BW_METER_UNIT_BYTES) - sprintf(s2, "%llu", bw_meter->bm_threshold.b_bytes); + sprintf(s2, "%ju", (uintmax_t)bw_meter->bm_threshold.b_bytes); else sprintf(s2, "?"); sprintf(s0, "%lu.%lu|%s|%s", diff --git a/usr.bin/netstat/mroute6.c b/usr.bin/netstat/mroute6.c index bc06a3d6c30d..e931243506e5 100644 --- a/usr.bin/netstat/mroute6.c +++ b/usr.bin/netstat/mroute6.c @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include <netinet/in.h> +#include <stdint.h> #include <stdio.h> #define KERNEL 1 @@ -140,8 +141,8 @@ mroute6pr(u_long mfcaddr, u_long mifaddr) printf(" %5s", (mifp->m6_flags & MIFF_REGISTER) ? "reg0" : if_indextoname(ifnet.if_index, ifname)); - printf(" %9llu %9llu\n", (unsigned long long)mifp->m6_pkt_in, - (unsigned long long)mifp->m6_pkt_out); + printf(" %9ju %9ju\n", (uintmax_t)mifp->m6_pkt_in, + (uintmax_t)mifp->m6_pkt_out); } if (!banner_printed) printf("\nIPv6 Multicast Interface Table is empty\n"); @@ -165,7 +166,7 @@ mroute6pr(u_long mfcaddr, u_long mifaddr) routename6(&mfc.mf6c_origin)); printf(" %-*.*s", WID_GRP, WID_GRP, routename6(&mfc.mf6c_mcastgrp)); - printf(" %9llu", (unsigned long long)mfc.mf6c_pkt_cnt); + printf(" %9ju", (uintmax_t)mfc.mf6c_pkt_cnt); for (waitings = 0, rtep = mfc.mf6c_stall; rtep; ) { waitings++; @@ -209,25 +210,25 @@ mrt6_stats(u_long mstaddr) printf("IPv6 multicast forwarding:\n"); #define p(f, m) if (mrtstat.f || sflag <= 1) \ - printf(m, (unsigned long long)mrtstat.f, plural(mrtstat.f)) + printf(m, (uintmax_t)mrtstat.f, plural(mrtstat.f)) #define p2(f, m) if (mrtstat.f || sflag <= 1) \ - printf(m, (unsigned long long)mrtstat.f, plurales(mrtstat.f)) + printf(m, (uintmax_t)mrtstat.f, plurales(mrtstat.f)) - p(mrt6s_mfc_lookups, "\t%llu multicast forwarding cache lookup%s\n"); - p2(mrt6s_mfc_misses, "\t%llu multicast forwarding cache miss%s\n"); - p(mrt6s_upcalls, "\t%llu upcall%s to mrouted\n"); - p(mrt6s_upq_ovflw, "\t%llu upcall queue overflow%s\n"); + p(mrt6s_mfc_lookups, "\t%ju multicast forwarding cache lookup%s\n"); + p2(mrt6s_mfc_misses, "\t%ju multicast forwarding cache miss%s\n"); + p(mrt6s_upcalls, "\t%ju upcall%s to mrouted\n"); + p(mrt6s_upq_ovflw, "\t%ju upcall queue overflow%s\n"); p(mrt6s_upq_sockfull, - "\t%llu upcall%s dropped due to full socket buffer\n"); - p(mrt6s_cache_cleanups, "\t%llu cache cleanup%s\n"); - p(mrt6s_no_route, "\t%llu datagram%s with no route for origin\n"); - p(mrt6s_bad_tunnel, "\t%llu datagram%s arrived with bad tunneling\n"); - p(mrt6s_cant_tunnel, "\t%llu datagram%s could not be tunneled\n"); - p(mrt6s_wrong_if, "\t%llu datagram%s arrived on wrong interface\n"); - p(mrt6s_drop_sel, "\t%llu datagram%s selectively dropped\n"); + "\t%ju upcall%s dropped due to full socket buffer\n"); + p(mrt6s_cache_cleanups, "\t%ju cache cleanup%s\n"); + p(mrt6s_no_route, "\t%ju datagram%s with no route for origin\n"); + p(mrt6s_bad_tunnel, "\t%ju datagram%s arrived with bad tunneling\n"); + p(mrt6s_cant_tunnel, "\t%ju datagram%s could not be tunneled\n"); + p(mrt6s_wrong_if, "\t%ju datagram%s arrived on wrong interface\n"); + p(mrt6s_drop_sel, "\t%ju datagram%s selectively dropped\n"); p(mrt6s_q_overflow, - "\t%llu datagram%s dropped due to queue overflow\n"); - p(mrt6s_pkt2large, "\t%llu datagram%s dropped for being too large\n"); + "\t%ju datagram%s dropped due to queue overflow\n"); + p(mrt6s_pkt2large, "\t%ju datagram%s dropped for being too large\n"); #undef p2 #undef p diff --git a/usr.bin/netstat/netgraph.c b/usr.bin/netstat/netgraph.c index e156989155c5..267df9d02be8 100644 --- a/usr.bin/netstat/netgraph.c +++ b/usr.bin/netstat/netgraph.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include <nlist.h> #include <errno.h> +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index 1eb6288be8fc..01ac8ddc181b 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -61,9 +61,9 @@ extern int unit; /* unit number for above */ extern int af; /* address family */ int kread(u_long addr, char *buf, int size); -const char *plural(int); -const char *plurales(int); -const char *pluralies(int); +const char *plural(uintmax_t); +const char *plurales(uintmax_t); +const char *pluralies(uintmax_t); void protopr(u_long, const char *, int); void tcp_stats(u_long, const char *, int); diff --git a/usr.bin/netstat/pfkey.c b/usr.bin/netstat/pfkey.c index 014e3019db29..377ff17d4cd7 100644 --- a/usr.bin/netstat/pfkey.c +++ b/usr.bin/netstat/pfkey.c @@ -87,6 +87,7 @@ static const char rcsid[] = #include <netipsec/keysock.h> #endif +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> @@ -130,11 +131,11 @@ pfkey_stats(u_long off, const char *name, int af __unused) kread(off, (char *)&pfkeystat, sizeof(pfkeystat)); #define p(f, m) if (pfkeystat.f || sflag <= 1) \ - printf(m, (unsigned long long)pfkeystat.f, plural(pfkeystat.f)) + printf(m, (uintmax_t)pfkeystat.f, plural(pfkeystat.f)) /* userland -> kernel */ - p(out_total, "\t%llu request%s sent from userland\n"); - p(out_bytes, "\t%llu byte%s sent from userland\n"); + p(out_total, "\t%ju request%s sent from userland\n"); + p(out_bytes, "\t%ju byte%s sent from userland\n"); for (first = 1, type = 0; type < sizeof(pfkeystat.out_msgtype)/sizeof(pfkeystat.out_msgtype[0]); type++) { @@ -144,22 +145,22 @@ pfkey_stats(u_long off, const char *name, int af __unused) printf("\thistogram by message type:\n"); first = 0; } - printf("\t\t%s: %llu\n", pfkey_msgtype_names(type), - (unsigned long long)pfkeystat.out_msgtype[type]); + printf("\t\t%s: %ju\n", pfkey_msgtype_names(type), + (uintmax_t)pfkeystat.out_msgtype[type]); } - p(out_invlen, "\t%llu message%s with invalid length field\n"); - p(out_invver, "\t%llu message%s with invalid version field\n"); - p(out_invmsgtype, "\t%llu message%s with invalid message type field\n"); - p(out_tooshort, "\t%llu message%s too short\n"); - p(out_nomem, "\t%llu message%s with memory allocation failure\n"); - p(out_dupext, "\t%llu message%s with duplicate extension\n"); - p(out_invexttype, "\t%llu message%s with invalid extension type\n"); - p(out_invsatype, "\t%llu message%s with invalid sa type\n"); - p(out_invaddr, "\t%llu message%s with invalid address extension\n"); + p(out_invlen, "\t%ju message%s with invalid length field\n"); + p(out_invver, "\t%ju message%s with invalid version field\n"); + p(out_invmsgtype, "\t%ju message%s with invalid message type field\n"); + p(out_tooshort, "\t%ju message%s too short\n"); + p(out_nomem, "\t%ju message%s with memory allocation failure\n"); + p(out_dupext, "\t%ju message%s with duplicate extension\n"); + p(out_invexttype, "\t%ju message%s with invalid extension type\n"); + p(out_invsatype, "\t%ju message%s with invalid sa type\n"); + p(out_invaddr, "\t%ju message%s with invalid address extension\n"); /* kernel -> userland */ - p(in_total, "\t%llu request%s sent to userland\n"); - p(in_bytes, "\t%llu byte%s sent to userland\n"); + p(in_total, "\t%ju request%s sent to userland\n"); + p(in_bytes, "\t%ju byte%s sent to userland\n"); for (first = 1, type = 0; type < sizeof(pfkeystat.in_msgtype)/sizeof(pfkeystat.in_msgtype[0]); type++) { @@ -169,16 +170,16 @@ pfkey_stats(u_long off, const char *name, int af __unused) printf("\thistogram by message type:\n"); first = 0; } - printf("\t\t%s: %llu\n", pfkey_msgtype_names(type), - (unsigned long long)pfkeystat.in_msgtype[type]); + printf("\t\t%s: %ju\n", pfkey_msgtype_names(type), + (uintmax_t)pfkeystat.in_msgtype[type]); } p(in_msgtarget[KEY_SENDUP_ONE], - "\t%llu message%s toward single socket\n"); + "\t%ju message%s toward single socket\n"); p(in_msgtarget[KEY_SENDUP_ALL], - "\t%llu message%s toward all sockets\n"); + "\t%ju message%s toward all sockets\n"); p(in_msgtarget[KEY_SENDUP_REGISTERED], - "\t%llu message%s toward registered sockets\n"); - p(in_nomem, "\t%llu message%s with memory allocation failure\n"); + "\t%ju message%s toward registered sockets\n"); + p(in_nomem, "\t%ju message%s with memory allocation failure\n"); #undef p } #endif /* IPSEC */ diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 3dc26d174e2f..415a7b66cd51 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include <arpa/inet.h> #include <libutil.h> #include <netdb.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c index d9256115382a..be70d5bacdc5 100644 --- a/usr.bin/netstat/unix.c +++ b/usr.bin/netstat/unix.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <err.h> #include <stddef.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <kvm.h> |