]> git.ipfire.org Git - thirdparty/curl.git/commit
select: use poll() if existing, avoid poll() with no sockets
authorDaniel Stenberg <daniel@haxx.se>
Mon, 30 Sep 2024 21:43:58 +0000 (23:43 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 1 Oct 2024 13:11:50 +0000 (15:11 +0200)
commitc72cefea0fadaf4114a0036c86005ee5739ec30a
tree0e4e3b62108b9aed449964a94711f01f8a5c3b05
parent72d2090fc25fcfd5b696101521335f351c712e26
select: use poll() if existing, avoid poll() with no sockets

poll() on macOS 10.12 was deemed broken in 2016 when we discovered that
it misbehaves when provided with no sockets to wait for. The
HAVE_POLL_FINE is used to mark a poll() implementation that behaves
correctly: it *should* still wait the timeout time.

curl has therefore opted to use select() on Apple operating systems ever
since. To avoid the risk that this or other breakage cause problems.

However, using select() internally is also bad because it suffers from
problems when using file descriptors beyond 1024.

This change makes poll() used if it is present, but if there is no
sockets to wait for it avoids using poll() and instead falls back to
select() - but without any sockets to wait for there is no 1024 problem.

This removes all previous special-handling involving HAVE_POLL_FINE.

ref: https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/

Closes #15096
12 files changed:
CMake/OtherTests.cmake
CMake/Platforms/WindowsCache.cmake
CMakeLists.txt
configure.ac
lib/config-plan9.h
lib/curl_config.h.cmake
lib/select.c
m4/curl-functions.m4
src/tool_sleep.c
tests/libtest/lib518.c
tests/libtest/lib537.c
tests/server/util.c