Fix printf(9) format strings so that a kernel with TCPDEBUG compiles.
authorbluhm <bluhm@openbsd.org>
Tue, 23 Jan 2018 20:41:42 +0000 (20:41 +0000)
committerbluhm <bluhm@openbsd.org>
Tue, 23 Jan 2018 20:41:42 +0000 (20:41 +0000)
Mark the string variables with TCP debugging names as constant.
OK mpi@

sys/netinet/tcp_debug.c
sys/netinet/tcp_debug.h
sys/sys/protosw.h

index 717699f..7e301ec 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: tcp_debug.c,v 1.24 2017/05/18 11:38:07 mpi Exp $      */
+/*     $OpenBSD: tcp_debug.c,v 1.25 2018/01/23 20:41:42 bluhm Exp $    */
 /*     $NetBSD: tcp_debug.c,v 1.10 1996/02/13 23:43:36 christos Exp $  */
 
 /*
@@ -162,7 +162,7 @@ tcp_trace(short act, short ostate, struct tcpcb *tp, caddr_t headers,
        if (tcpconsdebug == 0)
                return;
        if (tp)
-               printf("%x %s:", tp, tcpstates[ostate]);
+               printf("%p %s:", tp, tcpstates[ostate]);
        else
                printf("???????? ");
        printf("%s ", tanames[act]);
@@ -205,10 +205,10 @@ tcp_trace(short act, short ostate, struct tcpcb *tp, caddr_t headers,
        printf("\n");
        if (tp == 0)
                return;
-       printf("\trcv_(nxt,wnd,up) (%x,%x,%x) snd_(una,nxt,max) (%x,%x,%x)\n",
+       printf("\trcv_(nxt,wnd,up) (%x,%lx,%x) snd_(una,nxt,max) (%x,%x,%x)\n",
            tp->rcv_nxt, tp->rcv_wnd, tp->rcv_up, tp->snd_una, tp->snd_nxt,
            tp->snd_max);
-       printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x)\n",
+       printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%lx)\n",
            tp->snd_wl1, tp->snd_wl2, tp->snd_wnd);
 #endif /* TCPDEBUG */
 }
index 70ce649..d7789e2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: tcp_debug.h,v 1.9 2017/05/18 11:38:07 mpi Exp $       */
+/*     $OpenBSD: tcp_debug.h,v 1.10 2018/01/23 20:41:42 bluhm Exp $    */
 /*     $NetBSD: tcp_debug.h,v 1.5 1994/06/29 06:38:38 cgd Exp $        */
 
 /*
@@ -95,7 +95,7 @@ struct        tcp_debug {
 #define        TA_DROP         4
 
 #ifdef TANAMES
-char   *tanames[] =
+const char *tanames[] =
     { "input", "output", "user", "respond", "drop" };
 #endif /* TANAMES */
 
index dac5727..4bd22c8 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: protosw.h,v 1.29 2018/01/22 20:27:28 bluhm Exp $      */
+/*     $OpenBSD: protosw.h,v 1.30 2018/01/23 20:41:42 bluhm Exp $      */
 /*     $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
 
 /*-
@@ -147,7 +147,7 @@ struct protosw {
 #define        PRU_NREQ                22
 
 #ifdef PRUREQUESTS
-char *prurequests[] = {
+const char *prurequests[] = {
        "",             "DETACH",       "BIND",         "LISTEN",
        "CONNECT",      "ACCEPT",       "DISCONNECT",   "SHUTDOWN",
        "RCVD",         "SEND",         "ABORT",        "CONTROL",