Commit | Line | Data |
---|---|---|
507af6fc MJ |
1 | /* |
2 | * Copyright (C) 2015 Michael Jeanson <mjeanson@efficios.com> | |
3 | * | |
ab5be9fa | 4 | * SPDX-License-Identifier: MIT |
507af6fc | 5 | * |
507af6fc MJ |
6 | */ |
7 | ||
8 | #ifndef _COMPAT_NETDB_H | |
9 | #define _COMPAT_NETDB_H | |
10 | ||
11 | #include <netdb.h> | |
12 | ||
13 | #ifdef HAVE_GETHOSTBYNAME2 | |
28f23191 JG |
14 | static inline struct hostent *lttng_gethostbyname2(const char *name, int af) |
15 | { | |
507af6fc MJ |
16 | return gethostbyname2(name, af); |
17 | } | |
18 | #elif HAVE_GETIPNODEBYNAME | |
28f23191 JG |
19 | static inline struct hostent *lttng_gethostbyname2(const char *name, int af) |
20 | { | |
507af6fc MJ |
21 | int unused; |
22 | ||
23 | return getipnodebyname(name, af, AI_DEFAULT, &unused); | |
24 | } | |
25 | #else | |
28f23191 | 26 | #error "Missing compat for gethostbyname2()" |
507af6fc MJ |
27 | #endif |
28 | ||
29 | #endif /* _COMPAT_NETDB_H */ |