]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: pollers: add a new flag to indicate pollers reporting ERR & HUP
authorWilly Tarreau <w@1wt.eu>
Thu, 28 Nov 2019 17:17:33 +0000 (18:17 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 Dec 2019 13:04:33 +0000 (14:04 +0100)
In practice it's all pollers except select(). It turns out that we're
keeping some legacy code only for select and enforcing it on all
pollers, let's offer the pollers the ability to declare that they
do not need that.

include/types/fd.h
src/ev_epoll.c
src/ev_evports.c
src/ev_kqueue.c
src/ev_poll.c

index 580e1805315c1f6e410529dd1e093056830814f4..dae1c90c9b1550c3b40287a2542d81b6dfe96aef 100644 (file)
@@ -162,7 +162,8 @@ struct fdinfo {
  *  - flags indicate what the poller supports (HAP_POLL_F_*)
  */
 
-#define HAP_POLL_F_RDHUP 0x00000001                          /* the poller notifies of HUP with reads */
+#define HAP_POLL_F_RDHUP        0x00000001                   /* the poller notifies of HUP with reads */
+#define HAP_POLL_F_ERRHUP       0x00000002                   /* the poller reports ERR and HUP */
 
 struct poller {
        void   *private;                                     /* any private data for the poller */
index dc156e58f8d6e37e23678070c624f232d7870db8..8b2c2eebeb17c6195f3912310996935d8ca9637e 100644 (file)
@@ -360,7 +360,7 @@ static void _do_register(void)
 
        p->name = "epoll";
        p->pref = 300;
-       p->flags = 0;
+       p->flags = HAP_POLL_F_ERRHUP; // note: RDHUP might be dynamically added
        p->private = NULL;
 
        p->clo  = __fd_clo;
index bde617d5f21b7a3264156060b680d320bde1c1ba..2aea201236df0ace18898e6b1c49cdc400e1957c 100644 (file)
@@ -422,7 +422,7 @@ static void _do_register(void)
 
        p->name = "evports";
        p->pref = 300;
-       p->flags = 0;
+       p->flags = HAP_POLL_F_ERRHUP;
        p->private = NULL;
 
        p->clo  = NULL;
index 98fac85202d71e7813db0d18d35cb53ca1b360df..3514f2d7b437e106e48216f2661aedd9cb0c5c54 100644 (file)
@@ -358,7 +358,7 @@ static void _do_register(void)
 
        p->name = "kqueue";
        p->pref = 300;
-       p->flags = HAP_POLL_F_RDHUP;
+       p->flags = HAP_POLL_F_RDHUP | HAP_POLL_F_ERRHUP;
        p->private = NULL;
 
        p->clo  = NULL;
index 7655ca5590e84aae74042acd256fd17a1cee3140..47ce14bbf33206763858c52d4d33ced2105df4a1 100644 (file)
@@ -328,7 +328,7 @@ static void _do_register(void)
 
        p->name = "poll";
        p->pref = 200;
-       p->flags = 0;
+       p->flags = HAP_POLL_F_ERRHUP;
        p->private = NULL;
 
        p->clo  = __fd_clo;