fix thread leak on timer_create(SIGEV_THREAD) failure
[musl] / include / netdb.h
index d915d9d..d096c78 100644 (file)
@@ -5,23 +5,15 @@
 extern "C" {
 #endif
 
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
+#include <netinet/in.h>
 
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 #define __NEED_size_t
-#endif
-
-#define __NEED_socklen_t
-#define __NEED_uint32_t
-
 #include <bits/alltypes.h>
+#endif
 
-struct addrinfo
-{
+struct addrinfo {
        int ai_flags;
        int ai_family;
        int ai_socktype;
@@ -32,8 +24,6 @@ struct addrinfo
        struct addrinfo *ai_next;
 };
 
-#define IPPORT_RESERVED 1024
-
 #define AI_PASSIVE      0x01
 #define AI_CANONNAME    0x02
 #define AI_NUMERICHOST  0x04
@@ -48,7 +38,7 @@ struct addrinfo
 #define NI_NOFQDN       0x04
 #define NI_NAMEREQD     0x08
 #define NI_DGRAM        0x10
-/*#define NI_NUMERICSCOPE */
+#define NI_NUMERICSCOPE 0x100
 
 #define EAI_BADFLAGS   -1
 #define EAI_NONAME     -2
@@ -69,16 +59,14 @@ const char *gai_strerror(int);
 
 /* Legacy functions follow (marked OBsolete in SUS) */
 
-struct netent
-{
+struct netent {
        char *n_name;
        char **n_aliases;
        int n_addrtype;
        uint32_t n_net;
 };
 
-struct hostent
-{
+struct hostent {
        char *h_name;
        char **h_aliases;
        int h_addrtype;
@@ -87,16 +75,14 @@ struct hostent
 };
 #define h_addr h_addr_list[0]
 
-struct servent
-{
+struct servent {
        char *s_name;
        char **s_aliases;
        int s_port;
        char *s_proto;
 };
 
-struct protoent
-{
+struct protoent {
        char *p_name;
        char **p_aliases;
        int p_proto;
@@ -125,8 +111,8 @@ 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)
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
 struct hostent *gethostbyname (const char *);
 struct hostent *gethostbyaddr (const void *, socklen_t, int);
 #ifdef __GNUC__
@@ -138,9 +124,11 @@ int *__h_errno_location(void);
 #define TRY_AGAIN      2
 #define NO_RECOVERY    3
 #define NO_DATA        4
+#define NO_ADDRESS     NO_DATA
 #endif
 
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void herror(const char *);
 const char *hstrerror(int);
 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 *);