| 1 | #include <errno.h> |
| 2 | #include "error.h" |
| 3 | |
| 4 | #define X(e,s) if (i == e) return s; |
| 5 | |
| 6 | char *error_str(i) |
| 7 | int i; |
| 8 | { |
| 9 | X(0,"no error") |
| 10 | X(error_intr,"interrupted system call") |
| 11 | X(error_nomem,"out of memory") |
| 12 | X(error_noent,"file does not exist") |
| 13 | X(error_txtbsy,"text busy") |
| 14 | X(error_io,"input/output error") |
| 15 | X(error_exist,"file already exists") |
| 16 | X(error_timeout,"timed out") |
| 17 | X(error_inprogress,"operation in progress") |
| 18 | X(error_again,"temporary failure") |
| 19 | X(error_wouldblock,"input/output would block") |
| 20 | X(error_pipe,"broken pipe") |
| 21 | X(error_perm,"permission denied") |
| 22 | X(error_acces,"access denied") |
| 23 | #ifdef ESRCH |
| 24 | X(ESRCH,"no such process") |
| 25 | #endif |
| 26 | #ifdef ENXIO |
| 27 | X(ENXIO,"device not configured") |
| 28 | #endif |
| 29 | #ifdef E2BIG |
| 30 | X(E2BIG,"argument list too long") |
| 31 | #endif |
| 32 | #ifdef ENOEXEC |
| 33 | X(ENOEXEC,"exec format error") |
| 34 | #endif |
| 35 | #ifdef EBADF |
| 36 | X(EBADF,"file descriptor not open") |
| 37 | #endif |
| 38 | #ifdef ECHILD |
| 39 | X(ECHILD,"no child processes") |
| 40 | #endif |
| 41 | #ifdef EDEADLK |
| 42 | X(EDEADLK,"operation would cause deadlock") |
| 43 | #endif |
| 44 | #ifdef EFAULT |
| 45 | X(EFAULT,"bad address") |
| 46 | #endif |
| 47 | #ifdef ENOTBLK |
| 48 | X(ENOTBLK,"not a block device") |
| 49 | #endif |
| 50 | #ifdef EBUSY |
| 51 | X(EBUSY,"device busy") |
| 52 | #endif |
| 53 | #ifdef EXDEV |
| 54 | X(EXDEV,"cross-device link") |
| 55 | #endif |
| 56 | #ifdef ENODEV |
| 57 | X(ENODEV,"device does not support operation") |
| 58 | #endif |
| 59 | #ifdef ENOTDIR |
| 60 | X(ENOTDIR,"not a directory") |
| 61 | #endif |
| 62 | #ifdef EISDIR |
| 63 | X(EISDIR,"is a directory") |
| 64 | #endif |
| 65 | #ifdef EINVAL |
| 66 | X(EINVAL,"invalid argument") |
| 67 | #endif |
| 68 | #ifdef ENFILE |
| 69 | X(ENFILE,"system cannot open more files") |
| 70 | #endif |
| 71 | #ifdef EMFILE |
| 72 | X(EMFILE,"process cannot open more files") |
| 73 | #endif |
| 74 | #ifdef ENOTTY |
| 75 | X(ENOTTY,"not a tty") |
| 76 | #endif |
| 77 | #ifdef EFBIG |
| 78 | X(EFBIG,"file too big") |
| 79 | #endif |
| 80 | #ifdef ENOSPC |
| 81 | X(ENOSPC,"out of disk space") |
| 82 | #endif |
| 83 | #ifdef ESPIPE |
| 84 | X(ESPIPE,"unseekable descriptor") |
| 85 | #endif |
| 86 | #ifdef EROFS |
| 87 | X(EROFS,"read-only file system") |
| 88 | #endif |
| 89 | #ifdef EMLINK |
| 90 | X(EMLINK,"too many links") |
| 91 | #endif |
| 92 | #ifdef EDOM |
| 93 | X(EDOM,"input out of range") |
| 94 | #endif |
| 95 | #ifdef ERANGE |
| 96 | X(ERANGE,"output out of range") |
| 97 | #endif |
| 98 | #ifdef EALREADY |
| 99 | X(EALREADY,"operation already in progress") |
| 100 | #endif |
| 101 | #ifdef ENOTSOCK |
| 102 | X(ENOTSOCK,"not a socket") |
| 103 | #endif |
| 104 | #ifdef EDESTADDRREQ |
| 105 | X(EDESTADDRREQ,"destination address required") |
| 106 | #endif |
| 107 | #ifdef EMSGSIZE |
| 108 | X(EMSGSIZE,"message too long") |
| 109 | #endif |
| 110 | #ifdef EPROTOTYPE |
| 111 | X(EPROTOTYPE,"incorrect protocol type") |
| 112 | #endif |
| 113 | #ifdef ENOPROTOOPT |
| 114 | X(ENOPROTOOPT,"protocol not available") |
| 115 | #endif |
| 116 | #ifdef EPROTONOSUPPORT |
| 117 | X(EPROTONOSUPPORT,"protocol not supported") |
| 118 | #endif |
| 119 | #ifdef ESOCKTNOSUPPORT |
| 120 | X(ESOCKTNOSUPPORT,"socket type not supported") |
| 121 | #endif |
| 122 | #ifdef EOPNOTSUPP |
| 123 | X(EOPNOTSUPP,"operation not supported") |
| 124 | #endif |
| 125 | #ifdef EPFNOSUPPORT |
| 126 | X(EPFNOSUPPORT,"protocol family not supported") |
| 127 | #endif |
| 128 | #ifdef EAFNOSUPPORT |
| 129 | X(EAFNOSUPPORT,"address family not supported") |
| 130 | #endif |
| 131 | #ifdef EADDRINUSE |
| 132 | X(EADDRINUSE,"address already used") |
| 133 | #endif |
| 134 | #ifdef EADDRNOTAVAIL |
| 135 | X(EADDRNOTAVAIL,"address not available") |
| 136 | #endif |
| 137 | #ifdef ENETDOWN |
| 138 | X(ENETDOWN,"network down") |
| 139 | #endif |
| 140 | #ifdef ENETUNREACH |
| 141 | X(ENETUNREACH,"network unreachable") |
| 142 | #endif |
| 143 | #ifdef ENETRESET |
| 144 | X(ENETRESET,"network reset") |
| 145 | #endif |
| 146 | #ifdef ECONNABORTED |
| 147 | X(ECONNABORTED,"connection aborted") |
| 148 | #endif |
| 149 | #ifdef ECONNRESET |
| 150 | X(ECONNRESET,"connection reset") |
| 151 | #endif |
| 152 | #ifdef ENOBUFS |
| 153 | X(ENOBUFS,"out of buffer space") |
| 154 | #endif |
| 155 | #ifdef EISCONN |
| 156 | X(EISCONN,"already connected") |
| 157 | #endif |
| 158 | #ifdef ENOTCONN |
| 159 | X(ENOTCONN,"not connected") |
| 160 | #endif |
| 161 | #ifdef ESHUTDOWN |
| 162 | X(ESHUTDOWN,"socket shut down") |
| 163 | #endif |
| 164 | #ifdef ETOOMANYREFS |
| 165 | X(ETOOMANYREFS,"too many references") |
| 166 | #endif |
| 167 | #ifdef ECONNREFUSED |
| 168 | X(ECONNREFUSED,"connection refused") |
| 169 | #endif |
| 170 | #ifdef ELOOP |
| 171 | X(ELOOP,"symbolic link loop") |
| 172 | #endif |
| 173 | #ifdef ENAMETOOLONG |
| 174 | X(ENAMETOOLONG,"file name too long") |
| 175 | #endif |
| 176 | #ifdef EHOSTDOWN |
| 177 | X(EHOSTDOWN,"host down") |
| 178 | #endif |
| 179 | #ifdef EHOSTUNREACH |
| 180 | X(EHOSTUNREACH,"host unreachable") |
| 181 | #endif |
| 182 | #ifdef ENOTEMPTY |
| 183 | X(ENOTEMPTY,"directory not empty") |
| 184 | #endif |
| 185 | #ifdef EPROCLIM |
| 186 | X(EPROCLIM,"too many processes") |
| 187 | #endif |
| 188 | #ifdef EUSERS |
| 189 | X(EUSERS,"too many users") |
| 190 | #endif |
| 191 | #ifdef EDQUOT |
| 192 | X(EDQUOT,"disk quota exceeded") |
| 193 | #endif |
| 194 | #ifdef ESTALE |
| 195 | X(ESTALE,"stale NFS file handle") |
| 196 | #endif |
| 197 | #ifdef EREMOTE |
| 198 | X(EREMOTE,"too many levels of remote in path") |
| 199 | #endif |
| 200 | #ifdef EBADRPC |
| 201 | X(EBADRPC,"RPC structure is bad") |
| 202 | #endif |
| 203 | #ifdef ERPCMISMATCH |
| 204 | X(ERPCMISMATCH,"RPC version mismatch") |
| 205 | #endif |
| 206 | #ifdef EPROGUNAVAIL |
| 207 | X(EPROGUNAVAIL,"RPC program unavailable") |
| 208 | #endif |
| 209 | #ifdef EPROGMISMATCH |
| 210 | X(EPROGMISMATCH,"program version mismatch") |
| 211 | #endif |
| 212 | #ifdef EPROCUNAVAIL |
| 213 | X(EPROCUNAVAIL,"bad procedure for program") |
| 214 | #endif |
| 215 | #ifdef ENOLCK |
| 216 | X(ENOLCK,"no locks available") |
| 217 | #endif |
| 218 | #ifdef ENOSYS |
| 219 | X(ENOSYS,"system call not available") |
| 220 | #endif |
| 221 | #ifdef EFTYPE |
| 222 | X(EFTYPE,"bad file type") |
| 223 | #endif |
| 224 | #ifdef EAUTH |
| 225 | X(EAUTH,"authentication error") |
| 226 | #endif |
| 227 | #ifdef ENEEDAUTH |
| 228 | X(ENEEDAUTH,"not authenticated") |
| 229 | #endif |
| 230 | #ifdef ENOSTR |
| 231 | X(ENOSTR,"not a stream device") |
| 232 | #endif |
| 233 | #ifdef ETIME |
| 234 | X(ETIME,"timer expired") |
| 235 | #endif |
| 236 | #ifdef ENOSR |
| 237 | X(ENOSR,"out of stream resources") |
| 238 | #endif |
| 239 | #ifdef ENOMSG |
| 240 | X(ENOMSG,"no message of desired type") |
| 241 | #endif |
| 242 | #ifdef EBADMSG |
| 243 | X(EBADMSG,"bad message type") |
| 244 | #endif |
| 245 | #ifdef EIDRM |
| 246 | X(EIDRM,"identifier removed") |
| 247 | #endif |
| 248 | #ifdef ENONET |
| 249 | X(ENONET,"machine not on network") |
| 250 | #endif |
| 251 | #ifdef ERREMOTE |
| 252 | X(ERREMOTE,"object not local") |
| 253 | #endif |
| 254 | #ifdef ENOLINK |
| 255 | X(ENOLINK,"link severed") |
| 256 | #endif |
| 257 | #ifdef EADV |
| 258 | X(EADV,"advertise error") |
| 259 | #endif |
| 260 | #ifdef ESRMNT |
| 261 | X(ESRMNT,"srmount error") |
| 262 | #endif |
| 263 | #ifdef ECOMM |
| 264 | X(ECOMM,"communication error") |
| 265 | #endif |
| 266 | #ifdef EPROTO |
| 267 | X(EPROTO,"protocol error") |
| 268 | #endif |
| 269 | #ifdef EMULTIHOP |
| 270 | X(EMULTIHOP,"multihop attempted") |
| 271 | #endif |
| 272 | #ifdef EREMCHG |
| 273 | X(EREMCHG,"remote address changed") |
| 274 | #endif |
| 275 | return "unknown error"; |
| 276 | } |