+ kread is not a boolean, so check it as such
+ fix $FreeBSD$ Ids
+ denote copyrights with /*-
+ misc whitespace changes.
This commit is contained in:
David E. O'Brien 2008-01-02 23:26:11 +00:00
parent 24ecb0cb15
commit 65475bc8e6
18 changed files with 250 additions and 255 deletions

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@ -260,7 +260,7 @@ atalkprotopr(u_long off __unused, const char *name, int af1 __unused,
}
}
#define ANY(x,y,z) if (x || sflag <= 1) \
#define ANY(x,y,z) if (x || sflag <= 1) \
printf("\t%lu %s%s%s\n",x,y,plural(x),z)
/*

View File

@ -22,9 +22,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/protosw.h>
#include <sys/socket.h>

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@ -105,9 +105,9 @@ pfsync_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("%s:\n", name);
#define p(f, m) if (pfsyncstat.f || sflag <= 1) \
#define p(f, m) if (pfsyncstat.f || sflag <= 1) \
printf(m, (uintmax_t)pfsyncstat.f, plural(pfsyncstat.f))
#define p2(f, m) if (pfsyncstat.f || sflag <= 1) \
#define p2(f, m) if (pfsyncstat.f || sflag <= 1) \
printf(m, (uintmax_t)pfsyncstat.f)
p(pfsyncs_ipackets, "\t%ju packet%s received (IPv4)\n");
@ -214,10 +214,10 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
sidewaysintpr(interval1, ifnetaddr);
return;
}
if (kread(ifnetaddr, (char *)&ifnethead, sizeof ifnethead))
if (kread(ifnetaddr, (char *)&ifnethead, sizeof ifnethead) != 0)
return;
ifnetaddr = (u_long)TAILQ_FIRST(&ifnethead);
if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet))
if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet) != 0)
return;
if (!pfunc) {
@ -253,11 +253,11 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
if (ifaddraddr == 0) {
ifnetfound = ifnetaddr;
if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet))
if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet) != 0)
return;
strlcpy(name, ifnet.if_xname, sizeof(name));
ifnetaddr = (u_long)TAILQ_NEXT(&ifnet, if_link);
if (interface != 0 && (strcmp(name, interface) != 0))
if (interface != 0 && strcmp(name, interface) != 0)
continue;
cp = index(name, '\0');
@ -298,11 +298,12 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
printf("%-13.13s ", "none");
printf("%-17.17s ", "none");
} else {
if (kread(ifaddraddr, (char *)&ifaddr, sizeof ifaddr)) {
if (kread(ifaddraddr, (char *)&ifaddr, sizeof ifaddr)
!= 0) {
ifaddraddr = 0;
continue;
}
#define CP(x) ((char *)(x))
#define CP(x) ((char *)(x))
cp = (CP(ifaddr.ifa.ifa_addr) - CP(ifaddraddr)) +
CP(&ifaddr);
sa = (struct sockaddr *)cp;
@ -455,11 +456,11 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
TAILQ_FOREACH(multiaddr, &ifnet.if_multiaddrs, ifma_link) {
if (kread((u_long)multiaddr, (char *)&ifma,
sizeof ifma))
sizeof ifma) != 0)
break;
multiaddr = &ifma;
if (kread((u_long)ifma.ifma_addr, (char *)&msa,
sizeof msa))
sizeof msa) != 0)
break;
if (msa.sa.sa_family != sa->sa_family)
continue;
@ -541,7 +542,7 @@ sidewaysintpr(int interval1, u_long off)
int oldmask, first;
u_long interesting_off;
if (kread(off, (char *)&ifnethead, sizeof ifnethead))
if (kread(off, (char *)&ifnethead, sizeof ifnethead) != 0)
return;
firstifnet = (u_long)TAILQ_FIRST(&ifnethead);
@ -556,7 +557,7 @@ sidewaysintpr(int interval1, u_long off)
for (off = firstifnet, ip = iftot; off;) {
char name[IFNAMSIZ];
if (kread(off, (char *)&ifnet, sizeof ifnet))
if (kread(off, (char *)&ifnet, sizeof ifnet) != 0)
break;
strlcpy(name, ifnet.if_xname, sizeof(name));
if (interface && strcmp(name, interface) == 0) {
@ -607,7 +608,7 @@ sidewaysintpr(int interval1, u_long off)
loop:
if (interesting != NULL) {
ip = interesting;
if (kread(interesting_off, (char *)&ifnet, sizeof ifnet)) {
if (kread(interesting_off, (char *)&ifnet, sizeof ifnet) != 0) {
printf("???\n");
exit(1);
};
@ -644,7 +645,7 @@ sidewaysintpr(int interval1, u_long off)
for (off = firstifnet, ip = iftot;
off && SLIST_NEXT(ip, chain) != NULL;
ip = SLIST_NEXT(ip, chain)) {
if (kread(off, (char *)&ifnet, sizeof ifnet)) {
if (kread(off, (char *)&ifnet, sizeof ifnet) != 0) {
off = 0;
continue;
}

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 1983, 1988, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/tcp.h>
#include <netinet/tcpip.h>
#include <netinet/tcp_seq.h>
#define TCPSTATES
#define TCPSTATES
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
@ -85,8 +85,8 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include "netstat.h"
char *inetname (struct in_addr *);
void inetprint (struct in_addr *, int, const char *, int);
char *inetname(struct in_addr *);
void inetprint(struct in_addr *, int, const char *, int);
#ifdef INET6
static int udp_done, tcp_done;
#endif /* INET6 */
@ -210,7 +210,7 @@ pcblist_kvm(u_long off, char **bufp, int istcp)
}
p = buf;
#define COPYOUT(obj, size) do { \
#define COPYOUT(obj, size) do { \
if (len < (size)) { \
warnx("buffer size exceeded"); \
goto fail; \
@ -220,7 +220,7 @@ pcblist_kvm(u_long off, char **bufp, int istcp)
p += (size); \
} while (0)
#define KREAD(off, buf, len) do { \
#define KREAD(off, buf, len) do { \
if (kread((uintptr_t)(off), (buf), (len)) != 0) \
goto fail; \
} while (0)
@ -750,9 +750,9 @@ carp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("%s:\n", name);
#define p(f, m) if (carpstat.f || sflag <= 1) \
#define p(f, m) if (carpstat.f || sflag <= 1) \
printf(m, (uintmax_t)carpstat.f, plural(carpstat.f))
#define p2(f, m) if (carpstat.f || sflag <= 1) \
#define p2(f, m) if (carpstat.f || sflag <= 1) \
printf(m, (uintmax_t)carpstat.f)
p(carps_ipackets, "\t%ju packet%s received (IPv4)\n");
@ -1116,7 +1116,7 @@ inetname(struct in_addr *inp)
line[sizeof(line) - 1] = '\0';
} else {
inp->s_addr = ntohl(inp->s_addr);
#define C(x) ((u_int)((x) & 0xff))
#define C(x) ((u_int)((x) & 0xff))
sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24),
C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr));
}

