quic: use send/recvmmsg when available - #14880
Conversation
|
@vszakats cmake does not detect |
|
Wouldn't we need to define If so, it would likely be better to define it globally (for platforms that support it or might need it) with |
I suppose we need to, at least when building with a backend for which send/recvmmsg can be useful. |
|
So, should I try for a define in curl_setup.h when we are on linux? |
I think setting it on the build level has some advantages over diff --git a/CMake/Platforms/WindowsCache.cmake b/CMake/Platforms/WindowsCache.cmake
index 317f21c875..57b2b40bd4 100644
--- a/CMake/Platforms/WindowsCache.cmake
+++ b/CMake/Platforms/WindowsCache.cmake
@@ -88,6 +88,7 @@ set(HAVE_FREEADDRINFO 1)
set(HAVE_FCHMOD 0)
set(HAVE_SOCKETPAIR 0)
set(HAVE_SENDMSG 0)
+set(HAVE_SENDMMSG 0)
set(HAVE_ALARM 0)
set(HAVE_FCNTL 0)
set(HAVE_GETPPID 0)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e84c3af325..d8eb3d0d77 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -192,6 +192,10 @@ cmake_dependent_option(ENABLE_THREADED_RESOLVER "Enable threaded DNS lookup"
include(PickyWarnings)
+if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") # Required for sendmmsg()
+endif()
+
option(ENABLE_DEBUG "Enable curl debug features" OFF)
option(ENABLE_CURLDEBUG "Enable TrackMemory feature" ${ENABLE_DEBUG})
@@ -1477,6 +1481,7 @@ check_symbol_exists("socketpair" "${CURL_INCLUDES}" HAVE_SOCKETPAIR)
check_symbol_exists("recv" "${CURL_INCLUDES}" HAVE_RECV)
check_symbol_exists("send" "${CURL_INCLUDES}" HAVE_SEND)
check_symbol_exists("sendmsg" "${CURL_INCLUDES}" HAVE_SENDMSG)
+check_symbol_exists("sendmmsg" "sys/socket.h" HAVE_SENDMMSG)
check_symbol_exists("select" "${CURL_INCLUDES}" HAVE_SELECT)
check_symbol_exists("strdup" "${CURL_INCLUDES};string.h" HAVE_STRDUP)
check_symbol_exists("strtok_r" "${CURL_INCLUDES};string.h" HAVE_STRTOK_R)( And something similar in configure, via case $host in
*-*-linux*)
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE";;
esac
# then detection as normal |
119cfea to
4ae6111
Compare
|
Thanks, @vszakats, incorporated that into the latest push. Hmm, cmake does not detect it and we have other fallouts... |
|
Right, this needs to be added too to make the setting propagate: --- a/lib/curl_config.h.cmake
+++ b/lib/curl_config.h.cmake
@@ -455,6 +455,9 @@
/* Define to 1 if you have the sendmsg function. */
#cmakedefine HAVE_SENDMSG 1
+/* Define to 1 if you have the sendmmsg function. */
+#cmakedefine HAVE_SENDMMSG 1
+
/* Define to 1 if you have the 'fsetxattr' function. */
#cmakedefine HAVE_FSETXATTR 1It should fix the cmake-vs-autotools check and enable As for the curl-for-win fallout, I think we're seeing the effect of #if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
# include <pthread.h>
#endifto somewhere in |
4ae6111 to
82a60e4
Compare
|
That scan-build warning needs to be fixed! |
add checks for sendmmsg in configure and CmakeLists.txt for enabling use of these functions in ngtcp2/quiche quic.
Seems unnecessary, but ubuntu scanbuild errors on this.
32854bb to
a6f3744
Compare
I do not understand the error in |
add checks for sendmmsg in configure and CmakeLists.txt for enabling use of these functions in ngtcp2/quiche quic. Closes curl#14880
Enable use of
send/recvmmsgon platforms that support it. Add checks for sendmmsg in configure and CmakeLists.txt. Will have effect forngtcp2andquicheHTTP/3.One quirk: we need to define
_GNU_SOURCEinvquic.cso thatsys/socket.hoffers the functions.Performance: scorecard testing show only a little improvement in download numbers. Mostly,
curlis only receiving 1-2 packets at a time. This might point to Caddy's inability to send packets fast enough or may be the side-effect of other system configurations.