Go to file
Andy Pan 23fe1a52dc
socketpair: add eventfd and use SOCK_NONBLOCK for socketpair()
Currently, we use `pipe` for `wakeup_create`, which requires ***two***
file descriptors. Furthermore, given its complexity inside, `pipe` is a
bit heavyweight for just a simple event wait/notify mechanism.

`eventfd` would be a more suitable solution for this kind of scenario,
kernel also advocates for developers to use `eventfd` instead of `pipe`
in some simple use cases:

    Applications can use an eventfd file descriptor instead of a pipe
    (see pipe(2) in all cases where a pipe is used simply to signal
    events. The kernel overhead of an eventfd file descriptor is much
    lower than that of a pipe, and only one file descriptor is required
    (versus the two required for a pipe).

This change adds the new backend of `eventfd` for `wakeup_create` and
uses it where available, eliminating the overhead of `pipe`. Also, it
optimizes the `wakeup_create` to eliminate the system calls that make
file descriptors non-blocking by moving the logic of setting
non-blocking flags on file descriptors to `socketpair.c` and using
`SOCK_NONBLOCK` for `socketpair(2)`, `EFD_NONBLOCK` for `eventfd(2)`.

Ref:
https://man7.org/linux/man-pages/man7/pipe.7.html
https://man7.org/linux/man-pages/man2/eventfd.2.html
https://man7.org/linux/man-pages/man2/socketpair.2.html
https://www.gnu.org/software/gnulib/manual/html_node/eventfd.html

Closes #13874
2024-06-04 23:45:36 +02:00
.circleci Add some basic versioning for some workflows to check whether this is detected properly 2024-05-13 22:34:46 +01:00
.github ci: update github/codeql-action digest to 2e230e8 2024-06-04 23:23:05 +02:00
.reuse reuse: migrate standalone license file to dep5 2024-05-15 14:15:25 +02:00
CMake socketpair: add eventfd and use SOCK_NONBLOCK for socketpair() 2024-06-04 23:45:36 +02:00
docs examples/threaded-ssl: remove locking callback code 2024-06-04 13:00:21 -04:00
include urlapi: add CURLU_NO_GUESS_SCHEME 2024-06-01 23:51:42 +02:00
lib socketpair: add eventfd and use SOCK_NONBLOCK for socketpair() 2024-06-04 23:45:36 +02:00
LICENSES copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
m4 autotools: Only probe for SGI MIPS compilers on IRIX 2024-05-14 10:04:27 +02:00
packages os400: sync with latest changes 2024-04-17 22:33:40 +02:00
plan9 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
projects tidy-up: use consistent casing for Windows directories 2024-05-30 14:40:12 +02:00
scripts cd2nroff: use an empty "##" to signal end of .IP sequence 2024-05-29 12:49:40 +02:00
src tool_cb_hdr: return error for failed header writes 2024-06-02 23:24:19 +02:00
tests tests: delete redundant !MSDOS guard 2024-06-04 18:47:18 +02:00
winbuild winbuild: remove outdated WIN32 defines 2024-05-24 03:23:14 -04:00
.azure-pipelines.yml CI: disable dependency tracking in most autotools builds 2024-05-27 22:25:14 +02:00
.cirrus.yml CI: reduce memory request for FreeBSD builds 2024-06-03 17:00:42 -07:00
.dcignore copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.dir-locals.el copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.git-blame-ignore-revs copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.gitattributes copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.gitignore TLS: add support for ECH (Encrypted Client Hello) 2024-04-16 08:10:53 +02:00
.mailmap .mailmap: update Gisle's preferred email 2024-04-09 08:50:07 +02:00
acinclude.m4 windows: delete redundant headers 2023-12-18 14:56:57 +00:00
appveyor.sh build: untangle UNITTESTS and DEBUGBUILD macros 2024-05-27 21:15:50 +02:00
appveyor.yml build: untangle CURLDEBUG and DEBUGBUILD macros 2024-05-28 08:12:00 +02:00
buildconf copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
buildconf.bat buildconf.bat: remove outdated groff/nroff use 2024-03-07 22:38:16 +01:00
CHANGES curl.se: new home 2020-11-04 23:59:47 +01:00
CMakeLists.txt socketpair: add eventfd and use SOCK_NONBLOCK for socketpair() 2024-06-04 23:45:36 +02:00
configure.ac socketpair: add eventfd and use SOCK_NONBLOCK for socketpair() 2024-06-04 23:45:36 +02:00
COPYING COPYING: update copyright year 2024-01-08 18:40:06 +01:00
curl-config.in curl-config: revert to backticks to support old target envs 2024-06-04 10:13:21 +02:00
Dockerfile Dockerfile: update debian digest to 911821c 2024-05-15 08:16:49 +02:00
GIT-INFO.md GIT-INFO: convert to markdown 2024-03-07 09:43:33 +01:00
libcurl.def lib: add curl_multi_waitfds 2024-04-09 16:53:40 +02:00
libcurl.pc.in copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
Makefile.am Dockerfile: for release automation and reproducibility 2024-04-16 16:53:25 +02:00
Makefile.dist Makefile.mk: drop Windows support 2023-12-16 13:12:22 +00:00
maketgz projects: drop MSVC project files for recent versions 2024-04-10 07:55:24 +02:00
README docs: minor grammar fixes 2022-09-29 10:44:12 +02:00
README.md tidy-up: mostly whitespace nits 2023-08-31 23:02:10 +00:00
RELEASE-NOTES RELEASE-NOTES: synced 2024-06-03 10:43:06 +02:00
renovate.json GHA: unify http3 workflows into one 2024-06-01 10:57:23 +02:00
SECURITY.md SECURITY-PROCESS.md. call it vulnerability disclosure policy 2023-09-14 17:04:33 +02:00

curl logo

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. 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.3 man page to learn how.

You can find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

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.

Git

To download the latest source from the Git server, do this:

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

(you will get a directory named curl created, filled with the source code)

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.