gai_strerror.c 963 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Return a string containing some additional information after an
  3. * error from getaddrinfo().
  4. */
  5. #include <sys/types.h>
  6. #include "addrinfo.h" /* XXX should be <netdb.h> */
  7. char *
  8. gai_strerror(int err)
  9. {
  10. switch (err) {
  11. case EAI_ADDRFAMILY:return("address family for host not supported");
  12. case EAI_AGAIN: return("temporary failure in name resolution");
  13. case EAI_BADFLAGS: return("invalid flags value");
  14. case EAI_FAIL: return("non-recoverable failure in name resolution");
  15. case EAI_FAMILY: return("address family not supported");
  16. case EAI_MEMORY: return("memory allocation failure");
  17. case EAI_NODATA: return("no address associated with host");
  18. case EAI_NONAME: return("host nor service provided, or not known");
  19. case EAI_SERVICE: return("service not supported for socket type");
  20. case EAI_SOCKTYPE: return("socket type not supported");
  21. case EAI_SYSTEM: return("system error");
  22. default: return("unknown getaddrinfo() error");
  23. }
  24. }