From 076034345afe0dbfef3fa1a8116a64dc7d990b51 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 20 Oct 2015 21:12:08 +0000 Subject: [PATCH] Use client pointer not file descriptor in logging. --- cmd-queue.c | 4 ++-- cmd-wait-for.c | 5 ++--- server-client.c | 10 +++++----- server-fn.c | 2 +- status.c | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/cmd-queue.c b/cmd-queue.c index 1fe34dce..ff8c69cb 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -203,8 +203,8 @@ cmdq_continue(struct cmd_q *cmdq) cmdq->references++; notify_disable(); - log_debug("continuing cmdq %p: flags=%#x, client=%d", cmdq, cmdq->flags, - c != NULL ? c->ibuf.fd : -1); + log_debug("continuing cmdq %p: flags %#x, client %p", cmdq, cmdq->flags, + c); empty = TAILQ_EMPTY(&cmdq->queue); if (empty) diff --git a/cmd-wait-for.c b/cmd-wait-for.c index e38ea8f1..79e0b55e 100644 --- a/cmd-wait-for.c +++ b/cmd-wait-for.c @@ -170,12 +170,11 @@ cmd_wait_for_wait(struct cmd_q *cmdq, const char *name, wc = cmd_wait_for_add(name); if (wc->woken) { - log_debug("wait channel %s already woken (client %d)", wc->name, - c->tty.fd); + log_debug("wait channel %s already woken (%p)", wc->name, c); cmd_wait_for_remove(wc); return (CMD_RETURN_NORMAL); } - log_debug("wait channel %s not woken (client %d)", wc->name, c->tty.fd); + log_debug("wait channel %s not woken (%p)", wc->name, c); TAILQ_INSERT_TAIL(&wc->waiters, cmdq, waitentry); cmdq->references++; diff --git a/server-client.c b/server-client.c index 320389af..41ecc141 100644 --- a/server-client.c +++ b/server-client.c @@ -131,7 +131,7 @@ server_client_create(int fd) evtimer_set(&c->repeat_timer, server_client_repeat_timer, c); TAILQ_INSERT_TAIL(&clients, c, entry); - log_debug("new client %d", fd); + log_debug("new client %p", c); } /* Open client terminal if needed. */ @@ -172,7 +172,7 @@ server_client_lost(struct client *c) c->stdin_callback(c, 1, c->stdin_callback_data); TAILQ_REMOVE(&clients, c, entry); - log_debug("lost client %d", c->ibuf.fd); + log_debug("lost client %p", c); /* * If CLIENT_TERMINAL hasn't been set, then tty_init hasn't been called @@ -238,7 +238,7 @@ server_client_lost(struct client *c) void server_client_unref(struct client *c) { - log_debug("unref client %d (%d references)", c->ibuf.fd, c->references); + log_debug("unref client %p (%d references)", c, c->references); c->references--; if (c->references == 0) @@ -251,7 +251,7 @@ server_client_free(unused int fd, unused short events, void *arg) { struct client *c = arg; - log_debug("free client %d (%d references)", c->ibuf.fd, c->references); + log_debug("free client %p (%d references)", c, c->references); if (c->references == 0) free(c); @@ -998,7 +998,7 @@ server_client_msg_dispatch(struct client *c) continue; } - log_debug("got %u from client %d", imsg.hdr.type, c->ibuf.fd); + log_debug("got %u from client %p", imsg.hdr.type, c); switch (imsg.hdr.type) { case MSG_IDENTIFY_FLAGS: case MSG_IDENTIFY_TERM: diff --git a/server-fn.c b/server-fn.c index 27908fde..a31a3772 100644 --- a/server-fn.c +++ b/server-fn.c @@ -64,7 +64,7 @@ server_write_client(struct client *c, enum msgtype type, const void *buf, if (c->flags & CLIENT_BAD) return (-1); - log_debug("writing %d to client %d", type, c->ibuf.fd); + log_debug("writing %d to client %p", type, c); error = imsg_compose(ibuf, type, PROTOCOL_VERSION, -1, -1, (void *) buf, len); if (error == 1) diff --git a/status.c b/status.c index 7a1d2818..e17c1f5d 100644 --- a/status.c +++ b/status.c @@ -164,7 +164,7 @@ status_timer_callback(unused int fd, unused short events, void *arg) if (tv.tv_sec != 0) evtimer_add(&c->status_timer, &tv); - log_debug("client %d, status interval %d", c->ibuf.fd, (int)tv.tv_sec); + log_debug("client %p, status interval %d", c, (int)tv.tv_sec); } /* Start status timer for client. */