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
tree: 0e4e3b62108b9aed449964a94711f01f8a5c3b05
  1. .circleci/
  2. .github/
  3. CMake/
  4. docs/
  5. include/
  6. lib/
  7. LICENSES/
  8. m4/
  9. packages/
  10. plan9/
  11. projects/
  12. scripts/
  13. src/
  14. tests/
  15. winbuild/
  16. .dir-locals.el
  17. .git-blame-ignore-revs
  18. .gitattributes
  19. .gitignore
  20. .mailmap
  21. acinclude.m4
  22. appveyor.sh
  23. appveyor.yml
  24. buildconf
  25. buildconf.bat
  26. CHANGES.md
  27. CMakeLists.txt
  28. configure.ac
  29. COPYING
  30. curl-config.in
  31. Dockerfile
  32. GIT-INFO.md
  33. libcurl.pc.in
  34. Makefile.am
  35. Makefile.dist
  36. README
  37. README.md
  38. RELEASE-NOTES
  39. renovate.json
  40. REUSE.toml
  41. SECURITY.md
README.md

curl logo

Curl is a command-line tool for transferring data specified with URL syntax. Learn how to use curl by reading the manpage or everything curl.

Find out how to install curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl manpage to learn how.

Open Source

curl is Open Source and is distributed under an MIT-like license.

Contact

Contact us on a suitable mailing list or use GitHub issues/ pull requests/ discussions.

All contributors to the project are listed in the THANKS document.

Commercial support

For commercial support, maybe private and dedicated help with your problems or applications using (lib)curl visit the support page.

Website

Visit the curl website for the latest news and downloads.

Source code

Download the latest source from the Git server:

git clone https://github.com/curl/curl.git

Security problems

Report suspected security problems via our HackerOne page and not in public.

Notice

Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.

Backers

Thank you to all our backers! 🙏 Become a backer.

Sponsors

Support this project by becoming a sponsor.