On Wed, Nov 29, 2023 at 02:46:07PM +0100, Stefano Brivio wrote:Types size_t and ssize_t are not necessarily long, it depends on the architecture.Most LGTM, but a couple of nits: [snip]@@ -106,7 +106,7 @@ void *packet_get_do(const struct pool *p, size_t idx, size_t offset, if (p->pkt[idx].offset + len + offset > p->buf_size) { if (func) { - trace("packet offset plus length %lu from size %lu, " + trace("packet offset plus length %lu from size %zu, "The change here is certainly correct. But the remaining %lu is dubious. The value given is the sum of a uint32_t and two size_t, so it could depend on platform what exactly that will be promoted to. I think we should probably either cast the result explicitly to (size_t) and use %zu, or cast to (uint32_t) and use "%" PRIu32. [snip]diff --git a/tcp_splice.c b/tcp_splice.c index a5c1332..8d08bb4 100644 --- a/tcp_splice.c +++ b/tcp_splice.c @@ -321,7 +321,7 @@ static int tcp_splice_connect_finish(const struct ctx *c, if (fcntl(conn->pipe[side][0], F_SETPIPE_SZ, c->tcp.pipe_size)) { - trace("TCP (spliced): cannot set %d->%d pipe size to %lu", + trace("TCP (spliced): cannot set %d->%d pipe size to %zu", side, !side, c->tcp.pipe_size); } } @@ -554,7 +554,7 @@ retry: readlen = splice(conn->s[fromside], NULL, conn->pipe[fromside][1], NULL, c->tcp.pipe_size, SPLICE_F_MOVE | SPLICE_F_NONBLOCK); - trace("TCP (spliced): %li from read-side call", readlen); + trace("TCP (spliced): %zi from read-side call", readlen); if (readlen < 0) { if (errno == EINTR) goto retry; @@ -580,7 +580,7 @@ eintr: written = splice(conn->pipe[fromside][0], NULL, conn->s[!fromside], NULL, to_write, SPLICE_F_MOVE | more | SPLICE_F_NONBLOCK); - trace("TCP (spliced): %li from write-side call (passed %lu)", + trace("TCP (spliced): %zi from write-side call (passed %zu)", written, to_write);'to_write' is actually an ssize_t which would suggest %zi. However looking at the code, I think to_write probably *should* be a size_t instead./* Most common case: skip updating counters. */ @@ -718,7 +718,7 @@ static void tcp_splice_pipe_refill(const struct ctx *c) if (fcntl(splice_pipe_pool[i][0], F_SETPIPE_SZ, c->tcp.pipe_size)) { - trace("TCP (spliced): cannot set pool pipe size to %lu", + trace("TCP (spliced): cannot set pool pipe size to %zu", c->tcp.pipe_size); } }-- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson