summaryrefslogtreecommitdiffstats
path: root/src/ev_evports.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 05:11:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 05:11:11 +0000
commit669c3ea68099b330943d5c3215f0cf381880c3ad (patch)
treeb5fbb97171c91fb994c2c3744dd33073f8f07407 /src/ev_evports.c
parentReleasing progress-linux version 2.9.7-1~progress7.99u1. (diff)
downloadhaproxy-669c3ea68099b330943d5c3215f0cf381880c3ad.tar.xz
haproxy-669c3ea68099b330943d5c3215f0cf381880c3ad.zip
Merging upstream version 3.0.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ev_evports.c')
-rw-r--r--src/ev_evports.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ev_evports.c b/src/ev_evports.c
index 07676e6..ee357bc 100644
--- a/src/ev_evports.c
+++ b/src/ev_evports.c
@@ -185,6 +185,14 @@ static void _do_poll(struct poller *p, int exp, int wake)
do {
int timeout = (global.tune.options & GTUNE_BUSY_POLLING) ? 0 : wait_time;
int interrupted = 0;
+ /* Note: normally we should probably expect to pass
+ * global.tune.maxpollevents here so as to process multiple
+ * events at once, but it appears unreliable in tests, even
+ * starting with value 2, and it seems basically nobody's
+ * using that anymore so it's probably not worth spending days
+ * investigating this poller more to improve its performance,
+ * let's switch back to 1. --WT
+ */
nevlist = 1; /* desired number of events to be retrieved */
timeout_ts.tv_sec = (timeout / 1000);
timeout_ts.tv_nsec = (timeout % 1000) * 1000000;
@@ -194,6 +202,12 @@ static void _do_poll(struct poller *p, int exp, int wake)
evports_evlist_max,
&nevlist, /* updated to the number of events retrieved */
&timeout_ts);
+
+ /* Be careful, nevlist here is always updated by the syscall
+ * even on status == -1, so it must always be respected
+ * otherwise events are lost. Awkward API BTW, I wonder how
+ * they thought ENOSYS ought to be handled... -WT
+ */
if (status != 0) {
int e = errno;
switch (e) {
@@ -206,7 +220,7 @@ static void _do_poll(struct poller *p, int exp, int wake)
/* nevlist >= 0 */
break;
default:
- nevlist = 0;
+ /* signal or anything else */
interrupted = 1;
break;
}