CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
+AX_LIB_SOCKET_NSL
+
# Compute minor/major/patchlevel version numbers
major_version=$(echo AC_PACKAGE_VERSION | $SED 's/^\([[0-9]]\)*\.[[0-9]]*\.[[0-9]]*.*$/\1/')
minor_version=$(echo AC_PACKAGE_VERSION | $SED 's/^[[0-9]]*\.\([[0-9]]*\)\.[[0-9]]*.*$/\1/')
gethostbyname gethostname getpagesize localtime_r memchr memset \
mkdir munmap putenv realpath rmdir socket strchr strcspn strdup \
strncasecmp strndup strnlen strpbrk strrchr strstr strtol strtoul \
- strtoull dirfd \
+ strtoull dirfd gethostbyname2 getipnodebyname \
])
# Babeltrace viewer check
fi
-AX_LIB_SOCKET_NSL
-
# Epoll check. If not present, the build will fallback on poll() API
AX_HAVE_EPOLL(
[AX_CONFIG_FEATURE_ENABLE(epoll)],
--- /dev/null
+/*
+ * Copyright (C) 2015 Michael Jeanson <mjeanson@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _COMPAT_NETDB_H
+#define _COMPAT_NETDB_H
+
+#include <netdb.h>
+
+#ifdef HAVE_GETHOSTBYNAME2
+static inline
+struct hostent *lttng_gethostbyname2(const char *name, int af) {
+ return gethostbyname2(name, af);
+}
+#elif HAVE_GETIPNODEBYNAME
+static inline
+struct hostent *lttng_gethostbyname2(const char *name, int af) {
+ int unused;
+
+ return getipnodebyname(name, af, AI_DEFAULT, &unused);
+}
+#else
+# error "Missing compat for gethostbyname2()"
+#endif
+
+#endif /* _COMPAT_NETDB_H */
#define _LGPL_SOURCE
#include <assert.h>
#include <arpa/inet.h>
-#include <netdb.h>
+#include <common/compat/netdb.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
ret = inet_pton(af, addr, buf);
if (ret < 1) {
/* We consider the dst to be an hostname or an invalid IP char */
- record = gethostbyname2(addr, af);
+ record = lttng_gethostbyname2(addr, af);
if (record == NULL) {
/* At this point, the IP or the hostname is bad */
ERR("URI parse bad hostname %s for af %d", addr, af);