1#ifndef _RESOLV_STATIC_H 2#define _RESOLV_STATIC_H 3 4#include <netdb.h> 5 6/* this structure contains all the variables that were declared 7 * 'static' in the original NetBSD resolver code. 8 * 9 * this caused vast amounts of crashes and memory corruptions 10 * when the resolver was being used by multiple threads. 11 * 12 * (note: the OpenBSD/FreeBSD resolver has similar 'issues') 13 */ 14 15#define MAXALIASES 35 16#define MAXADDRS 35 17 18typedef struct res_static { 19 char* h_addr_ptrs[MAXADDRS + 1]; 20 char* host_aliases[MAXALIASES]; 21 char hostbuf[8*1024]; 22 u_int32_t host_addr[16 / sizeof(u_int32_t)]; /* IPv4 or IPv6 */ 23 FILE* hostf; 24 int stayopen; 25 const char* servent_ptr; 26 struct servent servent; 27 struct hostent host; 28} *res_static; 29 30extern res_static __res_get_static(void); 31 32#endif /* _RESOLV_STATIC_H */ 33