mirror of
https://github.com/curl/curl.git
synced 2025-09-11 14:42:40 +03:00
quic: use send/recvmmsg when available
add checks for sendmmsg in configure and CmakeLists.txt for enabling use of these functions in ngtcp2/quiche quic. Closes #14880
This commit is contained in:
parent
876f17ad24
commit
97c0f89bd0
|
@ -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)
|
||||
|
|
|
@ -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})
|
||||
|
||||
|
@ -1468,6 +1472,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)
|
||||
|
|
|
@ -573,6 +573,14 @@ case $host_os in
|
|||
;;
|
||||
esac
|
||||
|
||||
# In order to detect support of sendmmsg(), we need to escape the POSIX
|
||||
# jail by defining _GNU_SOURCE or <sys/socket.h> will not expose it.
|
||||
case $host_os in
|
||||
linux*)
|
||||
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Build unit tests when option --enable-debug is given.
|
||||
if test "x$want_debug" = "xyes" &&
|
||||
test "x$supports_unittests" = "xyes"; then
|
||||
|
@ -4102,6 +4110,7 @@ AC_CHECK_FUNCS([\
|
|||
pipe \
|
||||
sched_yield \
|
||||
sendmsg \
|
||||
sendmmsg \
|
||||
setlocale \
|
||||
setmode \
|
||||
setrlimit \
|
||||
|
|
|
@ -463,6 +463,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 1
|
||||
|
||||
|
|
|
@ -208,6 +208,11 @@
|
|||
/* please, do it beyond the point further indicated in this file. */
|
||||
/* ================================================================ */
|
||||
|
||||
/* Give calloc a chance to be dragging in early, so we do not redefine */
|
||||
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Disable other protocols when http is the only one desired.
|
||||
*/
|
||||
|
|
|
@ -22,18 +22,6 @@
|
|||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* WIP, experimental: use recvmmsg() on Linux
|
||||
* we have no configure check, yet
|
||||
* and also it is only available for _GNU_SOURCE, which
|
||||
* we do not use otherwise.
|
||||
#define HAVE_SENDMMSG
|
||||
*/
|
||||
#if defined(HAVE_SENDMMSG)
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/socket.h>
|
||||
#undef _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#ifdef HAVE_NETINET_UDP_H
|
||||
|
|
|
@ -169,6 +169,7 @@ static int get_address_family(curl_socket_t sockfd)
|
|||
{
|
||||
struct sockaddr addr;
|
||||
curl_socklen_t addrlen = sizeof(addr);
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
if(getsockname(sockfd, (struct sockaddr *)&addr, &addrlen) == 0)
|
||||
return addr.sa_family;
|
||||
return AF_UNSPEC;
|
||||
|
|
Loading…
Reference in New Issue
Block a user