revert removal of warning and K&R support
Requested by: bde
This commit is contained in:
parent
c264b07418
commit
e9370a2e59
@ -103,7 +103,7 @@ static char mybuf[50];
|
||||
return mybuf;
|
||||
}
|
||||
|
||||
static char *
|
||||
char *
|
||||
at_pr_port(struct sockaddr_at *sat)
|
||||
{
|
||||
static char mybuf[50];
|
||||
@ -155,7 +155,8 @@ static char mybuf[50];
|
||||
/* 4 for port */
|
||||
/* 8 for numeric only */
|
||||
char *
|
||||
atalk_print(struct sockaddr *sa, int what)
|
||||
atalk_print(sa,what)
|
||||
register struct sockaddr *sa;
|
||||
{
|
||||
struct sockaddr_at *sat = (struct sockaddr_at *)sa;
|
||||
static char mybuf[50];
|
||||
@ -212,7 +213,9 @@ atalk_print2(struct sockaddr *sa, struct sockaddr *mask, int what)
|
||||
}
|
||||
|
||||
void
|
||||
atalkprotopr(u_long off __unused, char *name, int af __unused)
|
||||
atalkprotopr(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct ddpcb *this, *next;
|
||||
|
||||
@ -261,7 +264,9 @@ atalkprotopr(u_long off __unused, char *name, int af __unused)
|
||||
* Dump DDP statistics structure.
|
||||
*/
|
||||
void
|
||||
ddp_stats(u_long off __unused, char *name, int af __unused)
|
||||
ddp_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct ddpstat ddpstat;
|
||||
|
||||
|
@ -85,9 +85,8 @@ static char ntop_buf[INET6_ADDRSTRLEN]; /* for inet_ntop() */
|
||||
static int bdg_done;
|
||||
#endif
|
||||
|
||||
/* print bridge statistics */
|
||||
void
|
||||
bdg_stats(u_long dummy __unused, char *name, int af __unused)
|
||||
bdg_stats(u_long dummy, char *name) /* print bridge statistics */
|
||||
{
|
||||
int i;
|
||||
size_t slen ;
|
||||
@ -132,8 +131,12 @@ bdg_stats(u_long dummy __unused, char *name, int af __unused)
|
||||
/*
|
||||
* Display a formatted value, or a '-' in the same space.
|
||||
*/
|
||||
static void
|
||||
show_stat(const char *fmt, int width, u_long value, short showvalue)
|
||||
void
|
||||
show_stat(fmt, width, value, showvalue)
|
||||
char *fmt;
|
||||
int width;
|
||||
u_long value;
|
||||
short showvalue;
|
||||
{
|
||||
char newfmt[32];
|
||||
|
||||
@ -153,7 +156,10 @@ show_stat(const char *fmt, int width, u_long value, short showvalue)
|
||||
* Print a description of the network interfaces.
|
||||
*/
|
||||
void
|
||||
intpr(int interval, u_long ifnetaddr, void (*pfunc)(char *))
|
||||
intpr(interval, ifnetaddr, pfunc)
|
||||
int interval;
|
||||
u_long ifnetaddr;
|
||||
void (*pfunc)(char *);
|
||||
{
|
||||
struct ifnet ifnet;
|
||||
struct ifnethead ifnethead;
|
||||
@ -508,7 +514,9 @@ u_char signalled; /* set if alarm goes off "early" */
|
||||
* XXX - should be rewritten to use ifmib(4).
|
||||
*/
|
||||
static void
|
||||
sidewaysintpr(unsigned interval, u_long off)
|
||||
sidewaysintpr(interval, off)
|
||||
unsigned interval;
|
||||
u_long off;
|
||||
{
|
||||
struct ifnet ifnet;
|
||||
u_long firstifnet;
|
||||
@ -671,7 +679,8 @@ loop:
|
||||
* Sets a flag to not wait for the alarm.
|
||||
*/
|
||||
static void
|
||||
catchalarm(int signo __unused)
|
||||
catchalarm(signo)
|
||||
int signo;
|
||||
{
|
||||
signalled = YES;
|
||||
}
|
||||
|
@ -94,8 +94,10 @@ static int udp_done, tcp_done;
|
||||
* -a (all) flag is specified.
|
||||
*/
|
||||
void
|
||||
protopr(u_long proto, /* for sysctl version we pass proto # */
|
||||
char *name, int af)
|
||||
protopr(proto, name, af)
|
||||
u_long proto; /* for sysctl version we pass proto # */
|
||||
char *name;
|
||||
int af;
|
||||
{
|
||||
int istcp;
|
||||
static int first = 1;
|
||||
@ -165,7 +167,7 @@ protopr(u_long proto, /* for sysctl version we pass proto # */
|
||||
}
|
||||
|
||||
/* Ignore sockets for protocols other than the desired one. */
|
||||
if (so->xso_protocol != (int)proto)
|
||||
if (so->xso_protocol != proto)
|
||||
continue;
|
||||
|
||||
/* Ignore PCBs which were freed during copyout. */
|
||||
@ -346,7 +348,9 @@ protopr(u_long proto, /* for sysctl version we pass proto # */
|
||||
* Dump TCP statistics structure.
|
||||
*/
|
||||
void
|
||||
tcp_stats(u_long off __unused, char *name, int af __unused)
|
||||
tcp_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct tcpstat tcpstat;
|
||||
size_t len = sizeof tcpstat;
|
||||
@ -444,7 +448,9 @@ tcp_stats(u_long off __unused, char *name, int af __unused)
|
||||
* Dump UDP statistics structure.
|
||||
*/
|
||||
void
|
||||
udp_stats(u_long off __unused, char *name, int af __unused)
|
||||
udp_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct udpstat udpstat;
|
||||
size_t len = sizeof udpstat;
|
||||
@ -495,7 +501,9 @@ udp_stats(u_long off __unused, char *name, int af __unused)
|
||||
* Dump IP statistics structure.
|
||||
*/
|
||||
void
|
||||
ip_stats(u_long off __unused, char *name, int af __unused)
|
||||
ip_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct ipstat ipstat;
|
||||
size_t len = sizeof ipstat;
|
||||
@ -575,7 +583,9 @@ static char *icmpnames[] = {
|
||||
* Dump ICMP statistics.
|
||||
*/
|
||||
void
|
||||
icmp_stats(u_long off __unused, char *name, int af __unused)
|
||||
icmp_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct icmpstat icmpstat;
|
||||
int i, first;
|
||||
@ -641,7 +651,9 @@ icmp_stats(u_long off __unused, char *name, int af __unused)
|
||||
* Dump IGMP statistics structure.
|
||||
*/
|
||||
void
|
||||
igmp_stats(u_long off __unused, char *name, int af __unused)
|
||||
igmp_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct igmpstat igmpstat;
|
||||
size_t len = sizeof igmpstat;
|
||||
@ -674,7 +686,11 @@ igmp_stats(u_long off __unused, char *name, int af __unused)
|
||||
* Pretty print an Internet address (net address + port).
|
||||
*/
|
||||
void
|
||||
inetprint(struct in_addr *in, int port, char *proto, int numeric_port)
|
||||
inetprint(in, port, proto, numeric_port)
|
||||
register struct in_addr *in;
|
||||
int port;
|
||||
char *proto;
|
||||
int numeric_port;
|
||||
{
|
||||
struct servent *sp = 0;
|
||||
char line[80], *cp;
|
||||
@ -704,7 +720,8 @@ inetprint(struct in_addr *in, int port, char *proto, int numeric_port)
|
||||
* numeric value, otherwise try for symbolic name.
|
||||
*/
|
||||
char *
|
||||
inetname(struct in_addr *inp)
|
||||
inetname(inp)
|
||||
struct in_addr *inp;
|
||||
{
|
||||
register char *cp;
|
||||
static char line[MAXHOSTNAMELEN];
|
||||
|
@ -340,7 +340,9 @@ static char *ip6nh[] = {
|
||||
* Dump IP6 statistics structure.
|
||||
*/
|
||||
void
|
||||
ip6_stats(u_long off __unused, char *name, int af __unused)
|
||||
ip6_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct ip6stat ip6stat;
|
||||
int first, i;
|
||||
@ -492,7 +494,8 @@ ip6_stats(u_long off __unused, char *name, int af __unused)
|
||||
* Dump IPv6 per-interface statistics based on RFC 2465.
|
||||
*/
|
||||
void
|
||||
ip6_ifstats(char *ifname)
|
||||
ip6_ifstats(ifname)
|
||||
char *ifname;
|
||||
{
|
||||
struct in6_ifreq ifr;
|
||||
int s;
|
||||
@ -807,7 +810,9 @@ static char *icmp6names[] = {
|
||||
* Dump ICMP6 statistics.
|
||||
*/
|
||||
void
|
||||
icmp6_stats(u_long off __unused, char *name, int af __unused)
|
||||
icmp6_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct icmp6stat icmp6stat;
|
||||
register int i, first;
|
||||
@ -880,7 +885,8 @@ icmp6_stats(u_long off __unused, char *name, int af __unused)
|
||||
* Dump ICMPv6 per-interface statistics based on RFC 2466.
|
||||
*/
|
||||
void
|
||||
icmp6_ifstats(char *ifname)
|
||||
icmp6_ifstats(ifname)
|
||||
char *ifname;
|
||||
{
|
||||
struct in6_ifreq ifr;
|
||||
int s;
|
||||
@ -945,7 +951,9 @@ icmp6_ifstats(char *ifname)
|
||||
* Dump PIM statistics structure.
|
||||
*/
|
||||
void
|
||||
pim6_stats(u_long off __unused, char *name, int af __unused)
|
||||
pim6_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct pim6stat pim6stat;
|
||||
|
||||
@ -970,7 +978,9 @@ pim6_stats(u_long off __unused, char *name, int af __unused)
|
||||
* Dump raw ip6 statistics structure.
|
||||
*/
|
||||
void
|
||||
rip6_stats(u_long off __unused, char *name, int af __unused)
|
||||
rip6_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct rip6stat rip6stat;
|
||||
u_quad_t delivered;
|
||||
@ -1025,7 +1035,11 @@ rip6_stats(u_long off __unused, char *name, int af __unused)
|
||||
};
|
||||
|
||||
void
|
||||
inet6print(struct in6_addr *in6, int port, char *proto, int numeric)
|
||||
inet6print(in6, port, proto, numeric)
|
||||
register struct in6_addr *in6;
|
||||
int port;
|
||||
char *proto;
|
||||
int numeric;
|
||||
{
|
||||
struct servent *sp = 0;
|
||||
char line[80], *cp;
|
||||
@ -1051,7 +1065,8 @@ inet6print(struct in6_addr *in6, int port, char *proto, int numeric)
|
||||
*/
|
||||
|
||||
char *
|
||||
inet6name(struct in6_addr *in6p)
|
||||
inet6name(in6p)
|
||||
struct in6_addr *in6p;
|
||||
{
|
||||
register char *cp;
|
||||
static char line[50];
|
||||
|
@ -162,16 +162,18 @@ static struct ipsecstat ipsecstat;
|
||||
static void print_ipsecstats __P((void));
|
||||
static const char *pfkey_msgtype_names __P((int));
|
||||
static void ipsec_hist __P((const u_quad_t *, size_t, const struct val2str *,
|
||||
const char *));
|
||||
size_t, const char *));
|
||||
|
||||
/*
|
||||
* Dump IPSEC statistics structure.
|
||||
*/
|
||||
static void
|
||||
ipsec_hist(const u_quad_t *hist,
|
||||
size_t histmax,
|
||||
const struct val2str *name,
|
||||
const char *title)
|
||||
ipsec_hist(hist, histmax, name, namemax, title)
|
||||
const u_quad_t *hist;
|
||||
size_t histmax;
|
||||
const struct val2str *name;
|
||||
size_t namemax;
|
||||
const char *title;
|
||||
{
|
||||
int first;
|
||||
size_t proto;
|
||||
@ -186,7 +188,7 @@ ipsec_hist(const u_quad_t *hist,
|
||||
first = 0;
|
||||
}
|
||||
for (p = name; p && p->str; p++) {
|
||||
if (p->val == (int)proto)
|
||||
if (p->val == proto)
|
||||
break;
|
||||
}
|
||||
if (p && p->str) {
|
||||
@ -199,12 +201,12 @@ ipsec_hist(const u_quad_t *hist,
|
||||
}
|
||||
|
||||
static void
|
||||
print_ipsecstats(void)
|
||||
print_ipsecstats()
|
||||
{
|
||||
#define p(f, m) if (ipsecstat.f || sflag <= 1) \
|
||||
printf(m, (CAST)ipsecstat.f, plural(ipsecstat.f))
|
||||
#define hist(f, n, t) \
|
||||
ipsec_hist((f), sizeof(f)/sizeof(f[0]), (n), (t));
|
||||
ipsec_hist((f), sizeof(f)/sizeof(f[0]), (n), sizeof(n)/sizeof(n[0]), (t));
|
||||
|
||||
p(in_success, "\t" LLU " inbound packet%s processed successfully\n");
|
||||
p(in_polvio, "\t" LLU " inbound packet%s violated process security "
|
||||
@ -236,7 +238,9 @@ print_ipsecstats(void)
|
||||
}
|
||||
|
||||
void
|
||||
ipsec_stats(u_long off __unused, char *name, int af __unused)
|
||||
ipsec_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
if (off == 0)
|
||||
return;
|
||||
@ -247,7 +251,8 @@ ipsec_stats(u_long off __unused, char *name, int af __unused)
|
||||
}
|
||||
|
||||
static const char *
|
||||
pfkey_msgtype_names(int x)
|
||||
pfkey_msgtype_names(x)
|
||||
int x;
|
||||
{
|
||||
const int max =
|
||||
sizeof(pfkey_msgtypenames)/sizeof(pfkey_msgtypenames[0]);
|
||||
@ -260,10 +265,12 @@ pfkey_msgtype_names(int x)
|
||||
}
|
||||
|
||||
void
|
||||
pfkey_stats(u_long off __unused, char *name, int af __unused)
|
||||
pfkey_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct pfkeystat pfkeystat;
|
||||
unsigned first, type;
|
||||
int first, type;
|
||||
|
||||
if (off == 0)
|
||||
return;
|
||||
|
@ -83,7 +83,9 @@ static int first = 1;
|
||||
*/
|
||||
|
||||
void
|
||||
ipxprotopr(u_long off, char *name, int af __unused)
|
||||
ipxprotopr(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct ipxpcb cb;
|
||||
register struct ipxpcb *prev, *next;
|
||||
@ -159,7 +161,9 @@ ipxprotopr(u_long off, char *name, int af __unused)
|
||||
* Dump SPX statistics structure.
|
||||
*/
|
||||
void
|
||||
spx_stats(u_long off, char *name, int af __unused)
|
||||
spx_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct spx_istat spx_istat;
|
||||
#define spxstat spx_istat.newstats
|
||||
@ -235,7 +239,9 @@ spx_stats(u_long off, char *name, int af __unused)
|
||||
* Dump IPX statistics structure.
|
||||
*/
|
||||
void
|
||||
ipx_stats(u_long off, char *name, int af __unused)
|
||||
ipx_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct ipxstat ipxstat;
|
||||
|
||||
@ -278,7 +284,9 @@ static struct {
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
ipxerr_stats(u_long off, char *name, int af __unused)
|
||||
ipxerr_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct ipx_errstat ipx_errstat;
|
||||
register int j;
|
||||
@ -318,7 +326,8 @@ ipxerr_stats(u_long off, char *name, int af __unused)
|
||||
}
|
||||
|
||||
static void
|
||||
ipx_erputil(int z, int c)
|
||||
ipx_erputil(z, c)
|
||||
int z, c;
|
||||
{
|
||||
int j;
|
||||
char codebuf[30];
|
||||
@ -346,7 +355,8 @@ ipx_erputil(int z, int c)
|
||||
static struct sockaddr_ipx ssipx = {AF_IPX};
|
||||
|
||||
static
|
||||
char *ipx_prpr(struct ipx_addr *x)
|
||||
char *ipx_prpr(x)
|
||||
struct ipx_addr *x;
|
||||
{
|
||||
struct sockaddr_ipx *sipx = &ssipx;
|
||||
|
||||
|
@ -115,7 +115,9 @@ extern void inetprint __P((struct in_addr *, int, char *));
|
||||
* Dump esis stats
|
||||
*/
|
||||
void
|
||||
esis_stats(u_long off, char *name, int af __unused)
|
||||
esis_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct esis_stat esis_stat;
|
||||
|
||||
@ -142,7 +144,9 @@ esis_stats(u_long off, char *name, int af __unused)
|
||||
* Dump clnp statistics structure.
|
||||
*/
|
||||
void
|
||||
clnp_stats(u_long off, char *name, int af __unused)
|
||||
clnp_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct clnp_stat clnp_stat;
|
||||
|
||||
@ -175,7 +179,9 @@ clnp_stats(u_long off, char *name, int af __unused)
|
||||
* Dump CLTP statistics structure.
|
||||
*/
|
||||
void
|
||||
cltp_stats(u_long off, char *name, int af __unused)
|
||||
cltp_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct cltpstat cltpstat;
|
||||
|
||||
@ -209,7 +215,9 @@ static int first = 1;
|
||||
* -a (all) flag is specified.
|
||||
*/
|
||||
void
|
||||
iso_protopr(u_long off, char *name, int af __unused)
|
||||
iso_protopr(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct isopcb cb;
|
||||
register struct isopcb *prev, *next;
|
||||
@ -244,7 +252,9 @@ iso_protopr(u_long off, char *name, int af __unused)
|
||||
}
|
||||
|
||||
void
|
||||
iso_protopr1(u_long kern_addr, int istp)
|
||||
iso_protopr1(kern_addr, istp)
|
||||
u_long kern_addr;
|
||||
int istp;
|
||||
{
|
||||
if (first) {
|
||||
printf("Active ISO net connections");
|
||||
@ -293,7 +303,9 @@ iso_protopr1(u_long kern_addr, int istp)
|
||||
}
|
||||
|
||||
void
|
||||
tp_protopr(u_long off, char *name, int af __unused)
|
||||
tp_protopr(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
extern char *tp_sstring[];
|
||||
struct tp_ref *tpr, *tpr_base;
|
||||
@ -337,7 +349,8 @@ tp_protopr(u_long off, char *name, int af __unused)
|
||||
}
|
||||
|
||||
void
|
||||
tp_inproto(u_long pcb)
|
||||
tp_inproto(pcb)
|
||||
u_long pcb;
|
||||
{
|
||||
struct inpcb inpcb;
|
||||
kget(tpcb.tp_npcb, inpcb);
|
||||
@ -359,7 +372,8 @@ tp_inproto(u_long pcb)
|
||||
|
||||
#ifdef notdef
|
||||
char *
|
||||
isonetname(struct iso_addr *iso)
|
||||
isonetname(iso)
|
||||
register struct iso_addr *iso;
|
||||
{
|
||||
struct sockaddr_iso sa;
|
||||
struct iso_hostent *ihe = 0;
|
||||
@ -390,7 +404,11 @@ isonetname(struct iso_addr *iso)
|
||||
}
|
||||
|
||||
static void
|
||||
isonetprint(struct iso_addr *iso, char *sufx, u_short sufxlen, int islocal)
|
||||
isonetprint(iso, sufx, sufxlen, islocal)
|
||||
register struct iso_addr *iso;
|
||||
char *sufx;
|
||||
u_short sufxlen;
|
||||
int islocal;
|
||||
{
|
||||
struct iso_hostent *iso_getserventrybytsel(), *ihe;
|
||||
struct iso_hostent Ihe;
|
||||
@ -444,7 +462,9 @@ isonetprint(struct iso_addr *iso, char *sufx, u_short sufxlen, int islocal)
|
||||
|
||||
#ifdef notdef
|
||||
static void
|
||||
x25_protopr(u_long off, char *name, int af __unused)
|
||||
x25_protopr(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
static char *xpcb_states[] = {
|
||||
"CLOSED",
|
||||
@ -513,7 +533,8 @@ x25_protopr(u_long off, char *name, int af __unused)
|
||||
struct tp_stat tp_stat;
|
||||
|
||||
void
|
||||
tp_stats(caddr_t off, caddr_t name)
|
||||
tp_stats(off, name)
|
||||
caddr_t off, name;
|
||||
{
|
||||
if (off == 0) {
|
||||
printf("TP not configured\n\n");
|
||||
@ -527,7 +548,9 @@ tp_stats(caddr_t off, caddr_t name)
|
||||
#define OUT stdout
|
||||
|
||||
static void
|
||||
tprintstat(struct tp_stat *s, int indent)
|
||||
tprintstat(s, indent)
|
||||
register struct tp_stat *s;
|
||||
int indent;
|
||||
{
|
||||
fprintf(OUT,
|
||||
"%*sReceiving:\n",indent," ");
|
||||
@ -777,7 +800,9 @@ tprintstat(struct tp_stat *s, int indent)
|
||||
#endif
|
||||
|
||||
static void
|
||||
isonetprint(struct sockaddr_iso *siso, int islocal)
|
||||
isonetprint(siso, islocal)
|
||||
register struct sockaddr_iso *siso;
|
||||
int islocal;
|
||||
{
|
||||
hexprint(siso->siso_nlen, siso->siso_addr.isoa_genaddr, "{}");
|
||||
if (siso->siso_tlen || siso->siso_slen || siso->siso_plen)
|
||||
@ -792,7 +817,9 @@ isonetprint(struct sockaddr_iso *siso, int islocal)
|
||||
static char hexlist[] = "0123456789abcdef", obuf[128];
|
||||
|
||||
static void
|
||||
hexprint(int n, char *buf, char *delim)
|
||||
hexprint(n, buf, delim)
|
||||
int n;
|
||||
char *buf, *delim;
|
||||
{
|
||||
register u_char *in = (u_char *)buf, *top = in + n;
|
||||
register char *out = obuf;
|
||||
|
@ -160,11 +160,9 @@ struct protox {
|
||||
u_char pr_index; /* index into nlist of cb head */
|
||||
u_char pr_sindex; /* index into nlist of stat block */
|
||||
u_char pr_wanted; /* 1 if wanted, 0 otherwise */
|
||||
void (*pr_cblocks)(u_long, char *, int);
|
||||
/* control blocks printing routine */
|
||||
void (*pr_stats)(u_long, char *, int);
|
||||
/* statistics printing routine */
|
||||
void (*pr_istats)(char *); /* per/if statistics printing routine */
|
||||
void (*pr_cblocks)(); /* control blocks printing routine */
|
||||
void (*pr_stats)(); /* statistics printing routine */
|
||||
void (*pr_istats)(); /* per/if statistics printing routine */
|
||||
char *pr_name; /* well-known name */
|
||||
int pr_usesysctl; /* true if we use sysctl, not kvm */
|
||||
} protox[] = {
|
||||
@ -491,6 +489,25 @@ main(argc, argv)
|
||||
mbpr(0, 0, 0, 0);
|
||||
exit(0);
|
||||
}
|
||||
if (pflag) {
|
||||
if (iflag && tp->pr_istats) {
|
||||
kread(0, 0, 0);
|
||||
intpr(interval, nl[N_IFNET].n_value, tp->pr_istats);
|
||||
exit(0);
|
||||
}
|
||||
if (!tp->pr_stats) {
|
||||
printf("%s: no stats routine\n", tp->pr_name);
|
||||
exit(0);
|
||||
}
|
||||
if (tp->pr_usesysctl) {
|
||||
(*tp->pr_stats)(tp->pr_usesysctl, tp->pr_name);
|
||||
} else {
|
||||
kread(0, 0, 0);
|
||||
(*tp->pr_stats)(nl[tp->pr_sindex].n_value,
|
||||
tp->pr_name);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
#if 0
|
||||
/*
|
||||
* Keep file descriptors open to avoid overhead
|
||||
@ -594,7 +611,7 @@ printproto(tp, name)
|
||||
register struct protox *tp;
|
||||
char *name;
|
||||
{
|
||||
void (*pr)(u_long, char *, int);
|
||||
void (*pr)();
|
||||
u_long off;
|
||||
|
||||
if (sflag) {
|
||||
@ -636,7 +653,10 @@ printproto(tp, name)
|
||||
* Read kernel memory, return 0 on success.
|
||||
*/
|
||||
int
|
||||
kread(u_long addr, char *buf, int size)
|
||||
kread(addr, buf, size)
|
||||
u_long addr;
|
||||
char *buf;
|
||||
int size;
|
||||
{
|
||||
if (kvmd == 0) {
|
||||
/*
|
||||
@ -673,13 +693,15 @@ kread(u_long addr, char *buf, int size)
|
||||
}
|
||||
|
||||
char *
|
||||
plural(int n)
|
||||
plural(n)
|
||||
int n;
|
||||
{
|
||||
return (n != 1 ? "s" : "");
|
||||
}
|
||||
|
||||
char *
|
||||
plurales(int n)
|
||||
plurales(n)
|
||||
int n;
|
||||
{
|
||||
return (n != 1 ? "es" : "");
|
||||
}
|
||||
@ -688,7 +710,8 @@ plurales(int n)
|
||||
* Find the protox for the given "well-known" name.
|
||||
*/
|
||||
static struct protox *
|
||||
knownname(char *name)
|
||||
knownname(name)
|
||||
char *name;
|
||||
{
|
||||
struct protox **tpp, *tp;
|
||||
|
||||
@ -703,7 +726,8 @@ knownname(char *name)
|
||||
* Find the protox corresponding to name.
|
||||
*/
|
||||
static struct protox *
|
||||
name2protox(char *name)
|
||||
name2protox(name)
|
||||
char *name;
|
||||
{
|
||||
struct protox *tp;
|
||||
char **alias; /* alias from p->aliases */
|
||||
@ -730,7 +754,7 @@ name2protox(char *name)
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
|
||||
"usage: netstat [-AaLlnW] [-f address_family] [-M core] [-N system]",
|
||||
|
@ -94,7 +94,8 @@ static struct mbtypenames {
|
||||
* Print mbuf statistics.
|
||||
*/
|
||||
void
|
||||
mbpr(u_long mbaddr, u_long mbtaddr, u_long nmbcaddr, u_long nmbufaddr)
|
||||
mbpr(mbaddr, mbtaddr, nmbcaddr, nmbufaddr)
|
||||
u_long mbaddr, mbtaddr, nmbcaddr, nmbufaddr;
|
||||
{
|
||||
u_long totmem, totpossible, totmbufs;
|
||||
register int i;
|
||||
|
@ -67,7 +67,8 @@ static const char rcsid[] =
|
||||
#include "netstat.h"
|
||||
|
||||
void
|
||||
mroutepr(u_long mfcaddr, u_long vifaddr)
|
||||
mroutepr(mfcaddr, vifaddr)
|
||||
u_long mfcaddr, vifaddr;
|
||||
{
|
||||
struct mfc *mfctable[MFCTBLSIZ];
|
||||
struct vif viftable[MAXVIFS];
|
||||
@ -149,7 +150,8 @@ mroutepr(u_long mfcaddr, u_long vifaddr)
|
||||
|
||||
|
||||
void
|
||||
mrt_stats(u_long mstaddr)
|
||||
mrt_stats(mstaddr)
|
||||
u_long mstaddr;
|
||||
{
|
||||
struct mrtstat mrtstat;
|
||||
|
||||
|
@ -94,7 +94,8 @@
|
||||
extern char *routename6 __P((struct sockaddr_in6 *));
|
||||
|
||||
void
|
||||
mroute6pr(u_long mfcaddr, u_long mifaddr)
|
||||
mroute6pr(mfcaddr, mifaddr)
|
||||
u_long mfcaddr, mifaddr;
|
||||
{
|
||||
struct mf6c *mf6ctable[MF6CTBLSIZ], *mfcp;
|
||||
struct mif6 mif6table[MAXMIFS];
|
||||
@ -195,7 +196,8 @@ mroute6pr(u_long mfcaddr, u_long mifaddr)
|
||||
}
|
||||
|
||||
void
|
||||
mrt6_stats(u_long mstaddr)
|
||||
mrt6_stats(mstaddr)
|
||||
u_long mstaddr;
|
||||
{
|
||||
struct mrt6stat mrtstat;
|
||||
|
||||
|
@ -65,7 +65,7 @@ static int first = 1;
|
||||
static int csock = -1;
|
||||
|
||||
void
|
||||
netgraphprotopr(u_long off, char *name, int af __unused)
|
||||
netgraphprotopr(u_long off, char *name)
|
||||
{
|
||||
struct ngpcb *this, *next;
|
||||
struct ngpcb ngpcb;
|
||||
|
@ -64,22 +64,22 @@ char *plural __P((int));
|
||||
char *plurales __P((int));
|
||||
|
||||
void protopr __P((u_long, char *, int));
|
||||
void tcp_stats __P((u_long, char *, int));
|
||||
void udp_stats __P((u_long, char *, int));
|
||||
void ip_stats __P((u_long, char *, int));
|
||||
void icmp_stats __P((u_long, char *, int));
|
||||
void igmp_stats __P((u_long, char *, int));
|
||||
void tcp_stats __P((u_long, char *));
|
||||
void udp_stats __P((u_long, char *));
|
||||
void ip_stats __P((u_long, char *));
|
||||
void icmp_stats __P((u_long, char *));
|
||||
void igmp_stats __P((u_long, char *));
|
||||
#ifdef IPSEC
|
||||
void ipsec_stats __P((u_long, char *, int));
|
||||
void ipsec_stats __P((u_long, char *));
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
void ip6_stats __P((u_long, char *, int));
|
||||
void ip6_stats __P((u_long, char *));
|
||||
void ip6_ifstats __P((char *));
|
||||
void icmp6_stats __P((u_long, char *, int));
|
||||
void icmp6_stats __P((u_long, char *));
|
||||
void icmp6_ifstats __P((char *));
|
||||
void pim6_stats __P((u_long, char *, int));
|
||||
void rip6_stats __P((u_long, char *, int));
|
||||
void pim6_stats __P((u_long, char *));
|
||||
void rip6_stats __P((u_long, char *));
|
||||
void mroute6pr __P((u_long, u_long));
|
||||
void mrt6_stats __P((u_long));
|
||||
|
||||
@ -90,10 +90,10 @@ char *netname6 __P((struct sockaddr_in6 *, struct in6_addr *));
|
||||
#endif /*INET6*/
|
||||
|
||||
#ifdef IPSEC
|
||||
void pfkey_stats __P((u_long, char *, int));
|
||||
void pfkey_stats __P((u_long, char *));
|
||||
#endif
|
||||
|
||||
void bdg_stats __P((u_long, char *, int));
|
||||
void bdg_stats __P((u_long, char *));
|
||||
|
||||
void mbpr __P((u_long, u_long, u_long, u_long));
|
||||
|
||||
@ -118,29 +118,29 @@ char *ipx_print __P((struct sockaddr *));
|
||||
char *ns_print __P((struct sockaddr *));
|
||||
void routepr __P((u_long));
|
||||
|
||||
void ipxprotopr __P((u_long, char *, int));
|
||||
void spx_stats __P((u_long, char *, int));
|
||||
void ipx_stats __P((u_long, char *, int));
|
||||
void ipxerr_stats __P((u_long, char *, int));
|
||||
void ipxprotopr __P((u_long, char *));
|
||||
void spx_stats __P((u_long, char *));
|
||||
void ipx_stats __P((u_long, char *));
|
||||
void ipxerr_stats __P((u_long, char *));
|
||||
|
||||
void nsprotopr __P((u_long, char *, int));
|
||||
void spp_stats __P((u_long, char *, int));
|
||||
void idp_stats __P((u_long, char *, int));
|
||||
void nserr_stats __P((u_long, char *, int));
|
||||
void nsprotopr __P((u_long, char *));
|
||||
void spp_stats __P((u_long, char *));
|
||||
void idp_stats __P((u_long, char *));
|
||||
void nserr_stats __P((u_long, char *));
|
||||
|
||||
void atalkprotopr __P((u_long, char *, int));
|
||||
void ddp_stats __P((u_long, char *, int));
|
||||
void atalkprotopr __P((u_long, char *));
|
||||
void ddp_stats __P((u_long, char *));
|
||||
|
||||
void netgraphprotopr __P((u_long, char *, int));
|
||||
void netgraphprotopr __P((u_long, char *));
|
||||
|
||||
void unixpr __P((void));
|
||||
|
||||
void esis_stats __P((u_long, char *, int));
|
||||
void clnp_stats __P((u_long, char *, int));
|
||||
void cltp_stats __P((u_long, char *, int));
|
||||
void iso_protopr __P((u_long, char *, int));
|
||||
void esis_stats __P((u_long, char *));
|
||||
void clnp_stats __P((u_long, char *));
|
||||
void cltp_stats __P((u_long, char *));
|
||||
void iso_protopr __P((u_long, char *));
|
||||
void iso_protopr1 __P((u_long, int));
|
||||
void tp_protopr __P((u_long, char *, int));
|
||||
void tp_protopr __P((u_long, char *));
|
||||
void tp_inproto __P((u_long));
|
||||
void tp_stats __P((caddr_t, caddr_t));
|
||||
|
||||
|
@ -85,7 +85,9 @@ static int first = 1;
|
||||
*/
|
||||
|
||||
void
|
||||
nsprotopr(u_long off, char *name, int af __unused)
|
||||
nsprotopr(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct nspcb cb;
|
||||
register struct nspcb *prev, *next;
|
||||
@ -158,7 +160,9 @@ nsprotopr(u_long off, char *name, int af __unused)
|
||||
* Dump SPP statistics structure.
|
||||
*/
|
||||
void
|
||||
spp_stats(u_long off, char *name, int af __unused)
|
||||
spp_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct spp_istat spp_istat;
|
||||
#define sppstat spp_istat.newstats
|
||||
@ -234,7 +238,9 @@ spp_stats(u_long off, char *name, int af __unused)
|
||||
* Dump IDP statistics structure.
|
||||
*/
|
||||
void
|
||||
idp_stats(u_long off, char *name, int af __unused)
|
||||
idp_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct idpstat idpstat;
|
||||
|
||||
@ -268,7 +274,9 @@ static struct {
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
nserr_stats(u_long off, char *name, int af __unused)
|
||||
nserr_stats(off, name)
|
||||
u_long off;
|
||||
char *name;
|
||||
{
|
||||
struct ns_errstat ns_errstat;
|
||||
register int j;
|
||||
@ -309,7 +317,8 @@ nserr_stats(u_long off, char *name, int af __unused)
|
||||
}
|
||||
|
||||
static void
|
||||
ns_erputil(int z, int c)
|
||||
ns_erputil(z, c)
|
||||
int z, c;
|
||||
{
|
||||
int j;
|
||||
char codebuf[30];
|
||||
@ -336,7 +345,8 @@ ns_erputil(int z, int c)
|
||||
static struct sockaddr_ns ssns = {AF_NS};
|
||||
|
||||
static
|
||||
char *ns_prpr(struct ns_addr *x)
|
||||
char *ns_prpr(x)
|
||||
struct ns_addr *x;
|
||||
{
|
||||
struct sockaddr_ns *sns = &ssns;
|
||||
|
||||
|
@ -144,7 +144,8 @@ char *netname6 __P((struct sockaddr_in6 *, struct in6_addr *));
|
||||
* Print routing tables.
|
||||
*/
|
||||
void
|
||||
routepr(u_long rtree)
|
||||
routepr(rtree)
|
||||
u_long rtree;
|
||||
{
|
||||
struct radix_node_head *rnh, head;
|
||||
int i;
|
||||
@ -183,7 +184,8 @@ routepr(u_long rtree)
|
||||
* Print address family header before a section of the routing table.
|
||||
*/
|
||||
void
|
||||
pr_family(int af)
|
||||
pr_family(af)
|
||||
int af;
|
||||
{
|
||||
char *afname;
|
||||
|
||||
@ -243,7 +245,8 @@ pr_family(int af)
|
||||
* Print header for routing table columns.
|
||||
*/
|
||||
void
|
||||
pr_rthdr(int af)
|
||||
pr_rthdr(af)
|
||||
int af;
|
||||
{
|
||||
|
||||
if (Aflag)
|
||||
@ -269,7 +272,8 @@ pr_rthdr(int af)
|
||||
}
|
||||
|
||||
static struct sockaddr *
|
||||
kgetsa(struct sockaddr *dst)
|
||||
kgetsa(dst)
|
||||
register struct sockaddr *dst;
|
||||
{
|
||||
|
||||
kget(dst, pt_u.u_sa);
|
||||
@ -279,7 +283,8 @@ kgetsa(struct sockaddr *dst)
|
||||
}
|
||||
|
||||
static void
|
||||
p_tree(struct radix_node *rn)
|
||||
p_tree(rn)
|
||||
struct radix_node *rn;
|
||||
{
|
||||
|
||||
again:
|
||||
@ -317,7 +322,7 @@ again:
|
||||
char nbuf[20];
|
||||
|
||||
static void
|
||||
p_rtnode(void)
|
||||
p_rtnode()
|
||||
{
|
||||
struct radix_mask *rm = rnode.rn_mklist;
|
||||
|
||||
@ -354,7 +359,7 @@ p_rtnode(void)
|
||||
}
|
||||
|
||||
static void
|
||||
ntreestuff(void)
|
||||
ntreestuff()
|
||||
{
|
||||
size_t needed;
|
||||
int mib[6];
|
||||
@ -385,7 +390,8 @@ ntreestuff(void)
|
||||
}
|
||||
|
||||
static void
|
||||
np_rtentry(struct rt_msghdr *rtm)
|
||||
np_rtentry(rtm)
|
||||
register struct rt_msghdr *rtm;
|
||||
{
|
||||
register struct sockaddr *sa = (struct sockaddr *)(rtm + 1);
|
||||
#ifdef notdef
|
||||
@ -424,7 +430,9 @@ np_rtentry(struct rt_msghdr *rtm)
|
||||
}
|
||||
|
||||
static void
|
||||
p_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags, int width)
|
||||
p_sockaddr(sa, mask, flags, width)
|
||||
struct sockaddr *sa, *mask;
|
||||
int flags, width;
|
||||
{
|
||||
char workbuf[128], *cplim;
|
||||
register char *cp = workbuf;
|
||||
@ -565,7 +573,9 @@ p_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags, int width)
|
||||
}
|
||||
|
||||
static void
|
||||
p_flags(int f, char *format)
|
||||
p_flags(f, format)
|
||||
register int f;
|
||||
char *format;
|
||||
{
|
||||
char name[33], *flags;
|
||||
register struct bits *p = bits;
|
||||
@ -578,7 +588,8 @@ p_flags(int f, char *format)
|
||||
}
|
||||
|
||||
static void
|
||||
p_rtentry(struct rtentry *rt)
|
||||
p_rtentry(rt)
|
||||
register struct rtentry *rt;
|
||||
{
|
||||
static struct ifnet ifnet, *lastif;
|
||||
struct rtentry parent;
|
||||
@ -645,7 +656,8 @@ ifandkey:;
|
||||
}
|
||||
|
||||
char *
|
||||
routename(u_long in)
|
||||
routename(in)
|
||||
u_long in;
|
||||
{
|
||||
register char *cp;
|
||||
static char line[MAXHOSTNAMELEN];
|
||||
@ -673,7 +685,8 @@ routename(u_long in)
|
||||
}
|
||||
|
||||
static u_long
|
||||
forgemask(u_long a)
|
||||
forgemask(a)
|
||||
u_long a;
|
||||
{
|
||||
u_long m;
|
||||
|
||||
@ -687,7 +700,9 @@ forgemask(u_long a)
|
||||
}
|
||||
|
||||
static void
|
||||
domask(char *dst, u_long addr, u_long mask)
|
||||
domask(dst, addr, mask)
|
||||
char *dst;
|
||||
u_long addr, mask;
|
||||
{
|
||||
register int b, i;
|
||||
|
||||
@ -719,7 +734,8 @@ domask(char *dst, u_long addr, u_long mask)
|
||||
* The address is assumed to be that of a net or subnet, not a host.
|
||||
*/
|
||||
char *
|
||||
netname(u_long in, u_long mask)
|
||||
netname(in, mask)
|
||||
u_long in, mask;
|
||||
{
|
||||
char *cp = 0;
|
||||
static char line[MAXHOSTNAMELEN];
|
||||
@ -775,7 +791,9 @@ netname(u_long in, u_long mask)
|
||||
|
||||
#ifdef INET6
|
||||
char *
|
||||
netname6(struct sockaddr_in6 *sa6, struct in6_addr *mask)
|
||||
netname6(sa6, mask)
|
||||
struct sockaddr_in6 *sa6;
|
||||
struct in6_addr *mask;
|
||||
{
|
||||
static char line[MAXHOSTNAMELEN];
|
||||
u_char *p = (u_char *)mask;
|
||||
@ -837,7 +855,8 @@ netname6(struct sockaddr_in6 *sa6, struct in6_addr *mask)
|
||||
}
|
||||
|
||||
char *
|
||||
routename6(struct sockaddr_in6 *sa6)
|
||||
routename6(sa6)
|
||||
struct sockaddr_in6 *sa6;
|
||||
{
|
||||
static char line[MAXHOSTNAMELEN];
|
||||
int flag = NI_WITHSCOPEID;
|
||||
@ -861,7 +880,8 @@ routename6(struct sockaddr_in6 *sa6)
|
||||
* Print routing statistics
|
||||
*/
|
||||
void
|
||||
rt_stats(u_long off)
|
||||
rt_stats(off)
|
||||
u_long off;
|
||||
{
|
||||
struct rtstat rtstat;
|
||||
|
||||
@ -884,7 +904,8 @@ rt_stats(u_long off)
|
||||
}
|
||||
|
||||
char *
|
||||
ipx_print(struct sockaddr *sa)
|
||||
ipx_print(sa)
|
||||
register struct sockaddr *sa;
|
||||
{
|
||||
u_short port;
|
||||
struct servent *sp = 0;
|
||||
@ -953,7 +974,8 @@ ipx_print(struct sockaddr *sa)
|
||||
}
|
||||
|
||||
char *
|
||||
ipx_phost(struct sockaddr *sa)
|
||||
ipx_phost(sa)
|
||||
struct sockaddr *sa;
|
||||
{
|
||||
register struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)sa;
|
||||
struct sockaddr_ipx work;
|
||||
@ -977,7 +999,8 @@ short ns_nullh[] = {0,0,0};
|
||||
short ns_bh[] = {-1,-1,-1};
|
||||
|
||||
char *
|
||||
ns_print(struct sockaddr *sa)
|
||||
ns_print(sa)
|
||||
register struct sockaddr *sa;
|
||||
{
|
||||
register struct sockaddr_ns *sns = (struct sockaddr_ns*)sa;
|
||||
struct ns_addr work;
|
||||
@ -1023,7 +1046,8 @@ ns_print(struct sockaddr *sa)
|
||||
}
|
||||
|
||||
char *
|
||||
ns_phost(struct sockaddr *sa)
|
||||
ns_phost(sa)
|
||||
struct sockaddr *sa;
|
||||
{
|
||||
register struct sockaddr_ns *sns = (struct sockaddr_ns *)sa;
|
||||
struct sockaddr_ns work;
|
||||
@ -1042,7 +1066,8 @@ ns_phost(struct sockaddr *sa)
|
||||
#endif
|
||||
|
||||
void
|
||||
upHex(char *p0)
|
||||
upHex(p0)
|
||||
char *p0;
|
||||
{
|
||||
register char *p = p0;
|
||||
|
||||
|
@ -68,7 +68,7 @@ static const char *const socktype[] =
|
||||
{ "#0", "stream", "dgram", "raw", "rdm", "seqpacket" };
|
||||
|
||||
void
|
||||
unixpr(void)
|
||||
unixpr()
|
||||
{
|
||||
char *buf;
|
||||
int type;
|
||||
@ -126,7 +126,9 @@ unixpr(void)
|
||||
}
|
||||
|
||||
static void
|
||||
unixdomainpr(struct xunpcb *xunp, struct xsocket *so)
|
||||
unixdomainpr(xunp, so)
|
||||
struct xunpcb *xunp;
|
||||
struct xsocket *so;
|
||||
{
|
||||
struct unpcb *unp;
|
||||
struct sockaddr_un *sa;
|
||||
|
Loading…
x
Reference in New Issue
Block a user