From 7ad4d2cc5a8446c079b601718d00eb05c468ba06 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. --- usr.bin/tmux/cmd-queue.c | 6 +++--- usr.bin/tmux/cmd-wait-for.c | 7 +++---- usr.bin/tmux/server-client.c | 12 ++++++------ usr.bin/tmux/server-fn.c | 4 ++-- usr.bin/tmux/status.c | 4 ++-- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c index bc30fe0ee5e..904425fcde3 100644 --- a/usr.bin/tmux/cmd-queue.c +++ b/usr.bin/tmux/cmd-queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-queue.c,v 1.26 2015/09/16 22:41:00 nicm Exp $ */ +/* $OpenBSD: cmd-queue.c,v 1.27 2015/10/20 21:12:08 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott @@ -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/usr.bin/tmux/cmd-wait-for.c b/usr.bin/tmux/cmd-wait-for.c index e76336df8ff..cdddf9002e2 100644 --- a/usr.bin/tmux/cmd-wait-for.c +++ b/usr.bin/tmux/cmd-wait-for.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-wait-for.c,v 1.9 2015/09/13 10:45:55 nicm Exp $ */ +/* $OpenBSD: cmd-wait-for.c,v 1.10 2015/10/20 21:12:08 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott @@ -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/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index db7bca13575..1006890ff2b 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.156 2015/10/20 14:19:27 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.157 2015/10/20 21:12:09 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -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/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c index f8ee18eb531..772999b8b22 100644 --- a/usr.bin/tmux/server-fn.c +++ b/usr.bin/tmux/server-fn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-fn.c,v 1.88 2015/09/10 08:58:14 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.89 2015/10/20 21:12:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index 0283c9f4579..d46288140e1 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.135 2015/09/14 10:25:52 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.136 2015/10/20 21:12:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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. */ -- 2.20.1