From 11ef0837afe9c00600152dfdf5c4f73ab2bf293f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 28 Nov 2019 18:17:33 +0100 Subject: [PATCH] MINOR: pollers: add a new flag to indicate pollers reporting ERR & HUP 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 | 3 ++- src/ev_epoll.c | 2 +- src/ev_evports.c | 2 +- src/ev_kqueue.c | 2 +- src/ev_poll.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/types/fd.h b/include/types/fd.h index 580e180531..dae1c90c9b 100644 --- a/include/types/fd.h +++ b/include/types/fd.h @@ -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 */ diff --git a/src/ev_epoll.c b/src/ev_epoll.c index dc156e58f8..8b2c2eebeb 100644 --- a/src/ev_epoll.c +++ b/src/ev_epoll.c @@ -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; diff --git a/src/ev_evports.c b/src/ev_evports.c index bde617d5f2..2aea201236 100644 --- a/src/ev_evports.c +++ b/src/ev_evports.c @@ -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; diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c index 98fac85202..3514f2d7b4 100644 --- a/src/ev_kqueue.c +++ b/src/ev_kqueue.c @@ -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; diff --git a/src/ev_poll.c b/src/ev_poll.c index 7655ca5590..47ce14bbf3 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -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; -- 2.47.3