check_function_exists(gethostbyname_r HAVE_GETHOSTBYNAME_R)
check_function_exists(gethostbyname2 HAVE_GETHOSTBYNAME2)
+check_function_exists(gethostbyname2_r HAVE_GETHOSTBYNAME2_R)
check_function_exists(getprogname HAVE_GETPROGNAME)
check_function_exists(getexecname HAVE_GETEXECNAME)
/* Define to 1 if you have the `gethostbyname2' function. */
#cmakedefine HAVE_GETHOSTBYNAME2 1
+/* Define to 1 if you have the `gethostbyname2_r' function. */
+#cmakedefine HAVE_GETHOSTBYNAME2_R 1
+
#cmakedefine HAVE_GETPROGNAME 1
#cmakedefine HAVE_GETEXECNAME 1
struct hostent *(*_libc_gethostbyname)(const char *name);
#ifdef HAVE_GETHOSTBYNAME2 /* GNU extension */
struct hostent *(*_libc_gethostbyname2)(const char *name, int af);
+#endif
+#ifdef HAVE_GETHOSTBYNAME2_R /* GNU extension */
+ int (*_libc_gethostbyname2_r)(const char *name,
+ int af,
+ struct hostent *ret,
+ char *buf,
+ size_t buflen,
+ struct hostent **result,
+ int *h_errnop);
#endif
struct hostent *(*_libc_gethostbyaddr)(const void *addr, socklen_t len, int type);
}
#endif
+#ifdef HAVE_GETHOSTBYNAME2_R /* GNU extension */
+static int libc_gethostbyname2_r(const char *name,
+ int af,
+ struct hostent *ret,
+ char *buf,
+ size_t buflen,
+ struct hostent **result,
+ int *h_errnop)
+{
+ nwrap_load_lib_function(NWRAP_LIBNSL, gethostbyname2_r);
+
+ return nwrap_main_global->libc->fns->_libc_gethostbyname2_r(name,
+ af,
+ ret,
+ buf,
+ buflen,
+ result,
+ h_errnop);
+}
+#endif
+
static struct hostent *libc_gethostbyaddr(const void *addr,
socklen_t len,
int type)