5 #ifdef HAVE_FUNC_GETHOSTBYNAME_R_6
6 struct hostent
* gethostname_re (const char *host
,struct hostent
*hostbuf
,char **tmphstbuf
,size_t *hstbuflen
)
14 *tmphstbuf
= (char *)malloc (*hstbuflen
);
18 gethostbyname_r(host
,hostbuf
,*tmphstbuf
,*hstbuflen
,&hp
,&herr
))
21 /* Enlarge the buffer. */
23 *tmphstbuf
= (char *)realloc (*tmphstbuf
,*hstbuflen
);
30 #ifdef HAVE_FUNC_GETHOSTBYNAME_R_5
31 struct hostent
* gethostname_re (const char *host
,struct hostent
*hostbuf
,char **tmphstbuf
,size_t *hstbuflen
)
39 *tmphstbuf
= (char *)malloc (*hstbuflen
);
42 while ((NULL
== ( hp
=
43 gethostbyname_r(host
,hostbuf
,*tmphstbuf
,*hstbuflen
,&herr
)))
46 /* Enlarge the buffer. */
48 *tmphstbuf
= (char *)realloc (*tmphstbuf
,*hstbuflen
);
53 #ifdef HAVE_FUNC_GETHOSTBYNAME_R_3
54 struct hostent
* gethostname_re (const char *host
,struct hostent
*hostbuf
,char **tmphstbuf
,size_t *hstbuflen
)
58 *hstbuflen
= sizeof(struct hostent_data
);
59 *tmphstbuf
= (char *)malloc (*hstbuflen
);
61 else if (*hstbuflen
< sizeof(struct hostent_data
))
63 *hstbuflen
= sizeof(struct hostent_data
);
64 *tmphstbuf
= (char *)realloc(*tmphstbuf
, *hstbuflen
);
66 memset((void *)(*tmphstbuf
),0,*hstbuflen
);
68 if (0 != gethostbyname_r(host
,hostbuf
,(struct hostent_data
*)*tmphstbuf
))
73 #ifdef HAVE_FUNC_GETHOSTBYNAME_R_0
74 #warning WARNING! Your system does not have a thread-safe DNS resolver (gethostbyname_r)!
75 #warning WARNING! Name service lookups may be corrupted. Consider switching to
76 #warning WARNING! a more thread-friendly platform.
77 struct hostent
* gethostname_re (const char *host
,struct hostent
*hostbuf
,char **tmphstbuf
,size_t *hstbuflen
)
79 return gethostbyname(host
);