]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use libuv-provided uv_{export,import} if available.
authorWitold Kręcicki <wpk@isc.org>
Fri, 31 Jan 2020 09:10:44 +0000 (10:10 +0100)
committerWitold Kręcicki <wpk@isc.org>
Tue, 18 Feb 2020 11:17:55 +0000 (12:17 +0100)
We were using our own versions of isc_uv_{export,import} functions
for multithreaded TCP listeners. Upcoming libuv version will
contain proper uv_{export,import} functions - use them if they're
available.

config.h.in
config.h.win32
configure
configure.ac
lib/isc/netmgr/uv-compat.c
lib/isc/netmgr/uv-compat.h
lib/isc/win32/libisc.def.in
win32utils/Configure

index a05f6c1cca426089b8fe48b9afc0205c82e59fd4..a280e6dafc79821bd1a5ca87f63bfb1c17cc2657 100644 (file)
 /* 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_import' function. */
+#undef HAVE_UV_IMPORT
+
 /* Use zlib library */
 #undef HAVE_ZLIB
 
index 05296c7b453f64843304c56d65bd5a3412a8acc4..84c4c8bcfbf646a9144b35b33203c19c9c52cd6f 100644 (file)
@@ -355,6 +355,15 @@ typedef __int64 off_t;
 /* Define to 1 if you have the `HMAC_CTX_reset' function. */
 @HAVE_HMAC_CTX_RESET@
 
+/* Define to 1 if you have the `uv_handle_get_data' function. */
+@HAVE_UV_HANDLE_GET_DATA@
+
+/* Define to 1 if you have the `uv_handle_set_data' function. */
+@HAVE_UV_HANDLE_SET_DATA@
+
+/* Define to 1 if you have the `uv_import' function. */
+@HAVE_UV_IMPORT@
+
 /*
  * Define to nothing if C supports flexible array members, and to 1 if it does
  * not. That way, with a declaration like `struct s { int n; double
index 775b9ae506d76436fdd1bef1cb942e4320ec05ca..57704c56df4e65313fd8cd696ed279d8ec507698 100755 (executable)
--- a/configure
+++ b/configure
@@ -15960,7 +15960,7 @@ LIBS="$LIBS $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
+for ac_func in uv_handle_get_data uv_handle_set_data uv_import
 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"
index 703880aaccca440df88344a3520d5b790cbb86da..c4df46715468127b91447b9d42db111b37f53565 100644 (file)
@@ -667,7 +667,7 @@ LIBS="$LIBS $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_handle_get_data uv_handle_set_data uv_import])
 
 #
 # flockfile is usually provided by pthreads
index 4e5531bda227e98462c5e671473fc02609d1b957..41dc0cd96d8a0d2ec673d0b77db9f6af94982dba 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <isc/util.h>
 
+#ifndef HAVE_UV_IMPORT
 /*
  * XXXWPK: This code goes into libuv internals and it's platform dependent.
  * It's ugly, we shouldn't do it, but the alternative with passing sockets
@@ -185,3 +186,5 @@ isc_uv_import(uv_stream_t *stream, isc_uv_stream_info_t *info) {
        return (uv_tcp_open(tcp, info->fd));
 }
 #endif /* ifdef WIN32 */
+
+#endif /* ifndef HAVE_UV_IMPORT */
index 662bd1cbd009ec0f8443d425388d74934a13f8c4..35d347958c01de9ca347c06bc399175d0c7bb510 100644 (file)
@@ -33,6 +33,14 @@ uv_handle_set_data(uv_handle_t *handle, void *data) {
 }
 #endif /* ifndef HAVE_UV_HANDLE_SET_DATA */
 
+#ifdef HAVE_UV_IMPORT
+
+#define isc_uv_stream_info_t uv_stream_info_t
+#define isc_uv_export       uv_export
+#define isc_uv_import       uv_import
+
+#else
+
 /*
  * These functions are not available in libuv, but they're very internal
  * to libuv. We should try to get them merged upstream.
@@ -69,3 +77,5 @@ isc_uv_import(uv_stream_t *stream, isc_uv_stream_info_t *info);
  * Imports uv_stream_info_t value into uv_stream_t to initialize a
  * shared stream.
  */
+
+#endif
index 4383854b108e74b0ea28c923aa523aebb763e65c..fcf8ad779ff90819bc4bff5ece464dde2ee608cd 100644 (file)
@@ -687,8 +687,6 @@ isc_timermgr_destroy
 isc_timermgr_poke
 isc_tm_timegm
 isc_tm_strptime
-isc_uv_export
-isc_uv_import
 isc_win32os_versioncheck
 openlog
 @IF PKCS11
index 70780e8d052580712782c96190b87b758a1c57b8..d95e70e1e8dae309dae75ff0941c5136477185a6 100644 (file)
@@ -223,6 +223,9 @@ my @substdefh = ("CONFIGARGS",
                  "HAVE_HMAC_CTX_GET_MD",
                  "HAVE_HMAC_CTX_NEW",
                  "HAVE_HMAC_CTX_RESET",
+                 "HAVE_UV_HANDLE_GET_DATA",
+                 "HAVE_UV_HANDLE_SET_DATA",
+                 "HAVE_UV_IMPORT",
     );
 
 # for platform.h
@@ -1321,6 +1324,10 @@ if ($use_libuv eq "auto") {
             last;
         }
     }
+    $configdefh{"HAVE_UV_HANDLE_SET_DATA"} = 1;
+    $configdefh{"HAVE_UV_HANDLE_GET_DATA"} = 1;
+    $configdefh{"HAVE_UV_IMPORT"} = 1;
+
 
     # If we have one use it otherwise report the error
     if ($use_libuv eq "auto") {