mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-03 05:50:39 -05:00
Cleanup the remaining of HAVE_UV_<func> macros
While cleaning up the usage of HAVE_UV_<func> macros, we forgot to
cleanup the HAVE_UV_UDP_CONNECT in the actual code and
HAVE_UV_TRANSLATE_SYS_ERROR and this was causing Windows build to fail
on uv_udp_send() because the socket was already connected and we were
falsely assuming that it was not.
The platforms with autoconf support were not affected, because we were
still checking for the functions from the configure.
(cherry picked from commit 67afea6cfc)
This commit is contained in:
parent
e773ec0b6a
commit
ce0083474e
7 changed files with 15 additions and 231 deletions
27
config.h.in
27
config.h.in
|
|
@ -504,33 +504,6 @@
|
|||
/* define if the compiler supports _Unwind_Backtrace() */
|
||||
#undef HAVE_UNWIND_BACKTRACE
|
||||
|
||||
/* Define to 1 if you have the `uv_handle_get_data' function. */
|
||||
#undef HAVE_UV_HANDLE_GET_DATA
|
||||
|
||||
/* Define to 1 if you have the `uv_handle_set_data' function. */
|
||||
#undef HAVE_UV_HANDLE_SET_DATA
|
||||
|
||||
/* Define to 1 if you have the `uv_os_getenv' function. */
|
||||
#undef HAVE_UV_OS_GETENV
|
||||
|
||||
/* Define to 1 if you have the `uv_os_setenv' function. */
|
||||
#undef HAVE_UV_OS_SETENV
|
||||
|
||||
/* Define to 1 if you have the `uv_req_get_data' function. */
|
||||
#undef HAVE_UV_REQ_GET_DATA
|
||||
|
||||
/* Define to 1 if you have the `uv_req_set_data' function. */
|
||||
#undef HAVE_UV_REQ_SET_DATA
|
||||
|
||||
/* Define to 1 if you have the `uv_sleep' function. */
|
||||
#undef HAVE_UV_SLEEP
|
||||
|
||||
/* Define to 1 if you have the `uv_translate_sys_error' function. */
|
||||
#undef HAVE_UV_TRANSLATE_SYS_ERROR
|
||||
|
||||
/* Define to 1 if you have the `uv_udp_connect' function. */
|
||||
#undef HAVE_UV_UDP_CONNECT
|
||||
|
||||
/* Use zlib library */
|
||||
#undef HAVE_ZLIB
|
||||
|
||||
|
|
|
|||
178
configure
vendored
178
configure
vendored
|
|
@ -16257,184 +16257,6 @@ $as_echo "yes" >&6; }
|
|||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CCASFLAGS_libuv_ax_save_flags=$CCASFLAGS
|
||||
|
||||
|
||||
|
||||
CFLAGS_libuv_ax_save_flags=$CFLAGS
|
||||
|
||||
|
||||
|
||||
CPPFLAGS_libuv_ax_save_flags=$CPPFLAGS
|
||||
|
||||
|
||||
|
||||
CXXFLAGS_libuv_ax_save_flags=$CXXFLAGS
|
||||
|
||||
|
||||
|
||||
ERLCFLAGS_libuv_ax_save_flags=$ERLCFLAGS
|
||||
|
||||
|
||||
|
||||
FCFLAGS_libuv_ax_save_flags=$FCFLAGS
|
||||
|
||||
|
||||
|
||||
FCLIBS_libuv_ax_save_flags=$FCLIBS
|
||||
|
||||
|
||||
|
||||
FFLAGS_libuv_ax_save_flags=$FFLAGS
|
||||
|
||||
|
||||
|
||||
FLIBS_libuv_ax_save_flags=$FLIBS
|
||||
|
||||
|
||||
|
||||
GCJFLAGS_libuv_ax_save_flags=$GCJFLAGS
|
||||
|
||||
|
||||
|
||||
JAVACFLAGS_libuv_ax_save_flags=$JAVACFLAGS
|
||||
|
||||
|
||||
|
||||
LDFLAGS_libuv_ax_save_flags=$LDFLAGS
|
||||
|
||||
|
||||
|
||||
LIBS_libuv_ax_save_flags=$LIBS
|
||||
|
||||
|
||||
|
||||
OBJCFLAGS_libuv_ax_save_flags=$OBJCFLAGS
|
||||
|
||||
|
||||
|
||||
OBJCXXFLAGS_libuv_ax_save_flags=$OBJCXXFLAGS
|
||||
|
||||
|
||||
|
||||
UPCFLAGS_libuv_ax_save_flags=$UPCFLAGS
|
||||
|
||||
|
||||
|
||||
VALAFLAGS_libuv_ax_save_flags=$VALAFLAGS
|
||||
|
||||
|
||||
|
||||
CFLAGS="$CFLAGS $LIBUV_CFLAGS"
|
||||
LIBS="$LDFLAGS $LIBUV_LIBS"
|
||||
# Those functions are only provided in newer versions of libuv, we'll be emulating them
|
||||
# for now
|
||||
for ac_func in uv_handle_get_data uv_handle_set_data
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in uv_req_get_data uv_req_set_data
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in uv_udp_connect uv_translate_sys_error uv_sleep
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in uv_os_getenv uv_os_setenv
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
CCASFLAGS=$CCASFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
CFLAGS=$CFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
CPPFLAGS=$CPPFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
CXXFLAGS=$CXXFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
ERLCFLAGS=$ERLCFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
FCFLAGS=$FCFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
FCLIBS=$FCLIBS_libuv_ax_save_flags
|
||||
|
||||
|
||||
FFLAGS=$FFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
FLIBS=$FLIBS_libuv_ax_save_flags
|
||||
|
||||
|
||||
GCJFLAGS=$GCJFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
JAVACFLAGS=$JAVACFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
LDFLAGS=$LDFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
LIBS=$LIBS_libuv_ax_save_flags
|
||||
|
||||
|
||||
OBJCFLAGS=$OBJCFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
OBJCXXFLAGS=$OBJCXXFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
UPCFLAGS=$UPCFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
VALAFLAGS=$VALAFLAGS_libuv_ax_save_flags
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# flockfile is usually provided by pthreads
|
||||
#
|
||||
|
|
|
|||
13
configure.ac
13
configure.ac
|
|
@ -727,19 +727,6 @@ AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
|
|||
AC_MSG_CHECKING(for libuv)
|
||||
PKG_CHECK_MODULES([LIBUV], [libuv >= 1.0.0], [],
|
||||
[AC_MSG_ERROR([libuv not found])])
|
||||
AC_SUBST([LIBUV_CFLAGS])
|
||||
AC_SUBST([LIBUV_LIBS])
|
||||
|
||||
AX_SAVE_FLAGS([libuv])
|
||||
CFLAGS="$CFLAGS $LIBUV_CFLAGS"
|
||||
LIBS="$LDFLAGS $LIBUV_LIBS"
|
||||
# Those functions are only provided in newer versions of libuv, we'll be emulating them
|
||||
# for now
|
||||
AC_CHECK_FUNCS([uv_handle_get_data uv_handle_set_data])
|
||||
AC_CHECK_FUNCS([uv_req_get_data uv_req_set_data])
|
||||
AC_CHECK_FUNCS([uv_udp_connect uv_translate_sys_error uv_sleep])
|
||||
AC_CHECK_FUNCS([uv_os_getenv uv_os_setenv])
|
||||
AX_RESTORE_FLAGS([libuv])
|
||||
|
||||
#
|
||||
# flockfile is usually provided by pthreads
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@ udp_send_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req,
|
|||
return (ISC_R_CANCELED);
|
||||
}
|
||||
|
||||
#ifdef HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
/*
|
||||
* If we used uv_udp_connect() (and not the shim version for
|
||||
* older versions of libuv), then the peer address has to be
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ isc_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) {
|
|||
#ifdef WIN32
|
||||
return (uv_translate_sys_error(err));
|
||||
#else /* WIN32 */
|
||||
#ifdef HAVE_UV_TRANSLATE_SYS_ERROR
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 10, 0)
|
||||
return (uv_translate_sys_error(errno));
|
||||
#else
|
||||
return (-errno);
|
||||
#endif /* HAVE_UV_TRANSLATE_SYS_ERROR */
|
||||
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 10, 0) */
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -677,7 +677,7 @@ mock_udpconnect_uv_udp_bind(void **state __attribute__((unused))) {
|
|||
RESET_RETURN;
|
||||
}
|
||||
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
static void
|
||||
mock_udpconnect_uv_udp_connect(void **state __attribute__((unused))) {
|
||||
WILL_RETURN(uv_udp_connect, UV_ENOMEM);
|
||||
|
|
@ -2098,7 +2098,7 @@ main(void) {
|
|||
nm_setup, nm_teardown),
|
||||
cmocka_unit_test_setup_teardown(mock_udpconnect_uv_udp_bind,
|
||||
nm_setup, nm_teardown),
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
cmocka_unit_test_setup_teardown(mock_udpconnect_uv_udp_connect,
|
||||
nm_setup, nm_teardown),
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#define UNIT_TESTING
|
||||
#include <cmocka.h>
|
||||
|
||||
#include "../netmgr/uv-compat.h"
|
||||
|
||||
/* uv_udp_t */
|
||||
|
||||
int
|
||||
|
|
@ -33,13 +35,13 @@ __wrap_uv_udp_open(uv_udp_t *handle, uv_os_sock_t sock);
|
|||
int
|
||||
__wrap_uv_udp_bind(uv_udp_t *handle, const struct sockaddr *addr,
|
||||
unsigned int flags);
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
int
|
||||
__wrap_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr);
|
||||
int
|
||||
__wrap_uv_udp_getpeername(const uv_udp_t *handle, struct sockaddr *name,
|
||||
int *namelen);
|
||||
#endif /* HAVE_UV_UDP_CONNECT */
|
||||
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 27, 0) */
|
||||
int
|
||||
__wrap_uv_udp_getsockname(const uv_udp_t *handle, struct sockaddr *name,
|
||||
int *namelen);
|
||||
|
|
@ -112,7 +114,7 @@ __wrap_uv_udp_bind(uv_udp_t *handle, const struct sockaddr *addr,
|
|||
}
|
||||
|
||||
static atomic_int __state_uv_udp_connect = ATOMIC_VAR_INIT(0);
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
int
|
||||
__wrap_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) {
|
||||
if (atomic_load(&__state_uv_udp_connect) == 0) {
|
||||
|
|
@ -120,10 +122,10 @@ __wrap_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) {
|
|||
}
|
||||
return (atomic_load(&__state_uv_udp_connect));
|
||||
}
|
||||
#endif /* HAVE_UV_UDP_CONNECT */
|
||||
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 27, 0) */
|
||||
|
||||
static atomic_int __state_uv_udp_getpeername = ATOMIC_VAR_INIT(0);
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
int
|
||||
__wrap_uv_udp_getpeername(const uv_udp_t *handle, struct sockaddr *name,
|
||||
int *namelen) {
|
||||
|
|
@ -132,7 +134,7 @@ __wrap_uv_udp_getpeername(const uv_udp_t *handle, struct sockaddr *name,
|
|||
}
|
||||
return (atomic_load(&__state_uv_udp_getpeername));
|
||||
}
|
||||
#endif /* HAVE_UV_UDP_CONNECT */
|
||||
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 27, 0) */
|
||||
|
||||
static atomic_int __state_uv_udp_getsockname = ATOMIC_VAR_INIT(0);
|
||||
int
|
||||
|
|
@ -270,10 +272,10 @@ __wrap_uv_fileno(const uv_handle_t *handle, uv_os_fd_t *fd) {
|
|||
|
||||
#define uv_udp_open(...) __wrap_uv_udp_open(__VA_ARGS__)
|
||||
#define uv_udp_bind(...) __wrap_uv_udp_bind(__VA_ARGS__)
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
#define uv_udp_connect(...) __wrap_uv_udp_connect(__VA_ARGS__)
|
||||
#define uv_udp_getpeername(...) __wrap_uv_udp_getpeername(__VA_ARGS__)
|
||||
#endif /* HAVE_UV_UDP_CONNECT */
|
||||
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 27, 0) */
|
||||
#define uv_udp_getsockname(...) __wrap_uv_udp_getsockname(__VA_ARGS__)
|
||||
#define uv_udp_send(...) __wrap_uv_udp_send(__VA_ARGS__)
|
||||
#define uv_udp_recv_start(...) __wrap_uv_udp_recv_start(__VA_ARGS__)
|
||||
|
|
|
|||
Loading…
Reference in a new issue