check_function_exists(_socket HAVE__SOCKET)
check_function_exists(_close HAVE__CLOSE)
check_function_exists(__close_nocancel HAVE___CLOSE_NOCANCEL)
+check_function_exists(recvmmsg HAVE_RECVMMSG)
+check_function_exists(sendmmsg HAVE_SENDMMSG)
if (UNIX)
find_library(DLFCN_LIBRARY dl)
HAVE_EVENTFD_UNSIGNED_INT)
endif (HAVE_EVENTFD)
+if (HAVE_RECVMMSG)
+ # Linux legacy glibc < 2.21
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+ check_prototype_definition(recvmmsg
+ "int recvmmsg(int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags, const struct timespec *__tmo)"
+ "-1"
+ "sys/types.h;sys/socket.h"
+ HAVE_RECVMMSG_CONST_TIMEOUT)
+ set(CMAKE_REQUIRED_DEFINITIONS)
+
+ # FreeBSD
+ check_prototype_definition(recvmmsg
+ "ssize_t recvmmsg(int __fd, struct mmsghdr * __restrict __vmessages, size_t __vlen, int __flags, const struct timespec * __restrict __tmo)"
+ "-1"
+ "sys/types.h;sys/socket.h"
+ HAVE_RECVMMSG_SSIZE_T_CONST_TIMEOUT)
+endif (HAVE_RECVMMSG)
+
+if (HAVE_SENDMMSG)
+ # FreeBSD
+ check_prototype_definition(sendmmsg
+ "ssize_t sendmmsg(int __fd, struct mmsghdr * __restrict __vmessages, size_t __vlen, int __flags)"
+ "-1"
+ "sys/types.h;sys/socket.h"
+ HAVE_SENDMMSG_SSIZE_T)
+endif (HAVE_SENDMMSG)
+
# IPV6
check_c_source_compiles("
#include <stdlib.h>