1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503
|
/* strerror() Mark Powell <medp@primagraphics.co.uk> */
/* Simple implementation derived from libiberty */
#include "config.h"
#ifndef HAVE_STRERROR
#include <errno.h>
char *strerror(int errnum)
{
static char buf[32];
switch (errnum) {
#if defined (EPERM)
case EPERM:
return "Not owner";
#endif
#if defined (ENOENT)
case ENOENT:
return "No such file or directory";
#endif
#if defined (ESRCH)
case ESRCH:
return "No such process";
#endif
#if defined (EINTR)
case EINTR:
return "Interrupted system call";
#endif
#if defined (EIO)
case EIO:
return "I/O error";
#endif
#if defined (ENXIO)
case ENXIO:
return "No such device or address";
#endif
#if defined (E2BIG)
return "Arg list too long";
#endif
#if defined (ENOEXEC)
case ENOEXEC:
return "Exec format error";
#endif
#if defined (EBADF)
case EBADF:
return "Bad file number";
#endif
#if defined (ECHILD)
case ECHILD:
return "No child processes";
#endif
#if defined (EWOULDBLOCK) /* Put before EAGAIN, sometimes aliased */
case EWOULDBLOCK:
return "Operation would block";
#endif
#if defined (EAGAIN)
#if defined (EWOULDBLOCK) && EAGAIN != EWOULDBLOCK
case EAGAIN:
return "No more processes";
#endif
#endif
#if defined (ENOMEM)
case ENOMEM:
return "Not enough space";
#endif
#if defined (EACCES)
case EACCES:
return "Permission denied";
#endif
#if defined (EFAULT)
case EFAULT:
return "Bad address";
#endif
#if defined (ENOTBLK)
case ENOTBLK:
return "Block device required";
#endif
#if defined (EBUSY)
case EBUSY:
return "Device busy";
#endif
#if defined (EEXIST)
case EEXIST:
return "File exists";
#endif
#if defined (EXDEV)
case EXDEV:
return "Cross-device link";
#endif
#if defined (ENODEV)
case ENODEV:
return "No such device";
#endif
#if defined (ENOTDIR)
case ENOTDIR:
return "Not a directory";
#endif
#if defined (EISDIR)
case EISDIR:
return "Is a directory";
#endif
#if defined (EINVAL)
case EINVAL:
return "Invalid argument";
#endif
#if defined (ENFILE)
case ENFILE:
return "File table overflow";
#endif
#if defined (EMFILE)
case EMFILE:
return "Too many open files";
#endif
#if defined (ENOTTY)
case ENOTTY:
return "Not a typewriter";
#endif
#if defined (ETXTBSY)
case ETXTBSY:
return "Text file busy";
#endif
#if defined (EFBIG)
case EFBIG:
return "File too large";
#endif
#if defined (ENOSPC)
case ENOSPC:
return "No space left on device";
#endif
#if defined (ESPIPE)
case ESPIPE:
return "Illegal seek";
#endif
#if defined (EROFS)
case EROFS:
return "Read-only file system";
#endif
#if defined (EMLINK)
case EMLINK:
return "Too many links";
#endif
#if defined (EPIPE)
case EPIPE:
return "Broken pipe";
#endif
#if defined (EDOM)
case EDOM:
return "Math argument out of domain of func";
#endif
#if defined (ERANGE)
case ERANGE:
return "Math result not representable";
#endif
#if defined (ENOMSG)
case ENOMSG:
return "No message of desired type";
#endif
#if defined (EIDRM)
case EIDRM:
return "Identifier removed";
#endif
#if defined (ECHRNG)
case ECHRNG:
return "Channel number out of range";
#endif
#if defined (EL2NSYNC)
return "Level 2 not synchronized";
#endif
#if defined (EL3HLT)
return "Level 3 halted";
#endif
#if defined (EL3RST)
return "Level 3 reset";
#endif
#if defined (ELNRNG)
case ELNRNG:
return "Link number out of range";
#endif
#if defined (EUNATCH)
case EUNATCH:
return "Protocol driver not attached";
#endif
#if defined (ENOCSI)
case ENOCSI:
return "No CSI structure available";
#endif
#if defined (EL2HLT)
return "Level 2 halted";
#endif
#if defined (EDEADLK)
case EDEADLK:
return "Deadlock condition";
#endif
#if defined (ENOLCK)
case ENOLCK:
return "No record locks available";
#endif
#if defined (EBADE)
case EBADE:
return "Invalid exchange";
#endif
#if defined (EBADR)
case EBADR:
return "Invalid request descriptor";
#endif
#if defined (EXFULL)
case EXFULL:
return "Exchange full";
#endif
#if defined (ENOANO)
case ENOANO:
return "No anode";
#endif
#if defined (EBADRQC)
case EBADRQC:
return "Invalid request code";
#endif
#if defined (EBADSLT)
case EBADSLT:
return "Invalid slot";
#endif
#if defined (EDEADLOCK)
case EDEADLOCK:
return "File locking deadlock error";
#endif
#if defined (EBFONT)
case EBFONT:
return "Bad font file format";
#endif
#if defined (ENOSTR)
case ENOSTR:
return "Device not a stream";
#endif
#if defined (ENODATA)
case ENODATA:
return "No data available";
#endif
#if defined (ETIME)
case ETIME:
return "Timer expired";
#endif
#if defined (ENOSR)
case ENOSR:
return "Out of streams resources";
#endif
#if defined (ENONET)
case ENONET:
return "Machine is not on the network";
#endif
#if defined (ENOPKG)
case ENOPKG:
return "Package not installed";
#endif
#if defined (EREMOTE)
case EREMOTE:
return "Object is remote";
#endif
#if defined (ENOLINK)
case ENOLINK:
return "Link has been severed";
#endif
#if defined (EADV)
case EADV:
return "Advertise error";
#endif
#if defined (ESRMNT)
case ESRMNT:
return "Srmount error";
#endif
#if defined (ECOMM)
case ECOMM:
return "Communication error on send";
#endif
#if defined (EPROTO)
case EPROTO:
return "Protocol error";
#endif
#if defined (EMULTIHOP)
case EMULTIHOP:
return "Multihop attempted";
#endif
#if defined (EDOTDOT)
case EDOTDOT:
return "RFS specific error";
#endif
#if defined (EBADMSG)
case EBADMSG:
return "Not a data message";
#endif
#if defined (ENAMETOOLONG)
case ENAMETOOLONG:
return "File name too long";
#endif
#if defined (EOVERFLOW)
case EOVERFLOW:
return "Value too large for defined data type";
#endif
#if defined (ENOTUNIQ)
case ENOTUNIQ:
return "Name not unique on network";
#endif
#if defined (EBADFD)
case EBADFD:
return "File descriptor in bad state";
#endif
#if defined (EREMCHG)
case EREMCHG:
return "Remote address changed";
#endif
#if defined (ELIBACC)
case ELIBACC:
return "Can not access a needed shared library";
#endif
#if defined (ELIBBAD)
case ELIBBAD:
return "Accessing a corrupted shared library";
#endif
#if defined (ELIBSCN)
case ELIBSCN:
return ".lib section in a.out corrupted";
#endif
#if defined (ELIBMAX)
case ELIBMAX:
return "Attempting to link in too many shared libraries";
#endif
#if defined (ELIBEXEC)
case ELIBEXEC:
return "Cannot exec a shared library directly";
#endif
#if defined (EILSEQ)
case EILSEQ:
return "Illegal byte sequence";
#endif
#if defined (ENOSYS)
case ENOSYS:
return "Operation not applicable";
#endif
#if defined (ELOOP)
case ELOOP:
return "Too many symbolic links encountered";
#endif
#if defined (ERESTART)
case ERESTART:
return "Interrupted system call should be restarted";
#endif
#if defined (ESTRPIPE)
case ESTRPIPE:
return "Streams pipe error";
#endif
#if defined (ENOTEMPTY)
case ENOTEMPTY:
return "Directory not empty";
#endif
#if defined (EUSERS)
case EUSERS:
return "Too many users";
#endif
#if defined (ENOTSOCK)
case ENOTSOCK:
return "Socket operation on non-socket";
#endif
#if defined (EDESTADDRREQ)
case EDESTADDRREQ:
return "Destination address required";
#endif
#if defined (EMSGSIZE)
case EMSGSIZE:
return "Message too long";
#endif
#if defined (EPROTOTYPE)
case EPROTOTYPE:
return "Protocol wrong type for socket";
#endif
#if defined (ENOPROTOOPT)
case ENOPROTOOPT:
return "Protocol not available";
#endif
#if defined (EPROTONOSUPPORT)
case EPROTONOSUPPORT:
return "Protocol not supported";
#endif
#if defined (ESOCKTNOSUPPORT)
case ESOCKTNOSUPPORT:
return "Socket type not supported";
#endif
#if defined (EOPNOTSUPP)
case EOPNOTSUPP:
return "Operation not supported on transport endpoint";
#endif
#if defined (EPFNOSUPPORT)
case EPFNOSUPPORT:
return "Protocol family not supported";
#endif
#if defined (EAFNOSUPPORT)
case EAFNOSUPPORT:
return "Address family not supported by protocol";
#endif
#if defined (EADDRINUSE)
case EADDRINUSE:
return "Address already in use";
#endif
#if defined (EADDRNOTAVAIL)
case EADDRNOTAVAIL:
return "Cannot assign requested address";
#endif
#if defined (ENETDOWN)
case ENETDOWN:
return "Network is down";
#endif
#if defined (ENETUNREACH)
case ENETUNREACH:
return "Network is unreachable";
#endif
#if defined (ENETRESET)
case ENETRESET:
return "Network dropped connection because of reset";
#endif
#if defined (ECONNABORTED)
case ECONNABORTED:
return "Software caused connection abort";
#endif
#if defined (ECONNRESET)
case ECONNRESET:
return "Connection reset by peer";
#endif
#if defined (ENOBUFS)
case ENOBUFS:
return "No buffer space available";
#endif
#if defined (EISCONN)
case EISCONN:
return "Transport endpoint is already connected";
#endif
#if defined (ENOTCONN)
case ENOTCONN:
return "Transport endpoint is not connected";
#endif
#if defined (ESHUTDOWN)
case ESHUTDOWN:
return "Cannot send after transport endpoint shutdown";
#endif
#if defined (ETOOMANYREFS)
case ETOOMANYREFS:
return "Too many references: cannot splice";
#endif
#if defined (ETIMEDOUT)
case ETIMEDOUT:
return "Connection timed out";
#endif
#if defined (ECONNREFUSED)
case ECONNREFUSED:
return "Connection refused";
#endif
#if defined (EHOSTDOWN)
case EHOSTDOWN:
return "Host is down";
#endif
#if defined (EHOSTUNREACH)
case EHOSTUNREACH:
return "No route to host";
#endif
#if defined (EALREADY)
case EALREADY:
return "Operation already in progress";
#endif
#if defined (EINPROGRESS)
case EINPROGRESS:
return "Operation now in progress";
#endif
#if defined (ESTALE)
case ESTALE:
return "Stale NFS file handle";
#endif
#if defined (EUCLEAN)
case EUCLEAN:
return "Structure needs cleaning";
#endif
#if defined (ENOTNAM)
case ENOTNAM:
return "Not a XENIX named type file";
#endif
#if defined (ENAVAIL)
case ENAVAIL:
return "No XENIX semaphores available";
#endif
#if defined (EISNAM)
case EISNAM:
return "Is a named type file";
#endif
#if defined (EREMOTEIO)
case EREMOTEIO:
return "Remote I/O error";
#endif
}
/* Fallback: just print the error number */
sprintf(buf, "Error %d", errnum);
return buf;
}
#endif /* HAVE_STRERROR */
|