resolv_static.h 898 B

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