View File

@ -1,5 +1,5 @@
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
/*
/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@ -444,7 +444,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
"\t%ju packet%s discarded because of too many headers\n");
/* for debugging source address selection */
#define PRINT_SCOPESTAT(s,i) do {\
#define PRINT_SCOPESTAT(s,i) do {\
switch(i) { /* XXX hardcoding in each case */\
case 1:\
p(s, "\t\t%ju node-local%s\n");\
@ -866,14 +866,14 @@ icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
#define p(f, m) if (icmp6stat.f || sflag <= 1) \
printf(m, (uintmax_t)icmp6stat.f, plural(icmp6stat.f))
#define p_5(f, m) printf(m, (uintmax_t)icmp6stat.f)
#define p_5(f, m) printf(m, (uintmax_t)icmp6stat.f)
p(icp6s_error, "\t%ju call%s to icmp6_error\n");
p(icp6s_canterror,
"\t%ju error%s not generated in response to an icmp6 message\n");
p(icp6s_toofreq,
"\t%ju error%s not generated because of rate limitation\n");
#define NELEM (int)(sizeof(icmp6stat.icp6s_outhist)/sizeof(icmp6stat.icp6s_outhist[0]))
#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) {
if (first) {
@ -888,7 +888,7 @@ icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
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]))
#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) {
if (first) {
@ -1080,7 +1080,7 @@ rip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
* Pretty print an Internet address (net address + port).
* Take numeric_addr and numeric_port into consideration.
*/
#define GETSERVBYPORT6(port, proto, ret)\
#define GETSERVBYPORT6(port, proto, ret)\
{\
if (strcmp((proto), "tcp6") == 0)\
(ret) = getservbyport((int)(port), "tcp");\

View File

@ -1,7 +1,6 @@
/* $FreeBSD$ */
/* $KAME: ipsec.c,v 1.33 2003/07/25 09:54:32 itojun Exp $ */
/*
/*-
* Copyright (c) 2005 NTT Multimedia Communications Laboratories, Inc.
* All rights reserved.
*
@ -26,8 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
/*-
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved.
*
@ -55,8 +53,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@ -217,7 +214,7 @@ print_ipsecstats(const struct ipsecstat *ipsecstat)
printf(m, (uintmax_t)ipsecstat->f, plural(ipsecstat->f))
#define pes(f, m) if (ipsecstat->f || sflag <= 1) \
printf(m, (uintmax_t)ipsecstat->f, plurales(ipsecstat->f))
#define hist(f, n, t) \
#define hist(f, n, t) \
ipsec_hist((f), sizeof(f)/sizeof(f[0]), (n), (t));
p(in_success, "\t%ju inbound packet%s processed successfully\n");
@ -326,7 +323,7 @@ print_ahstats(const struct ahstat *ahstat)
printf("\t%u" m, (unsigned int)ahstat->f, plural(ahstat->f))
#define p64(f, m) if (ahstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)ahstat->f, plural(ahstat->f))
#define hist(f, n, t) \
#define hist(f, n, t) \
ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(ahs_hdrops, " packet%s shorter than header shows\n");
@ -375,7 +372,7 @@ print_espstats(const struct espstat *espstat)
printf("\t%u" m, (unsigned int)espstat->f, plural(espstat->f))
#define p64(f, m) if (espstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)espstat->f, plural(espstat->f))
#define hist(f, n, t) \
#define hist(f, n, t) \
ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(esps_hdrops, " packet%s shorter than header shows\n");
@ -425,7 +422,7 @@ print_ipcompstats(const struct ipcompstat *ipcompstat)
printf("\t%u" m, (unsigned int)ipcompstat->f, plural(ipcompstat->f))
#define p64(f, m) if (ipcompstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)ipcompstat->f, plural(ipcompstat->f))
#define hist(f, n, t) \
#define hist(f, n, t) \
ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(ipcomps_hdrops, " packet%s shorter than header shows\n");

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 2004, Robert N. M. Watson
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
#include <net/route.h>
#define TCPSTATES
#define TCPSTATES
#include <netinet/tcp_fsm.h>
#include <netipx/ipx.h>
@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
#include <netipx/spx.h>
#include <netipx/spx_timer.h>
#include <netipx/spx_var.h>
#define SANAMES
#define SANAMES
#include <netipx/spx_debug.h>
#include <nlist.h>
@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include "netstat.h"
static char *ipx_prpr (struct ipx_addr *);
static char *ipx_prpr(struct ipx_addr *);
/*
* Print a summary of connections related to a Network Systems
@ -145,9 +145,9 @@ ipxprotopr(u_long off, const char *name, int af1 __unused, int proto __unused)
}
}
#define ANY(x,y,z) \
#define ANY(x,y,z) \
if (x || sflag <= 1) printf("\t%u %s%s%s\n", x, y, plural(x), z)
#define ANYl(x,y,z) \
#define ANYl(x,y,z) \
if (x || sflag <= 1) printf("\t%lu %s%s%s\n", x, y, plural(x), z)
/*
@ -157,7 +157,7 @@ void
spx_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{
struct spx_istat spx_istat;
#define spxstat spx_istat.newstats
#define spxstat spx_istat.newstats
if (off == 0)
return;

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 1983, 1988, 1993
* Regents of the University of California. All rights reserved.
*
@ -76,51 +76,51 @@ static struct nlist nl[] = {
{ .n_name = "_ifnet" },
#define N_RTSTAT 1
{ .n_name = "_rtstat" },
#define N_RTREE 2
#define N_RTREE 2
{ .n_name = "_rt_tables"},
#define N_MRTSTAT 3
#define N_MRTSTAT 3
{ .n_name = "_mrtstat" },
#define N_MFCTABLE 4
#define N_MFCTABLE 4
{ .n_name = "_mfctable" },
#define N_VIFTABLE 5
#define N_VIFTABLE 5
{ .n_name = "_viftable" },
#define N_IPX 6
#define N_IPX 6
{ .n_name = "_ipxpcb_list"},
#define N_IPXSTAT 7
#define N_IPXSTAT 7
{ .n_name = "_ipxstat"},
#define N_SPXSTAT 8
#define N_SPXSTAT 8
{ .n_name = "_spx_istat"},
#define N_DDPSTAT 9
#define N_DDPSTAT 9
{ .n_name = "_ddpstat"},
#define N_DDPCB 10
#define N_DDPCB 10
{ .n_name = "_ddpcb"},
#define N_NGSOCKS 11
#define N_NGSOCKS 11
{ .n_name = "_ngsocklist"},
#define N_IP6STAT 12
#define N_IP6STAT 12
{ .n_name = "_ip6stat" },
#define N_ICMP6STAT 13
#define N_ICMP6STAT 13
{ .n_name = "_icmp6stat" },
#define N_IPSECSTAT 14
#define N_IPSECSTAT 14
{ .n_name = "_ipsec4stat" },
#define N_IPSEC6STAT 15
#define N_IPSEC6STAT 15
{ .n_name = "_ipsec6stat" },
#define N_PIM6STAT 16
#define N_PIM6STAT 16
{ .n_name = "_pim6stat" },
#define N_MRT6STAT 17
#define N_MRT6STAT 17
{ .n_name = "_mrt6stat" },
#define N_MF6CTABLE 18
#define N_MF6CTABLE 18
{ .n_name = "_mf6ctable" },
#define N_MIF6TABLE 19
#define N_MIF6TABLE 19
{ .n_name = "_mif6table" },
#define N_PFKEYSTAT 20
#define N_PFKEYSTAT 20
{ .n_name = "_pfkeystat" },
#define N_MBSTAT 21
#define N_MBSTAT 21
{ .n_name = "_mbstat" },
#define N_MBTYPES 22
#define N_MBTYPES 22
{ .n_name = "_mbtypes" },
#define N_NMBCLUSTERS 23
#define N_NMBCLUSTERS 23
{ .n_name = "_nmbclusters" },
#define N_NMBUFS 24
#define N_NMBUFS 24
{ .n_name = "_nmbufs" },
#define N_MBHI 25
{ .n_name = "_mbuf_hiwm" },
@ -138,9 +138,9 @@ static struct nlist nl[] = {
{ .n_name = "_mbuf_lowm" },
#define N_CLLO 32
{ .n_name = "_clust_lowm" },
#define N_CARPSTAT 33
#define N_CARPSTAT 33
{ .n_name = "_carpstats" },
#define N_PFSYNCSTAT 34
#define N_PFSYNCSTAT 34
{ .n_name = "_pfsyncstats" },
#define N_AHSTAT 35
{ .n_name = "_ahstat" },

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California.
* Copyright (c) 2005 Robert N. M. Watson
@ -300,7 +300,7 @@ mbpr(void *kvmd, u_long mbaddr)
goto out;
}
} else {
if (kread(mbaddr, (char *)&mbstat, sizeof mbstat))
if (kread(mbaddr, (char *)&mbstat, sizeof mbstat) != 0)
goto out;
}
printf("%lu requests for sfbufs denied\n", mbstat.sf_allocfail);

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 2007 Bruce M. Simpson <bms@FreeBSD.org>
* All rights reserved.
*
@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
#include "netstat.h"
#define __NETSTAT_BURN_BRIDGES
#define __NETSTAT_BURN_BRIDGES
#ifdef __NETSTAT_BURN_BRIDGES

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 1989 Stephen Deering
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (C) 1998 WIDE Project.
* All rights reserved.
*
@ -26,8 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
/*-
* Copyright (c) 1989 Stephen Deering
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 1996-1999 Whistle Communications, Inc.
* All rights reserved.
*

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 1992, 1993
* Regents of the University of California. All rights reserved.
*
@ -78,13 +78,13 @@ void ip_stats(u_long, const char *, int, int);
void icmp_stats(u_long, const char *, int, int);
void igmp_stats(u_long, const char *, int, int);
void pim_stats(u_long, const char *, int, int);
void carp_stats (u_long, const char *, int, int);
void pfsync_stats (u_long, const char *, int, int);
void carp_stats(u_long, const char *, int, int);
void pfsync_stats(u_long, const char *, int, int);
#ifdef IPSEC
void ipsec_stats(u_long, const char *, int, int);
void esp_stats (u_long, const char *, int, int);
void ah_stats (u_long, const char *, int, int);
void ipcomp_stats (u_long, const char *, int, int);
void esp_stats(u_long, const char *, int, int);
void ah_stats(u_long, const char *, int, int);
void ipcomp_stats(u_long, const char *, int, int);
#endif
#ifdef INET6

View File

@ -1,8 +1,6 @@
/* $FreeBSD$ */
/* $NetBSD: inet.c,v 1.35.2.1 1999/04/29 14:57:08 perry Exp $ */
/* $KAME: ipsec.c,v 1.25 2001/03/12 09:04:39 itojun Exp $ */
/*
/*-
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved.
*
@ -30,8 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@ -64,14 +61,14 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if 0
#ifndef lint
/*
static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
*/
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/queue.h>

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include "netstat.h"
#define kget(p, d) (kread((u_long)(p), (char *)&(d), sizeof (d)))
#define kget(p, d) (kread((u_long)(p), (char *)&(d), sizeof (d)))
/*
* Definitions for showing gateway flags.
@ -121,21 +121,21 @@ int NewTree = 0;
struct timespec uptime;
static struct sockaddr *kgetsa (struct sockaddr *);
static void size_cols (int ef, struct radix_node *rn);
static void size_cols_tree (struct radix_node *rn);
static void size_cols_rtentry (struct rtentry *rt);
static void p_tree (struct radix_node *);
static void p_rtnode (void);
static void ntreestuff (void);
static void np_rtentry (struct rt_msghdr *);
static void p_sockaddr (struct sockaddr *, struct sockaddr *, int, int);
static const char *fmt_sockaddr (struct sockaddr *sa, struct sockaddr *mask,
static struct sockaddr *kgetsa(struct sockaddr *);
static void size_cols(int ef, struct radix_node *rn);
static void size_cols_tree(struct radix_node *rn);
static void size_cols_rtentry(struct rtentry *rt);
static void p_tree(struct radix_node *);
static void p_rtnode(void);
static void ntreestuff(void);
static void np_rtentry(struct rt_msghdr *);
static void p_sockaddr(struct sockaddr *, struct sockaddr *, int, int);
static const char *fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask,
int flags);
static void p_flags (int, const char *);
static void p_flags(int, const char *);
static const char *fmt_flags(int f);
static void p_rtentry (struct rtentry *);
static void domask (char *, u_long, u_long);
static void p_rtentry(struct rtentry *);
static void domask(char *, u_long, u_long);
/*
* Print routing tables.
@ -793,7 +793,7 @@ routename(u_long in)
strncpy(line, cp, sizeof(line) - 1);
line[sizeof(line) - 1] = '\0';
} else {
#define C(x) ((x) & 0xff)
#define C(x) ((x) & 0xff)
in = ntohl(in);
sprintf(line, "%lu.%lu.%lu.%lu",
C(in >> 24), C(in >> 16), C(in >> 8), C(in));

View File

@ -28,7 +28,6 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#if 0
#ifndef lint
static char sccsid[] = "@(#)sctp.c 0.1 (Berkeley) 4/18/2007";
@ -64,19 +63,19 @@ __FBSDID("$FreeBSD$");
#ifdef SCTP
void inetprint (struct in_addr *, int, const char *, int);
void inetprint(struct in_addr *, int, const char *, int);
static void sctp_statesprint(uint32_t state);
#define NETSTAT_SCTP_STATES_CLOSED 0x0
#define NETSTAT_SCTP_STATES_BOUND 0x1
#define NETSTAT_SCTP_STATES_LISTEN 0x2
#define NETSTAT_SCTP_STATES_COOKIE_WAIT 0x3
#define NETSTAT_SCTP_STATES_COOKIE_ECHOED 0x4
#define NETSTAT_SCTP_STATES_ESTABLISHED 0x5
#define NETSTAT_SCTP_STATES_SHUTDOWN_SENT 0x6
#define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED 0x7
#define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT 0x8
#define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING 0x9
#define NETSTAT_SCTP_STATES_CLOSED 0x0
#define NETSTAT_SCTP_STATES_BOUND 0x1
#define NETSTAT_SCTP_STATES_LISTEN 0x2
#define NETSTAT_SCTP_STATES_COOKIE_WAIT 0x3
#define NETSTAT_SCTP_STATES_COOKIE_ECHOED 0x4
#define NETSTAT_SCTP_STATES_ESTABLISHED 0x5
#define NETSTAT_SCTP_STATES_SHUTDOWN_SENT 0x6
#define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED 0x7
#define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT 0x8
#define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING 0x9
char *sctpstates[] = {
"CLOSED",

View File

@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
#include <kvm.h>
#include "netstat.h"
static void unixdomainpr (struct xunpcb *, struct xsocket *);
static void unixdomainpr(struct xunpcb *, struct xsocket *);
static const char *const socktype[] =
{ "#0", "stream", "dgram", "raw", "rdm", "seqpacket" };
@ -124,7 +124,7 @@ pcblist_kvm(u_long count_off, u_long gencnt_off, u_long head_off, char **bufp)
}
p = buf;
#define COPYOUT(obj, size) do { \
#define COPYOUT(obj, size) do { \
if (len < (size)) { \
warnx("buffer size exceeded"); \
goto fail; \
@ -134,7 +134,7 @@ pcblist_kvm(u_long count_off, u_long gencnt_off, u_long head_off, char **bufp)
p += (size); \
} while (0)
#define KREAD(off, buf, len) do { \
#define KREAD(off, buf, len) do { \
if (kread((uintptr_t)(off), (buf), (len)) != 0) \
goto fail; \
} while (0)