X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Fnetdb.hpp;fp=src%2Fcommon%2Fcompat%2Fnetdb.hpp;h=a8bf7e2d08d8efc3a34fdccad7260d210ce974aa;hb=7532fa3bd22e403958f46cd35c824f490d93292d;hp=0000000000000000000000000000000000000000;hpb=985aea182b618c85c51651f224abedfe367c75ee;p=lttng-tools.git diff --git a/src/common/compat/netdb.hpp b/src/common/compat/netdb.hpp new file mode 100644 index 000000000..a8bf7e2d0 --- /dev/null +++ b/src/common/compat/netdb.hpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2015 Michael Jeanson + * + * SPDX-License-Identifier: MIT + * + */ + +#ifndef _COMPAT_NETDB_H +#define _COMPAT_NETDB_H + +#include + +#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 */