Commit d862045d authored by Tom Lane's avatar Tom Lane

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.
parent d8295603
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* Copyright (c) 2003, PostgreSQL Global Development Group * 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 @@ ...@@ -28,43 +28,60 @@
#endif #endif
#ifndef HAVE_STRUCT_ADDRINFO /* Various macros that ought to be in <netdb.h>, but might not be */
struct addrinfo #ifndef EAI_FAIL
{
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;
};
#define EAI_BADFLAGS -1 #define EAI_BADFLAGS -1
#define EAI_NONAME -2 #define EAI_NONAME -2
#define EAI_AGAIN -3 #define EAI_AGAIN -3
#define EAI_FAIL -4 #define EAI_FAIL -4
#define EAI_FAMILY -6 #define EAI_FAMILY -6
#define EAI_SOCKTYPE -7 #define EAI_SOCKTYPE -7
#define EAI_SERVICE -8 #define EAI_SERVICE -8
#define EAI_MEMORY -10 #define EAI_MEMORY -10
#define EAI_SYSTEM -11 #define EAI_SYSTEM -11
#endif
#ifndef AI_PASSIVE
#define AI_PASSIVE 0x0001 #define AI_PASSIVE 0x0001
#endif
#ifndef AI_NUMERICHOST
#define AI_NUMERICHOST 0x0004 #define AI_NUMERICHOST 0x0004
#endif
#ifndef NI_NUMERICHOST
#define NI_NUMERICHOST 1 #define NI_NUMERICHOST 1
#endif
#ifndef NI_NUMERICSERV
#define NI_NUMERICSERV 2 #define NI_NUMERICSERV 2
#endif /* HAVE_STRUCT_ADDRINFO */ #endif
#ifndef NI_MAXHOST #ifndef NI_MAXHOST
#define NI_MAXHOST 1025 #define NI_MAXHOST 1025
#endif
#ifndef NI_MAXSERV
#define NI_MAXSERV 32 #define NI_MAXSERV 32
#endif #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 #ifndef HAVE_GETADDRINFO
...@@ -96,6 +113,7 @@ extern const char *gai_strerror(int errcode); ...@@ -96,6 +113,7 @@ extern const char *gai_strerror(int errcode);
extern int getnameinfo(const struct sockaddr * sa, int salen, extern int getnameinfo(const struct sockaddr * sa, int salen,
char *node, int nodelen, char *node, int nodelen,
char *service, int servicelen, int flags); char *service, int servicelen, int flags);
#endif /* HAVE_GETADDRINFO */ #endif /* HAVE_GETADDRINFO */
#endif /* GETADDRINFO_H */ #endif /* GETADDRINFO_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment