diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-06-14 19:04:11 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-06-14 21:02:46 +0400 |
commit | c2b7b3b8fc79976d2f7e63f4a82dd827b9821fef (patch) | |
tree | 411ea8fdbf235f47e8fa1380b313fedfe7aacbe7 | |
parent | 88101adac56be10a45a8bb6e30ea372a7ab82a44 (diff) | |
download | snoop-c2b7b3b8fc79976d2f7e63f4a82dd827b9821fef.tar.gz |
Fixed warnings and build failures on amd64
28 files changed, 122 insertions, 85 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.c index 097dd6e..52c3386 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.c @@ -562,10 +562,11 @@ void show_pktinfo(flags, num, src, dst, ptvp, tvp, drops, len) int flags, num, drops, len; char *src, *dst; - struct timeval *ptvp, *tvp; + struct timeval32 *ptvp, *tvp; { struct tm *tm; - static struct timeval tvp0; + static struct timeval32 tvp0; + time_t tv_sec; int sec, usec; char *lp = line; int i, start; @@ -574,7 +575,8 @@ show_pktinfo(flags, num, src, dst, ptvp, tvp, drops, len) (void) sprintf(lp, "%3d ", num); lp += strlen(lp); } - tm = localtime(&tvp->tv_sec); + tv_sec = tvp->tv_sec; + tm = localtime(&tv_sec); if (flags & F_TIME) { if (flags & F_ATIME) { diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h index e4f1825..ebe3248 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h @@ -45,7 +45,6 @@ #include <netinet/icmp6.h> #include <net/pppoe.h> #include <libdlpi.h> -#include <note.h> #ifdef __cplusplus extern "C" { @@ -187,8 +186,8 @@ extern void init_datalink(dlpi_handle_t, ulong_t, ulong_t, struct timeval *, struct Pf_ext_packetfilt *); extern void net_read(dlpi_handle_t, size_t, int, void (*)(), int); extern void click(int); -extern void show_pktinfo(int, int, char *, char *, struct timeval *, - struct timeval *, int, int); +extern void show_pktinfo(int, int, char *, char *, struct timeval32 *, + struct timeval32 *, int, int); extern void show_line(char *); /*PRINTFLIKE1*/ extern void show_printf(char *fmt, ...) diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_arp.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_arp.c index c41507c..d30ba76 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_arp.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_arp.c @@ -25,6 +25,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" +#include <sys/socket.h> #include <sys/types.h> #include <sys/errno.h> #include <setjmp.h> @@ -37,6 +38,11 @@ #include <netinet/if_ether.h> #include <netdb.h> #include <net/if_types.h> +#include <arpa/inet.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "snoop.h" diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_capture.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_capture.c index ab6bc29..c6449ab 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_capture.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_capture.c @@ -60,7 +60,7 @@ struct ohdr { int o_msglen; int o_totlen; /* nit_head */ - struct timeval o_time; + struct timeval32 o_time; /* struct sb_hdr.sbh_timestamp is timeval32 */ int o_drops; int o_len; }; @@ -327,7 +327,7 @@ scan(char *buf, int len, int filter, int cap, int old, void (*proc)(), volatile struct sb_hdr *hdrp; volatile struct sb_hdr nhdr, *nhdrp; volatile char *pktp; - volatile struct timeval last_timestamp; + volatile struct timeval32 last_timestamp; /* struct sb_hdr.sbh_timestamp is timeval32 */ volatile int header_okay; extern int count, maxcount; extern int snoop_nrecover; @@ -409,7 +409,7 @@ scan(char *buf, int len, int filter, int cap, int old, void (*proc)(), (void) fprintf(stderr, "(warning) bad packet " "header in buffer"); } - (void) fprintf(stderr, " offset %d: length=%d\n", + (void) fprintf(stderr, " offset %ld: length=%d\n", bp - buf, nhdrp->sbh_totlen); goto err; } @@ -618,7 +618,7 @@ cap_open_read(const char *name) cap_buffp = mmap(0, cap_len, PROT_READ, MAP_PRIVATE, capfile_in, 0); (void) close(capfile_in); - if ((int)cap_buffp == -1) + if ((intptr_t)cap_buffp == -1) pr_err("couldn't mmap %s: %m", name); /* Check if new snoop capture file format */ diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcpv6.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcpv6.c index 0e7c1be..022d645 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcpv6.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcpv6.c @@ -645,7 +645,7 @@ show_options(const uint8_t *data, int len) timevalue = ntohl(val32) + DUID_TIME_BASE; (void) snprintf(get_line(0, 0), get_line_remain(), - " Time = %lu (%.24s)", ntohl(val32), + " Time = %u (%.24s)", ntohl(val32), ctime(&timevalue)); } if (type == DHCPV6_DUID_EN) { @@ -657,7 +657,7 @@ show_options(const uint8_t *data, int len) val32 = ntohl(val32); (void) snprintf(get_line(0, 0), get_line_remain(), - " Enterprise Number = %lu (%s)", val32, + " Enterprise Number = %u (%s)", val32, entr_to_str(val32)); } if (olen == 0) @@ -822,7 +822,7 @@ show_options(const uint8_t *data, int len) olen -= sizeof (val32); val32 = ntohl(val32); (void) snprintf(get_line(0, 0), get_line_remain(), - " Enterprise Number = %lu (%s)", val32, + " Enterprise Number = %u (%s)", val32, entr_to_str(val32)); /* FALLTHROUGH */ case DHCPV6_OPT_USER_CLASS: @@ -852,7 +852,7 @@ show_options(const uint8_t *data, int len) olen -= sizeof (val32); val32 = ntohl(val32); (void) snprintf(get_line(0, 0), get_line_remain(), - " Enterprise Number = %lu (%s)", val32, + " Enterprise Number = %u (%s)", val32, entr_to_str(val32)); while (olen >= sizeof (sd6o)) { (void) memcpy(&sd6o, data, sizeof (sd6o)); @@ -886,7 +886,7 @@ show_options(const uint8_t *data, int len) olen -= sizeof (val32); val32 = ntohl(val32); (void) snprintf(get_line(0, 0), get_line_remain(), - " Enterprise Number = %lu (%s)", val32, + " Enterprise Number = %u (%s)", val32, entr_to_str(val32)); /* FALLTHROUGH */ case DHCPV6_OPT_INTERFACE_ID: @@ -967,7 +967,7 @@ show_options(const uint8_t *data, int len) break; (void) memcpy(&val32, data, sizeof (val32)); (void) snprintf(get_line(0, 0), get_line_remain(), - " Refresh Time = %lu seconds", ntohl(val32)); + " Refresh Time = %u seconds", ntohl(val32)); break; case DHCPV6_OPT_GEOCONF_CVC: { dhcpv6_civic_t d6c; @@ -983,7 +983,7 @@ show_options(const uint8_t *data, int len) " What Location = %u (%s)", d6c.d6c_what, cwhat_to_str(d6c.d6c_what)); (void) snprintf(get_line(0, 0), get_line_remain(), - " Country Code = %.*s", sizeof (d6c.d6c_cc), + " Country Code = %.*s", (int)sizeof (d6c.d6c_cc), d6c.d6c_cc); while (olen >= 2) { (void) snprintf(get_line(0, 0), diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_display.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_display.c index 9bc4eb5..02f4daa 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_display.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_display.c @@ -75,12 +75,13 @@ void process_pkt(struct sb_hdr *hdrp, char *pktp, int num, int flags) { int drops, pktlen; - struct timeval *tvp; + struct timeval32 *tvp; struct tm *tm; extern int x_offset; extern int x_length; + time_t tv_sec; int offset, length; - static struct timeval ptv; + static struct timeval32 ptv; if (hdrp == NULL) return; @@ -96,7 +97,8 @@ process_pkt(struct sb_hdr *hdrp, char *pktp, int num, int flags) /* set up externals */ dlc_header = pktp; pi_frame = num; - tm = localtime(&tvp->tv_sec); + tv_sec = tvp->tv_sec; + tm = localtime(&tv_sec); pi_time_hour = tm->tm_hour; pi_time_min = tm->tm_min; pi_time_sec = tm->tm_sec; @@ -583,7 +585,7 @@ getxdr_date() return ("-1 "); if (sec < 3600 * 24 * 365) { /* assume not a date */ - (void) sprintf(buff, "%d.%06d", sec, usec); + (void) sprintf(buff, "%d.%06d", (int)sec, usec); } else { tmp = gmtime(&sec); (void) memcpy(&my_time, tmp, sizeof (struct tm)); @@ -633,13 +635,13 @@ format_time(int64_t sec, uint32_t nsec) if (sec < 3600 * 24 * 365) { /* assume not a date; includes negative times */ - (void) sprintf(buff, "%lld.%06d", sec, nsec); + (void) sprintf(buff, "%" PRId64 ".%06d", sec, nsec); } else if (sec > INT32_MAX) { /* * XXX No routines are available yet for formatting 64-bit * times. */ - (void) sprintf(buff, "%lld.%06d", sec, nsec); + (void) sprintf(buff, "%" PRId64 ".%06d", sec, nsec); } else { time_t sec32 = (time_t)sec; @@ -678,7 +680,7 @@ getxdr_time() return ("-1 "); if (sec < 3600 * 24 * 365) { /* assume not a date */ - (void) sprintf(buff, "%d", sec); + (void) sprintf(buff, "%d", (int)sec); } else { tmp = gmtime(&sec); memcpy(&my_time, tmp, sizeof (struct tm)); @@ -762,7 +764,7 @@ hexdump(char *data, int datalen) printf("\n"); for (p = data; p < data + datalen; p += chunk) { - printf("\t%4d: ", p - data); + printf("\t%4td: ", p - data); left = (data + datalen) - p; len = MIN(chunk, left); for (i = 0; i < (len / 2); i++) diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ether.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ether.c index 5c6bde0..8112727 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ether.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ether.c @@ -38,7 +38,6 @@ #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/if_ether.h> -#include <sys/ib/clients/ibd/ibd.h> #include <sys/ethernet.h> #include <sys/vlan.h> #include <sys/zone.h> @@ -52,6 +51,20 @@ #include "at.h" #include "snoop.h" +#ifndef IPOIB_HDRSIZE +/* + * IETF defined IPoIB encapsulation header, with 2b of ethertype + * followed by 2 reserved bytes. This is at the start of the + * datagram sent to and received over the wire by the driver. +*/ +typedef struct ipoib_header { + unsigned short ipoib_type; + unsigned short ipoib_mbz; +} ipoib_hdr_t; +#define IPOIB_HDRSIZE (sizeof(struct ipoib_header)) +#endif + + static headerlen_fn_t ether_header_len, fddi_header_len, tr_header_len, ib_header_len, ipnet_header_len, ipv4_header_len, ipv6_header_len; static interpreter_fn_t interpret_ether, interpret_fddi, interpret_tr, @@ -98,7 +111,7 @@ interface_t INTERFACES[] = { { DL_6TO4, 0, 9, 1, IPPROTO_ENCAP, IPPROTO_IPV6, ipv4_header_len, interpret_iptun, B_FALSE }, - { (uint_t)-1, 0, 0, 0, 0, NULL, NULL, B_FALSE } + { (uint_t)-1, 0, 0, 0, 0, 0, 0, B_FALSE } }; /* externals */ @@ -1692,12 +1705,12 @@ interpret_ipnet(int flags, char *header, int elen, int origlen) if (dl.dli_zsrc == ALL_ZONES) sprintf(szone, "Unknown"); else - sprintf(szone, "%lu", BE_32(dl.dli_zsrc)); + sprintf(szone, "%u", BE_32(dl.dli_zsrc)); if (dl.dli_zdst == ALL_ZONES) sprintf(dzone, "Unknown"); else - sprintf(dzone, "%lu", BE_32(dl.dli_zdst)); + sprintf(dzone, "%u", BE_32(dl.dli_zdst)); if (flags & F_SUM) { (void) snprintf(get_sum_line(), MAXLINE, diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_filter.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_filter.c index 16ea65e..6407c1d 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_filter.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_filter.c @@ -364,9 +364,9 @@ codeprint() for (op = oplist; *op; op++) { if (*op <= OP_LAST) - printf("\t%2d: %s\n", op - oplist, opnames[*op]); + printf("\t%2ld: %s\n", op - oplist, opnames[*op]); else - printf("\t%2d: (%d)\n", op - oplist, *op); + printf("\t%2ld: (%d)\n", op - oplist, *op); switch (*op) { case OP_LOAD_CONST: @@ -374,14 +374,14 @@ codeprint() case OP_BRFL: op++; if ((int)*op < 0) - printf("\t%2d: 0x%08x (%d)\n", + printf("\t%2ld: 0x%08x (%d)\n", op - oplist, *op, *op); else - printf("\t%2d: %d (0x%08x)\n", + printf("\t%2ld: %d (0x%08x)\n", op - oplist, *op, *op); } } - printf("\t%2d: STOP\n", op - oplist); + printf("\t%2ld: STOP\n", op - oplist); printf("\n"); } @@ -592,7 +592,7 @@ want_packet(uchar_t *pkt, int len, int origlen) /* * Handle 3 possible alignments */ - switch ((((unsigned)base) + off) % sizeof (uint_t)) { + switch ((((uintptr_t)base) + off) % sizeof (uint_t)) { case 0: *sp = *(uint_t *)(base + off); break; diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_http.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_http.c index b6e6b9d..e7d3b4d 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_http.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_http.c @@ -55,7 +55,9 @@ #define MAXCHARS 80 #define NLINES 5 +#ifndef MIN #define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif static int printable(const char *line, const char *endp); diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_icmp.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_icmp.c index 4f6fa8a..f3e28f7 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_icmp.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_icmp.c @@ -876,14 +876,14 @@ interpret_options(optc, ilen) PREFIX_INFINITY) sprintf(validstr, "INFINITY"); else - sprintf(validstr, "%lu", + sprintf(validstr, "%u", ntohl(popt->nd_opt_pi_valid_time)); if (ntohl(popt->nd_opt_pi_preferred_time) == PREFIX_INFINITY) sprintf(preferredstr, "INFINITY"); else - sprintf(preferredstr, "%lu", + sprintf(preferredstr, "%u", ntohl(popt->nd_opt_pi_preferred_time)); (void) sprintf(get_line(0, 0), diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ldap.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ldap.c index 2877ad7..2c231e0 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ldap.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ldap.c @@ -1421,7 +1421,7 @@ ldapdump(char *data, int datalen) asnshw1("LDAP: Skipping until next full LDAPMessage\n"); for (p = data; p < data + datalen; p += chunk) { - asnshw2("LDAP:\t%4d: ", p - data); + asnshw2("LDAP:\t%4ld: ", p - data); left = (data + datalen) - p; len = MIN(chunk, left); for (i = 0; i < (len / 2); i++) diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_mip.h b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_mip.h index ca40f53..837af50 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_mip.h +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_mip.h @@ -103,7 +103,7 @@ typedef struct registration_request_str { #endif /* _BIT_FIELDS_HTOL */ #endif /* __sparc */ -#ifdef __i386 +#if defined(__i386) || defined(__amd64) #ifdef _BIT_FIELDS_LTOH typedef struct registration_request_str { uchar_t type; /* must be REG_TYPE_REQ */ @@ -123,7 +123,7 @@ typedef struct registration_request_str { ident_t identification; /* for replay protection */ } regreq_t; #endif /* _BIT_FIELDS_LTOH */ -#endif /* __i386 */ +#endif /* __i386 || __amd64 */ /* * Registration Reply sent by a home agent to a mobile node in @@ -299,7 +299,7 @@ typedef struct mobility_agt_adv_extension { #endif /* _BIT_FIELDS_HTOL */ #endif /* __sparc */ -#ifdef __i386 +#if defined(__i386) || defined(__amd64) #ifdef _BIT_FIELDS_LTOH typedef struct mobility_agt_adv_extension { uchar_t type; @@ -318,7 +318,7 @@ typedef struct mobility_agt_adv_extension { uchar_t reserved; } mobagtadvext_t; #endif /* _BIT_FIELDS_LTOH */ -#endif /* __i386 */ +#endif /* __i386 || __amd64 */ #ifdef __cplusplus } diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_mount.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_mount.c index ce2df1f..b0b3902 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_mount.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_mount.c @@ -310,7 +310,7 @@ detail_mountstat() else if ((str = strerror(status)) == (char *)NULL) str = ""; - (void) sprintf(get_line(0, 0), "Status = %d (%s)", status, str); + (void) sprintf(get_line(0, 0), "Status = %ld (%s)", status, str); return ((int)status); } @@ -396,7 +396,7 @@ detail_mountstat3() ulong_t status; status = getxdr_u_long(); - (void) sprintf(get_line(0, 0), "Status = %d (%s)", status, + (void) sprintf(get_line(0, 0), "Status = %ld (%s)", status, statusmsg3(status)); if (status == 0) { detail_mountfh3(); diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nfs4.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nfs4.c index bb1db5c..7236a92 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nfs4.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nfs4.c @@ -27,6 +27,7 @@ #include <string.h> #include <strings.h> #include <stdlib.h> +#include <inttypes.h> #include <sys/types.h> #include <sys/errno.h> #include <sys/tiuser.h> @@ -1288,7 +1289,7 @@ _detail_stateid(stateid4 *stateid, char *prefix) spec == 0 ? "SPECIAL_0" : (spec == 1 ? "SPECIAL_1" : "SPECIAL_?")); - sprintf(get_line(0, 0), " len = %u val = %s", + sprintf(get_line(0, 0), " len = %lu val = %s", sizeof (stateid->other), tohex(stateid->other, sizeof (stateid->other))); @@ -3604,7 +3605,7 @@ sum_space_limit(nfs_space_limit4 *limitp) buf[0] = '\0'; switch (limitp->limitby) { case NFS_LIMIT_SIZE: - snprintf(buf, buflen, "LB=SZ(%llu)", + snprintf(buf, buflen, "LB=SZ(%" PRIu64 ")", limitp->nfs_space_limit4_u.filesize); break; case NFS_LIMIT_BLOCKS: @@ -3633,7 +3634,7 @@ detail_space_limit(nfs_space_limit4 *limitp) switch (limitp->limitby) { case NFS_LIMIT_SIZE: - sprintf(get_line(0, 0), "Bytes = %llu", + sprintf(get_line(0, 0), "Bytes = %" PRIu64, limitp->nfs_space_limit4_u.filesize); break; case NFS_LIMIT_BLOCKS: @@ -4053,7 +4054,7 @@ prt_size(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Size = %llu", val); + sprintf(get_line(0, 0), "Size = %" PRIu64, val); } static void @@ -4315,7 +4316,7 @@ prt_fileid(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "File ID = %llu", val); + sprintf(get_line(0, 0), "File ID = %" PRIu64, val); } static void @@ -4325,7 +4326,7 @@ prt_mounted_on_fileid(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Mounted On File ID = %llu", val); + sprintf(get_line(0, 0), "Mounted On File ID = %" PRIu64, val); } static void @@ -4335,7 +4336,7 @@ prt_files_avail(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Files Available = %llu", val); + sprintf(get_line(0, 0), "Files Available = %" PRIu64, val); } static void @@ -4345,7 +4346,7 @@ prt_files_free(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Files Free = %llu", val); + sprintf(get_line(0, 0), "Files Free = %" PRIu64, val); } static void @@ -4355,7 +4356,7 @@ prt_files_total(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Files Total = %llu", val); + sprintf(get_line(0, 0), "Files Total = %" PRIu64, val); } static void @@ -4414,7 +4415,7 @@ prt_maxfilesize(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Maximum File Size = %llu", val); + sprintf(get_line(0, 0), "Maximum File Size = %" PRIu64, val); } static void @@ -4444,7 +4445,7 @@ prt_maxread(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Maximum Read Size = %llu", val); + sprintf(get_line(0, 0), "Maximum Read Size = %" PRIu64, val); } static void @@ -4455,7 +4456,7 @@ prt_maxwrite(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Maximum Write Size = %llu", val); + sprintf(get_line(0, 0), "Maximum Write Size = %" PRIu64, val); } static void @@ -4529,7 +4530,7 @@ prt_quota_avail_hard(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Quota Hard Limit = %llu", val); + sprintf(get_line(0, 0), "Quota Hard Limit = %" PRIu64, val); } static void @@ -4539,7 +4540,7 @@ prt_quota_avail_soft(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Quota Soft Limit = %llu", val); + sprintf(get_line(0, 0), "Quota Soft Limit = %" PRIu64, val); } static void @@ -4549,7 +4550,7 @@ prt_quota_used(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Quota Used = %llu", val); + sprintf(get_line(0, 0), "Quota Used = %" PRIu64, val); } static void @@ -4570,7 +4571,7 @@ prt_space_avail(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Space Available = %llu", val); + sprintf(get_line(0, 0), "Space Available = %" PRIu64, val); } static void @@ -4580,7 +4581,7 @@ prt_space_free(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Space Free = %llu", val); + sprintf(get_line(0, 0), "Space Free = %" PRIu64, val); } static void @@ -4590,7 +4591,7 @@ prt_space_total(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Total Disk Space = %llu", val); + sprintf(get_line(0, 0), "Total Disk Space = %" PRIu64, val); } static void @@ -4600,7 +4601,7 @@ prt_space_used(XDR *xdr) if (!xdr_uint64_t(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Space Used (this object) = %llu", val); + sprintf(get_line(0, 0), "Space Used (this object) = %" PRIu64, val); } static void @@ -4671,7 +4672,7 @@ prt_time_delta(XDR *xdr) if (!xdr_nfstime4(xdr, &val)) longjmp(xdr_err, 1); - sprintf(get_line(0, 0), "Server Time Granularity = %lld.%09d sec", + sprintf(get_line(0, 0), "Server Time Granularity = %" PRIu64 ".%09d sec", val.seconds, val.nseconds); } diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nis.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nis.c index a78c418..68ac226 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nis.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nis.c @@ -510,7 +510,7 @@ nisreply(proc) (void) showxdr_u_long("Transid = %lu"); xfrstat = getxdr_u_long(); (void) sprintf(get_line(0, 0), - "Transfer status = %lu (%s)", + "Transfer status = %u (%s)", xfrstat, sum_ypxfrstat(xfrstat)); break; case YPPROC_CLEAR: diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nlm.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nlm.c index 45c23ee..d32e7f2 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nlm.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nlm.c @@ -311,6 +311,10 @@ interpret_nlm_1(flags, type, xid, vers, proc, data, len) } } +#ifdef roundup +#undef roundup +#endif + #define roundup(sz) ((sz / 4 + (sz % 4 > 0)) * 4) /* diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ntp.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ntp.c index 4f6fae3..882d892 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ntp.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ntp.c @@ -212,9 +212,8 @@ interpret_ntp(int flags, struct ntpdata *ntp_pkt, int fraglen) */ break; } - (void) sprintf(get_line((char *)ntp->keyid - - dlc_header, 1), - "Key ID = %8lu", ntohl(ntp->keyid)); + (void) sprintf(get_line((intptr_t)ntp->keyid - (intptr_t)dlc_header, 1), + "Key ID = %8lu", ntohl(ntp->keyid)); macbytes = fraglen - (LEN_PKT_NOMAC + sizeof (uint32_t)); diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ospf6.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ospf6.c index 6394c8e..d0d6d2f 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ospf6.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ospf6.c @@ -508,10 +508,10 @@ interpret_ospf6_lsa(int flags, struct lsa6 *lsa, uchar_t *fragend) break; case LS_TYPE_LINK: llsa = &lsa->lsa_un.un_llsa; - if (TRUNC(llsa->llsa_options)) + if (TRUNC((intptr_t)llsa->llsa_options)) return (-1); ospf_print_bits(ospf6_option_bits, ntohl(llsa->llsa_options)); - if (TRUNC(llsa->llsa_nprefix)) + if (TRUNC((intptr_t)llsa->llsa_nprefix)) return (-1); (void) inet_ntop(AF_INET6, &llsa->llsa_lladdr, addrstr, INET6_ADDRSTRLEN); diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_pf.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_pf.c index 40faeb5..cb59b67 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_pf.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_pf.c @@ -293,7 +293,7 @@ pf_codeprint(code, len) } for (pc = code; pc < plast; pc++) { - printf("\t%3d: ", pc - code); + printf("\t%3ld: ", pc - code); op = *pc & 0xfc00; /* high 10 bits */ action = *pc & 0x3ff; /* low 6 bits */ @@ -389,7 +389,7 @@ pf_codeprint(code, len) action == ENF_BRTR || action == ENF_BRFL) { pc++; - printf("\n\t%3d: %d (0x%04x)", pc - code, *pc, *pc); + printf("\n\t%3ld: %d (0x%04x)", pc - code, *pc, *pc); } printf("\n"); diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ppp.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ppp.c index a056abd..7548041 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ppp.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ppp.c @@ -443,7 +443,7 @@ interpret_ppp_cp(int flags, uchar_t *data, int len, ppp_protoinfo_t *protoinfo) * is almost always plain text. Print it as such. */ (void) sprintf(get_line(0, 0), "Data = %.*s", - length - sizeof (ppp_pkt_t), datap); + (int)(length - sizeof (ppp_pkt_t)), datap); show_space(); break; @@ -479,7 +479,7 @@ interpret_ppp_cp(int flags, uchar_t *data, int len, ppp_protoinfo_t *protoinfo) case CODE_IDENT: case CODE_TIMEREMAIN: { uint32_t magicnum; - char *message_label = "Identification = %.*s"; + const char *message_label = "Identification = %.*s"; if (len < sizeof (uint32_t)) break; @@ -1185,7 +1185,7 @@ opt_format_callback(uchar_t *optdata, uint8_t size) if (size > sizeof (operation)) { (void) sprintf(get_line(0, 0), "Message = %.*s", - size - sizeof (operation), optdata); + (int)(size - sizeof (operation)), optdata); } } diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rip.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rip.c index c8a897c..868bbe3 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rip.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rip.c @@ -294,7 +294,7 @@ interpret_rip(int flags, struct rip *rip, int fraglen) (void) snprintf(get_line(0, 0), get_line_remain(), "Int flags = %8x", ep->int_flags); (void) snprintf(get_line(0, 0), get_line_remain(), - "Int name = \"%.*s\"", sizeof (ep->int_name), + "Int name = \"%.*s\"", (int)sizeof (ep->int_name), ep->int_name); break; diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rip6.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rip6.c index 9f7b10e..a3004f1 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rip6.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rip6.c @@ -39,6 +39,9 @@ #include <arpa/inet.h> #include <protocols/routed.h> #include <protocols/ripngd.h> + +#include <stdio.h> + #include "snoop.h" extern char *dlc_header; diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rpc.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rpc.c index be39961..1b486f7 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rpc.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rpc.c @@ -42,6 +42,9 @@ #include <rpc/svc.h> #include <rpcsvc/yp_prot.h> #include <rpc/pmap_prot.h> + +#include <string.h> + #include "snoop.h" #ifndef MIN @@ -210,7 +213,7 @@ interpret_rpc(int flags, char *rpc, int fraglen, int type) show_space(); if (type == IPPROTO_TCP) { /* record mark */ (void) sprintf(get_line(markpos, markpos+4), - "Record Mark: %s fragment, length = %d", + "Record Mark: %s fragment, length = %lu", recmark & LAST_FRAG ? "last" : "", recmark & ~LAST_FRAG); } diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rquota.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rquota.c index 13f5dc6..c417b7f 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rquota.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rquota.c @@ -68,7 +68,7 @@ interpret_rquota(flags, type, xid, vers, proc, data, len) { char *line; char buff[RQ_PATHLEN + 1]; - int status; + long status; int uid; if (proc < 0 || proc > MAXPROC) @@ -148,7 +148,7 @@ show_quota() (void) showxdr_u_long("Block size = %lu"); active = getxdr_u_long(); (void) sprintf(get_line(0, 0), - " Quota checking = %lu (%s)", + " Quota checking = %d (%s)", active, active ? "on" : "off"); (void) showxdr_u_long(" Blocks hard limit = %lu"); diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rstat.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rstat.c index e45205a..46f0cbd 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rstat.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_rstat.c @@ -240,14 +240,14 @@ detail_statsvar() n = getxdr_u_long(); for (i = 1; i <= n; i++) { (void) sprintf(get_line(0, 0), - " Time (%2d) = %d", i, getxdr_long()); + " Time (%2d) = %ld", i, getxdr_long()); } show_space(); (void) sprintf(get_line(0, 0), "Disk Transfers:"); n = getxdr_u_long(); for (i = 1; i <= n; i++) { (void) sprintf(get_line(0, 0), - " Transfers (%2d) = %d", i, getxdr_long()); + " Transfers (%2d) = %ld", i, getxdr_long()); } show_space(); (void) showxdr_u_long("Pages in = %lu"); diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_sctp.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_sctp.c index 8aec695..7bd90d0 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_sctp.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_sctp.c @@ -610,7 +610,7 @@ interpret_params(const void *data, int datalen, char *type, " ------- SCTP %s Type = %s (%u%s)", type, desc, ptype, actstr); (void) snprintf(get_line(0, 0), get_line_remain(), - " Data length = %hu", plen - sizeof (*hdr)); + " Data length = %lu", plen - sizeof (*hdr)); if (parse != NULL) { parse(flags, 0, (char *)(hdr + 1), @@ -731,7 +731,7 @@ parse_data_chunk(int flags, uint8_t cflags, const void *data, int datalen) if (datalen < sizeof (*dcp)) { if (flags & F_DTAIL) { (void) snprintf(get_line(0, 0), get_line_remain(), - "==> Incomplete DATA chunk %d (%d)", datalen, + "==> Incomplete DATA chunk %d (%lu)", datalen, sizeof (*dcp)); } return; diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_tftp.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_tftp.c index 2196454..8f9c7ff 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_tftp.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_tftp.c @@ -28,6 +28,9 @@ #include <fcntl.h> #include <arpa/tftp.h> + +#include <stdio.h> + #include "snoop.h" extern char *dlc_header; diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_trill.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_trill.c index 51876bc..f2effc8 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_trill.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_trill.c @@ -68,7 +68,7 @@ interpret_trill(int flags, struct ether_header **e, char *data, int *alen) (void) snprintf(get_line(0, 0), get_line_remain(), "Multi-destination = %d", trillhdr->th_multidest); (void) snprintf(get_line(0, 0), get_line_remain(), - "Options Len = %d bytes", optslen); + "Options Len = %lu bytes", optslen); show_trailer(); } @@ -101,7 +101,7 @@ interpret_trill(int flags, struct ether_header **e, char *data, int *alen) if (flags & F_SUM) { (void) snprintf(get_sum_line(), MAXLINE, - "TRILL D:%d S:%d HC:%d M:%d O:%d L:%d VLAN:%d %s", + "TRILL D:%d S:%d HC:%d M:%d O:%lu L:%d VLAN:%d %s", ntohs(trillhdr->th_egressnick), ntohs(trillhdr->th_ingressnick), trillhdr->th_hopcount, |