From 952253e163e217f33df26f96ddc2cd70933ecfa4 Mon Sep 17 00:00:00 2001 From: Frode Solheim Date: Sat, 5 Sep 2015 00:21:29 +0200 Subject: [PATCH] slirp debug logging (print format) changes --- slirp/if.cpp | 4 ++-- slirp/ip_icmp.cpp | 4 ++-- slirp/ip_input.cpp | 10 +++++----- slirp/ip_output.cpp | 4 ++-- slirp/mbuf.cpp | 6 +++--- slirp/sbuf.cpp | 4 ++-- slirp/socket.cpp | 14 +++++++------- slirp/tcp_input.cpp | 14 +++++++------- slirp/tcp_output.cpp | 2 +- slirp/tcp_subr.cpp | 22 +++++++++++----------- slirp/udp.cpp | 6 +++--- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/slirp/if.cpp b/slirp/if.cpp index 65d398be..2bae5185 100644 --- a/slirp/if.cpp +++ b/slirp/if.cpp @@ -157,8 +157,8 @@ void if_output(struct socket *so, struct mbuf *ifm) int on_fastq = 1; DEBUG_CALL("if_output"); - DEBUG_ARG("so = %lx", (long)so); - DEBUG_ARG("ifm = %lx", (long)ifm); + DEBUG_ARG("so = %p", so); + DEBUG_ARG("ifm = %p", ifm); /* * First remove the mbuf from m_usedlist, diff --git a/slirp/ip_icmp.cpp b/slirp/ip_icmp.cpp index 65becfe7..f82648c8 100644 --- a/slirp/ip_icmp.cpp +++ b/slirp/ip_icmp.cpp @@ -128,7 +128,7 @@ void icmp_input(struct mbuf *m, int hlen) /* int code; */ DEBUG_CALL("icmp_input"); - DEBUG_ARG("m = %lx", (long )m); + DEBUG_ARG("m = %p", m); DEBUG_ARG("m_len = %d", m->m_len); icmpstat.icps_received++; @@ -262,7 +262,7 @@ void icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize, const register struct mbuf *m; DEBUG_CALL("icmp_error"); - DEBUG_ARG("msrc = %lx", (long )msrc); + DEBUG_ARG("msrc = %p", msrc); DEBUG_ARG("msrc_len = %d", msrc->m_len); if(type!=ICMP_UNREACH && type!=ICMP_TIMXCEED) goto end_error; diff --git a/slirp/ip_input.cpp b/slirp/ip_input.cpp index c594556a..9a70a3a6 100644 --- a/slirp/ip_input.cpp +++ b/slirp/ip_input.cpp @@ -76,7 +76,7 @@ void ip_input(struct mbuf *m) int hlen; DEBUG_CALL("ip_input"); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("m = %p", m); DEBUG_ARG("m_len = %d", m->m_len); ipstat.ips_total++; @@ -249,9 +249,9 @@ struct ip *ip_reass(struct ip *ip, struct ipq *fp) int i, next; DEBUG_CALL("ip_reass"); - DEBUG_ARG("ip = %lx", (long)ip); - DEBUG_ARG("fp = %lx", (long)fp); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("ip = %p", ip); + DEBUG_ARG("fp = %p", fp); + DEBUG_ARG("m = %p", m); /* * Presence of header sizes in mbufs @@ -416,7 +416,7 @@ void ip_freef(struct ipq *fp) void ip_enq(struct ipasfrag *p, struct ipasfrag *prev) { DEBUG_CALL("ip_enq"); - DEBUG_ARG("prev = %lx", (long)prev); + DEBUG_ARG("prev = %p", prev); p->ipf_prev = prev; p->ipf_next = prev->ipf_next; ((struct ipasfrag *)(prev->ipf_next))->ipf_prev = p; diff --git a/slirp/ip_output.cpp b/slirp/ip_output.cpp index 114a56d1..146922e6 100644 --- a/slirp/ip_output.cpp +++ b/slirp/ip_output.cpp @@ -56,8 +56,8 @@ int ip_output(struct socket *so, struct mbuf *m0) int len, off, error = 0; DEBUG_CALL("ip_output"); - DEBUG_ARG("so = %lx", (long)so); - DEBUG_ARG("m0 = %lx", (long)m0); + DEBUG_ARG("so = %p", so); + DEBUG_ARG("m0 = %p", m0); /* We do no options */ /* if (opt) { diff --git a/slirp/mbuf.cpp b/slirp/mbuf.cpp index 41ea3e4d..e2b00851 100644 --- a/slirp/mbuf.cpp +++ b/slirp/mbuf.cpp @@ -103,7 +103,7 @@ struct mbuf *m_get(void) m->m_nextpkt = 0; m->m_prevpkt = 0; end_error: - DEBUG_ARG("m = %lx", (long )m); + DEBUG_ARG("m = %p", m); return m; } @@ -111,7 +111,7 @@ void m_free(struct mbuf *m) { DEBUG_CALL("m_free"); - DEBUG_ARG("m = %lx", (long )m); + DEBUG_ARG("m = %p", m); if(m) { /* Remove from m_usedlist */ @@ -230,7 +230,7 @@ struct mbuf *dtom(void *dat) struct mbuf *m; DEBUG_CALL("dtom"); - DEBUG_ARG("dat = %lx", (long )dat); + DEBUG_ARG("dat = %p", dat); /* bug corrected for M_EXT buffers */ for (m = m_usedlist.m_next; m != &m_usedlist; m = m->m_next) { diff --git a/slirp/sbuf.cpp b/slirp/sbuf.cpp index 4ccc008a..fe0392d1 100644 --- a/slirp/sbuf.cpp +++ b/slirp/sbuf.cpp @@ -69,8 +69,8 @@ void sbappend(struct socket *so, struct mbuf *m) int ret = 0; DEBUG_CALL("sbappend"); - DEBUG_ARG("so = %lx", (long)so); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("so = %p", so); + DEBUG_ARG("m = %p", m); DEBUG_ARG("m->m_len = %d", m->m_len); /* Shouldn't happen, but... e.g. foreign host closes connection */ diff --git a/slirp/socket.cpp b/slirp/socket.cpp index 4fce2d39..ab5e3dcc 100644 --- a/slirp/socket.cpp +++ b/slirp/socket.cpp @@ -93,7 +93,7 @@ int soread(struct socket *so) int mss = so->so_tcpcb->t_maxseg; DEBUG_CALL("soread"); - DEBUG_ARG("so = %lx", (long )so); + DEBUG_ARG("so = %p", so); /* * No need to check if there's enough room to read. @@ -198,7 +198,7 @@ void sorecvoob(struct socket *so) struct tcpcb *tp = sototcpcb(so); DEBUG_CALL("sorecvoob"); - DEBUG_ARG("so = %lx", (long)so); + DEBUG_ARG("so = %p", so); /* * We take a guess at how much urgent data has arrived. @@ -227,7 +227,7 @@ int sosendoob(struct socket *so) int n, len; DEBUG_CALL("sosendoob"); - DEBUG_ARG("so = %lx", (long)so); + DEBUG_ARG("so = %p", so); DEBUG_ARG("sb->sb_cc = %d", sb->sb_cc); if (so->so_urgc > 2048) @@ -284,7 +284,7 @@ int sowrite(struct socket *so) struct iovec iov[2]; DEBUG_CALL("sowrite"); - DEBUG_ARG("so = %lx", (long)so); + DEBUG_ARG("so = %p", so); if (so->so_urgc) { sosendoob(so); @@ -373,7 +373,7 @@ void sorecvfrom(struct socket *so) socklen_t addrlen = sizeof(struct sockaddr_in); DEBUG_CALL("sorecvfrom"); - DEBUG_ARG("so = %lx", (long)so); + DEBUG_ARG("so = %p", so); if (so->so_type == IPPROTO_ICMP) { /* This is a "ping" reply */ char buff[256]; @@ -472,8 +472,8 @@ int sosendto(struct socket *so, struct mbuf *m) struct sockaddr_in addr; DEBUG_CALL("sosendto"); - DEBUG_ARG("so = %lx", (long)so); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("so = %p", so); + DEBUG_ARG("m = %p", m); addr.sin_family = AF_INET; if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) { diff --git a/slirp/tcp_input.cpp b/slirp/tcp_input.cpp index 4a0e1179..71d94a18 100644 --- a/slirp/tcp_input.cpp +++ b/slirp/tcp_input.cpp @@ -244,8 +244,8 @@ void tcp_input(struct mbuf *m, int iphlen, struct socket *inso) /* int ts_present = 0; */ DEBUG_CALL("tcp_input"); - DEBUG_ARGS((" m = %8lx iphlen = %2d inso = %lx\n", - (long )m, iphlen, (long )inso )); + DEBUG_ARGS((" m = %p iphlen = %2d inso = %p\n", + m, iphlen, inso )); /* * If called with m == 0, then we're continuing the connect @@ -1065,8 +1065,8 @@ trimthenstep6: if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) { if (ti->ti_len == 0 && tiwin == tp->snd_wnd) { tcpstat.tcps_rcvdupack++; - DEBUG_MISC((" dup ack m = %lx so = %lx \n", - (long )m, (long )so)); + DEBUG_MISC((" dup ack m = %p so = %p \n", + m, so)); /* * If we have outstanding data (other than * a window probe), this is a completely @@ -1488,7 +1488,7 @@ void tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti) int opt, optlen; DEBUG_CALL("tcp_dooptions"); - DEBUG_ARGS((" tp = %lx cnt=%i \n", (long )tp, cnt)); + DEBUG_ARGS((" tp = %p cnt=%i \n", tp, cnt)); for (; cnt > 0; cnt -= optlen, cp += optlen) { opt = cp[0]; @@ -1597,7 +1597,7 @@ void tcp_xmit_timer(struct tcpcb *tp, int rtt) short delta; DEBUG_CALL("tcp_xmit_timer"); - DEBUG_ARG("tp = %lx", (long)tp); + DEBUG_ARG("tp = %p", tp); DEBUG_ARG("rtt = %d", rtt); tcpstat.tcps_rttupdated++; @@ -1685,7 +1685,7 @@ int tcp_mss(struct tcpcb *tp, u_int offer) int mss; DEBUG_CALL("tcp_mss"); - DEBUG_ARG("tp = %lx", (long)tp); + DEBUG_ARG("tp = %p", tp); DEBUG_ARG("offer = %d", offer); mss = min(if_mtu, if_mru) - sizeof(struct tcpiphdr); diff --git a/slirp/tcp_output.cpp b/slirp/tcp_output.cpp index ea1c69e7..47bfc00f 100644 --- a/slirp/tcp_output.cpp +++ b/slirp/tcp_output.cpp @@ -75,7 +75,7 @@ int tcp_output(struct tcpcb *tp) int idle, sendalot; DEBUG_CALL("tcp_output"); - DEBUG_ARG("tp = %lx", (long )tp); + DEBUG_ARG("tp = %p", tp); /* * Determine length of data that should be transmitted, diff --git a/slirp/tcp_subr.cpp b/slirp/tcp_subr.cpp index 554601fc..4205478c 100644 --- a/slirp/tcp_subr.cpp +++ b/slirp/tcp_subr.cpp @@ -124,9 +124,9 @@ void tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m, tcp_seq int win = 0; DEBUG_CALL("tcp_respond"); - DEBUG_ARG("tp = %lx", (long)tp); - DEBUG_ARG("ti = %lx", (long)ti); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("tp = %p", tp); + DEBUG_ARG("ti = %p", ti); + DEBUG_ARG("m = %p", m); DEBUG_ARG("ack = %u", ack); DEBUG_ARG("seq = %u", seq); DEBUG_ARG("flags = %x", flags); @@ -243,7 +243,7 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err) */ DEBUG_CALL("tcp_drop"); - DEBUG_ARG("tp = %lx", (long)tp); + DEBUG_ARG("tp = %p", tp); DEBUG_ARG("errno = %d", errno); if (TCPS_HAVERCVDSYN(tp->t_state)) { @@ -272,7 +272,7 @@ struct tcpcb *tcp_close(struct tcpcb *tp) struct mbuf *m; DEBUG_CALL("tcp_close"); - DEBUG_ARG("tp = %lx", (long )tp); + DEBUG_ARG("tp = %p", tp); /* free the reassembly queue, if any */ t = tcpfrag_list_first(tp); @@ -345,7 +345,7 @@ void tcp_sockclosed(struct tcpcb *tp) { DEBUG_CALL("tcp_sockclosed"); - DEBUG_ARG("tp = %lx", (long)tp); + DEBUG_ARG("tp = %p", tp); switch (tp->t_state) { @@ -387,7 +387,7 @@ SOCKET tcp_fconnect(struct socket *so) SOCKET ret=0; DEBUG_CALL("tcp_fconnect"); - DEBUG_ARG("so = %lx", (long )so); + DEBUG_ARG("so = %p", so); if( (ret=so->s=socket(AF_INET,SOCK_STREAM,0)) >= 0) { int opt; @@ -453,7 +453,7 @@ void tcp_connect(struct socket *inso) int opt; DEBUG_CALL("tcp_connect"); - DEBUG_ARG("inso = %lx", (long)inso); + DEBUG_ARG("inso = %p", inso); /* * If it's an SS_ACCEPTONCE socket, no need to socreate() @@ -624,8 +624,8 @@ int tcp_emu(struct socket *so, struct mbuf *m) char *bptr; DEBUG_CALL("tcp_emu"); - DEBUG_ARG("so = %lx", (long)so); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("so = %p", so); + DEBUG_ARG("m = %p", m); switch(so->so_emu) { int x, i; @@ -1237,7 +1237,7 @@ int tcp_ctl(struct socket *so) // struct socket *tmpso; DEBUG_CALL("tcp_ctl"); - DEBUG_ARG("so = %lx", (long )so); + DEBUG_ARG("so = %p", so); #if 0 /* diff --git a/slirp/udp.cpp b/slirp/udp.cpp index d04d6106..a87b658e 100644 --- a/slirp/udp.cpp +++ b/slirp/udp.cpp @@ -84,7 +84,7 @@ void udp_input(struct mbuf *m, int iphlen) struct socket *so; DEBUG_CALL("udp_input"); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("m = %p", m); DEBUG_ARG("iphlen = %d", iphlen); udpstat.udps_ipackets++; @@ -259,8 +259,8 @@ int udp_output2(struct socket *so, struct mbuf *m, int error = 0; DEBUG_CALL("udp_output"); - DEBUG_ARG("so = %lx", (long)so); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("so = %p", so); + DEBUG_ARG("m = %p", m); DEBUG_ARG("saddr = %lx", (long)saddr->sin_addr.s_addr); DEBUG_ARG("daddr = %lx", (long)daddr->sin_addr.s_addr); -- 2.47.3