From 3a6af1e5e80ee531ab0f0fd4d1b5cb4eb7f60bf5 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 24 Jan 2022 20:33:09 +0100 Subject: [PATCH] MINOR: fd: register the write side of the poller pipe as well The poller's pipe was only registered on the read side since we don't need to poll to write on it. But this leaves some known FDs so it's better to also register the write side with no event. This will allow to show them in "show fd" and to avoid dumping them as unhandled FDs. Note that the only other type of unhandled FDs left are: - stdin/stdout/stderr - epoll FDs The later can be registered upon startup though but at least a dummy handler would be needed to keep the fdtab clean. --- src/fd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fd.c b/src/fd.c index fd2e13494..cbfe73a2d 100644 --- a/src/fd.c +++ b/src/fd.c @@ -762,9 +762,10 @@ static int init_pollers_per_thread() poller_rd_pipe = mypipe[0]; poller_wr_pipe[tid] = mypipe[1]; fcntl(poller_rd_pipe, F_SETFL, O_NONBLOCK); - fd_insert(poller_rd_pipe, poller_pipe_io_handler, poller_pipe_io_handler, - tid_bit); + fd_insert(poller_rd_pipe, poller_pipe_io_handler, poller_pipe_io_handler, tid_bit); + fd_insert(poller_wr_pipe[tid], poller_pipe_io_handler, poller_pipe_io_handler, tid_bit); fd_want_recv(poller_rd_pipe); + fd_stop_both(poller_wr_pipe[tid]); return 1; }