summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2003-08-07 16:45:21 +0000
committerTom Lane2003-08-07 16:45:21 +0000
commitd862045dfc9ae86358a38749863a5f94f7c2e834 (patch)
tree50117ab75c51d6be5e25d89558a00c90367d60ef
parentd8295603c8f02f66fb1388480e11e9362f1688c2 (diff)
Don't use HAVE_STRUCT_ADDRINFO as a guide to whether netdb.h defines
macros like AI_NUMERICHOST; instead, test the macros individually. Should fix recent reports of trouble on AIX and Unixware.
-rw-r--r--src/include/getaddrinfo.h50
1 files changed, 34 insertions, 16 deletions
diff --git a/src/include/getaddrinfo.h b/src/include/getaddrinfo.h
index 4a12cf4274b..36994647c36 100644
--- a/src/include/getaddrinfo.h
+++ b/src/include/getaddrinfo.h
@@ -15,7 +15,7 @@
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
- * $Id: getaddrinfo.h,v 1.8 2003/08/04 00:43:29 momjian Exp $
+ * $Id: getaddrinfo.h,v 1.9 2003/08/07 16:45:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,43 +28,60 @@
#endif
-#ifndef HAVE_STRUCT_ADDRINFO
+/* Various macros that ought to be in <netdb.h>, but might not be */
-struct addrinfo
-{
- int ai_flags;
- int ai_family;
- int ai_socktype;
- int ai_protocol;
- size_t ai_addrlen;
- struct sockaddr *ai_addr;
- char *ai_canonname;
- struct addrinfo *ai_next;
-};
+#ifndef EAI_FAIL
-#define EAI_BADFLAGS -1
+#define EAI_BADFLAGS -1
#define EAI_NONAME -2
#define EAI_AGAIN -3
#define EAI_FAIL -4
#define EAI_FAMILY -6
-#define EAI_SOCKTYPE -7
+#define EAI_SOCKTYPE -7
#define EAI_SERVICE -8
#define EAI_MEMORY -10
#define EAI_SYSTEM -11
+#endif
+
+#ifndef AI_PASSIVE
#define AI_PASSIVE 0x0001
+#endif
+#ifndef AI_NUMERICHOST
#define AI_NUMERICHOST 0x0004
+#endif
+#ifndef NI_NUMERICHOST
#define NI_NUMERICHOST 1
+#endif
+#ifndef NI_NUMERICSERV
#define NI_NUMERICSERV 2
-#endif /* HAVE_STRUCT_ADDRINFO */
+#endif
#ifndef NI_MAXHOST
#define NI_MAXHOST 1025
+#endif
+#ifndef NI_MAXSERV
#define NI_MAXSERV 32
#endif
+#ifndef HAVE_STRUCT_ADDRINFO
+
+struct addrinfo
+{
+ int ai_flags;
+ int ai_family;
+ int ai_socktype;
+ int ai_protocol;
+ size_t ai_addrlen;
+ struct sockaddr *ai_addr;
+ char *ai_canonname;
+ struct addrinfo *ai_next;
+};
+
+#endif /* HAVE_STRUCT_ADDRINFO */
+
#ifndef HAVE_GETADDRINFO
@@ -96,6 +113,7 @@ extern const char *gai_strerror(int errcode);
extern int getnameinfo(const struct sockaddr * sa, int salen,
char *node, int nodelen,
char *service, int servicelen, int flags);
+
#endif /* HAVE_GETADDRINFO */
#endif /* GETADDRINFO_H */