about summary refs log tree commit diff
path: root/include/netdb.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-08-15 15:35:32 -0400
committerRich Felker <dalias@aerifal.cx>2012-08-15 15:35:32 -0400
commit3f80afc50577dada3940b66ef5b67da2f43cc00a (patch)
treef003e434702753eaf0441b5791e687d13c4dbbb8 /include/netdb.h
parent7650390de8f72822ec0d4a9fb5b52efcf0be4698 (diff)
downloadmusl-3f80afc50577dada3940b66ef5b67da2f43cc00a.tar.gz
musl-3f80afc50577dada3940b66ef5b67da2f43cc00a.tar.xz
musl-3f80afc50577dada3940b66ef5b67da2f43cc00a.zip
improve headers to better deal with removed-in-posix-2008 features
with this patch, setting _POSIX_SOURCE, or setting _POSIX_C_SOURCE or
_XOPEN_SOURCE to an old version, will bring back the interfaces that
were removed in POSIX 2008 - at least the ones i've covered so far,
which are gethostby*, usleep, and ualarm. if there are other functions
still in widespread use that were removed for which similar changes
would be beneficial, they can be added just like this.
Diffstat (limited to 'include/netdb.h')
-rw-r--r--include/netdb.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/include/netdb.h b/include/netdb.h
index 82c78dc8..42a4b682 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -118,21 +118,30 @@ struct protoent *getprotoent (void);
 struct protoent *getprotobyname (const char *);
 struct protoent *getprotobynumber (int);
 
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE < 200809L) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE < 700)
+struct hostent *gethostbyname (const char *);
+struct hostent *gethostbyaddr (const void *, socklen_t, int);
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int *__h_errno_location(void);
+#define h_errno (*__h_errno_location())
+#define HOST_NOT_FOUND 1
+#define TRY_AGAIN      2
+#define NO_RECOVERY    3
+#define NO_DATA        4
+#endif
+
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 const char *hstrerror(int);
-struct hostent *gethostbyname (const char *);
 int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
 int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
 struct hostent *gethostbyname2(const char *, int);
-struct hostent *gethostbyaddr (const void *, socklen_t, int);
 int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);
 int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);
 int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);
-#ifdef __GNUC__
-__attribute__((const))
-#endif
-int *__h_errno_location(void);
-#define h_errno (*__h_errno_location())
 #define EAI_NODATA     -5
 #define EAI_ADDRFAMILY -9
 #define EAI_INPROGRESS -100
@@ -143,10 +152,6 @@ int *__h_errno_location(void);
 #define EAI_IDN_ENCODE -105
 #define NI_MAXHOST 255
 #define NI_MAXSERV 32
-#define HOST_NOT_FOUND 1
-#define TRY_AGAIN      2
-#define NO_RECOVERY    3
-#define NO_DATA        4
 #endif