]> git.lizzy.rs Git - plan9front.git/blob - sys/src/ape/lib/bsd/gai_strerror.c
ape: Add mkstemp to /sys/src/ape/lib/ap/gen/mkfile
[plan9front.git] / sys / src / ape / lib / bsd / gai_strerror.c
1 /* posix */
2 #include <sys/types.h>
3 #include <unistd.h>
4
5 /* bsd extensions */
6 #include <sys/uio.h>
7 #include <sys/socket.h>
8 #include <netinet/in.h>
9 #include <netdb.h>
10
11 char*
12 gai_strerror(int err)
13 {
14         static char *tab[] = {
15                 /* 0 */                 "No error",
16                 /* EAI_BADFLAGS */      "Invalid value for `ai_flags' field",
17                 /* EAI_NONAME */        "NAME or SERVICE is unknown",
18                 /* EAI_AGAIN */         "Temporary failure in name resolution",
19                 /* EAI_FAIL */          "Non-recoverable failure in name resolution",
20                 /* EAI_NODATA */        "No address associated with NAME",
21                 /* EAI_FAMILY */        "`ai_family' not supported",
22                 /* EAI_SOCKTYPE */      "`ai_socktype' not supported",
23                 /* EAI_SERVICE */       "SERVICE not supported for `ai_socktype'",
24                 /* EAI_ADDRFAMILY */    "Address family for NAME not supported",
25                 /* EAI_MEMORY */        "Memory allocation failure",
26                 /* EAI_SYSTEM */        "System error returned in `errno'",
27                 /* EAI_OVERFLOW */      "Argument buffer overflow",
28         };
29
30         err = -err;
31         if(err < 0 || err >= (sizeof(tab)/sizeof(tab[0])))
32                 return "Unknown error";
33         return tab[err];
34 }