]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: fd: register the write side of the poller pipe as well
authorWilly Tarreau <w@1wt.eu>
Mon, 24 Jan 2022 19:33:09 +0000 (20:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 24 Jan 2022 19:41:25 +0000 (20:41 +0100)
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

index fd2e134948723d6d41f5b58ff0b02b88527a3040..cbfe73a2de42c09e25e5df16913720cb237eaa29 100644 (file)
--- 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;
 }