00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00025 #include "plibc_private.h"
00026
00027 extern const char *errlist;
00028
00029 const char *hstrerror(int err)
00030 {
00031 char *errmsg;
00032
00033 switch(err)
00034 {
00035 case HOST_NOT_FOUND:
00036 errmsg = "Unknown host";
00037 break;
00038 case TRY_AGAIN:
00039 errmsg = "Host name lookup failure";
00040 break;
00041 case NO_RECOVERY:
00042 errmsg = "Unknown server error";
00043 break;
00044 case NO_ADDRESS:
00045 errmsg = "No address associated with name";
00046 break;
00047 case 0:
00048 errmsg = "No error";
00049 break;
00050 default:
00051 if (err < 0)
00052 errmsg = "Internal resolver error";
00053 else
00054 errmsg = "Unknown resolver error";
00055 }
00056
00057 return errmsg;
00058 }
00059
00063 char *_win_strerror(int errnum)
00064 {
00065 char *error;
00066
00067 switch (errnum)
00068 {
00069 #ifdef EPERM
00070 case EPERM:
00071 error = "Not super-user";
00072 break;
00073 #endif
00074 #ifdef ENOENT
00075 case ENOENT:
00076 error = "No such file or directory";
00077 break;
00078 #endif
00079 #ifdef ESRCH
00080 case ESRCH:
00081 error = "No such process";
00082 break;
00083 #endif
00084 #ifdef EINTR
00085 case EINTR:
00086 error = "Interrupted system call";
00087 break;
00088 #endif
00089 #ifdef EIO
00090 case EIO:
00091 error = "I/O error";
00092 break;
00093 #endif
00094 #ifdef ENXIO
00095 case ENXIO:
00096 error = "No such device or address";
00097 break;
00098 #endif
00099 #ifdef E2BIG
00100 case E2BIG:
00101 error = "Arg list too long";
00102 break;
00103 #endif
00104 #ifdef ENOEXEC
00105 case ENOEXEC:
00106 error = "Exec format error";
00107 break;
00108 #endif
00109 #ifdef EBADF
00110 case EBADF:
00111 error = "Bad file number";
00112 break;
00113 #endif
00114 #ifdef ECHILD
00115 case ECHILD:
00116 error = "No children";
00117 break;
00118 #endif
00119 #ifdef EAGAIN
00120 case EAGAIN:
00121 error = "Resource unavailable or operation would block, try again";
00122 break;
00123 #endif
00124 #ifdef ENOMEM
00125 case ENOMEM:
00126 error = "Not enough memory";
00127 break;
00128 #endif
00129 #ifdef EACCES
00130 case EACCES:
00131 error = "Permission denied";
00132 break;
00133 #endif
00134 #ifdef EFAULT
00135 case EFAULT:
00136 error = "Bad address";
00137 break;
00138 #endif
00139 #ifdef ENOTBLK
00140 case ENOTBLK:
00141 error = "Block device required";
00142 break;
00143 #endif
00144 #ifdef EBUSY
00145 case EBUSY:
00146 error = "Mount device busy";
00147 break;
00148 #endif
00149 #ifdef EEXIST
00150 case EEXIST:
00151 error = "File exists";
00152 break;
00153 #endif
00154 #ifdef EXDEV
00155 case EXDEV:
00156 error = "Cross-device link";
00157 break;
00158 #endif
00159 #ifdef ENODEV
00160 case ENODEV:
00161 error = "No such device";
00162 break;
00163 #endif
00164 #ifdef ENOTDIR
00165 case ENOTDIR:
00166 error = "Not a directory";
00167 break;
00168 #endif
00169 #ifdef EISDIR
00170 case EISDIR:
00171 error = "Is a directory";
00172 break;
00173 #endif
00174 #ifdef EINVAL
00175 case EINVAL:
00176 error = "Invalid argument";
00177 break;
00178 #endif
00179 #ifdef ENFILE
00180 case ENFILE:
00181 error = "Too many open files in system";
00182 break;
00183 #endif
00184 #ifdef EMFILE
00185 case EMFILE:
00186 error = "Too many open files";
00187 break;
00188 #endif
00189 #ifdef ENOTTY
00190 case ENOTTY:
00191 error = "Not a typewriter";
00192 break;
00193 #endif
00194 #ifdef ETXTBSY
00195 case ETXTBSY:
00196 error = "Text file busy";
00197 break;
00198 #endif
00199 #ifdef EFBIG
00200 case EFBIG:
00201 error = "File too large";
00202 break;
00203 #endif
00204 #ifdef ENOSPC
00205 case ENOSPC:
00206 error = "No space left on device";
00207 break;
00208 #endif
00209 #ifdef ESPIPE
00210 case ESPIPE:
00211 error = "Illegal seek";
00212 break;
00213 #endif
00214 #ifdef EROFS
00215 case EROFS:
00216 error = "Read only file system";
00217 break;
00218 #endif
00219 #ifdef EMLINK
00220 case EMLINK:
00221 error = "Too many links";
00222 break;
00223 #endif
00224 #ifdef EPIPE
00225 case EPIPE:
00226 error = "Broken pipe";
00227 break;
00228 #endif
00229 #ifdef EDOM
00230 case EDOM:
00231 error = "Math arg out of domain of func";
00232 break;
00233 #endif
00234 #ifdef ERANGE
00235 case ERANGE:
00236 error = "Math result not representable";
00237 break;
00238 #endif
00239 #ifdef ENOMSG
00240 case ENOMSG:
00241 error = "No message of desired type";
00242 break;
00243 #endif
00244 #ifdef EIDRM
00245 case EIDRM:
00246 error = "Identifier removed";
00247 break;
00248 #endif
00249 #ifdef ECHRNG
00250 case ECHRNG:
00251 error = "Channel number out of range";
00252 break;
00253 #endif
00254 #ifdef EL2NSYNC
00255 case EL2NSYNC:
00256 error = "Level 2 not synchronized";
00257 break;
00258 #endif
00259 #ifdef L3HLT
00260 case L3HLT:
00261 error = "Level 3 halted";
00262 break;
00263 #endif
00264 #ifdef EL3RST
00265 case EL3RST:
00266 error = "Level 3 reset";
00267 break;
00268 #endif
00269 #ifdef ELNRNG
00270 case ELNRNG:
00271 error = "Link number out of range";
00272 break;
00273 #endif
00274 #ifdef EUNATCH
00275 case EUNATCH:
00276 error = "Protocol driver not attached";
00277 break;
00278 #endif
00279 #ifdef ENOCSI
00280 case ENOCSI:
00281 error = "No CSI structure available";
00282 break;
00283 #endif
00284 #ifdef EL2HLT
00285 case EL2HLT:
00286 error = "Level 2 halted";
00287 break;
00288 #endif
00289 #ifdef ENOLCK
00290 case ENOLCK:
00291 error = "No record locks available";
00292 break;
00293 #endif
00294 #ifdef EBADE
00295 case EBADE:
00296 error = "Invalid exchange";
00297 break;
00298 #endif
00299 #ifdef EBADR
00300 case EBADR:
00301 error = "Invalid request descriptor";
00302 break;
00303 #endif
00304 #ifdef EXFULL
00305 case EXFULL:
00306 error = "Exchange full";
00307 break;
00308 #endif
00309 #ifdef ENOANO
00310 case ENOANO:
00311 error = "No anode";
00312 break;
00313 #endif
00314 #ifdef EBADRQC
00315 case EBADRQC:
00316 error = "Invalid request code";
00317 break;
00318 #endif
00319 #ifdef EBADSLT
00320 case EBADSLT:
00321 error = "Invalid slot";
00322 break;
00323 #endif
00324 #ifdef EDEADLOCK
00325 case EDEADLOCK:
00326 error = "File locking deadlock error";
00327 break;
00328 #endif
00329 #ifdef EBFONT
00330 case EBFONT:
00331 error = "Bad font file fmt";
00332 break;
00333 #endif
00334 #ifdef ENOSTR
00335 case ENOSTR:
00336 error = "Device not a stream";
00337 break;
00338 #endif
00339 #ifdef ENODATA
00340 case ENODATA:
00341 error = "No data (for no delay io)";
00342 break;
00343 #endif
00344 #ifdef ETIME
00345 case ETIME:
00346 error = "Timer expired";
00347 break;
00348 #endif
00349 #ifdef ENOSR
00350 case ENOSR:
00351 error = "Out of streams resources";
00352 break;
00353 #endif
00354 #ifdef ENONET
00355 case ENONET:
00356 error = "Machine is not on the network";
00357 break;
00358 #endif
00359 #ifdef ENOPKG
00360 case ENOPKG:
00361 error = "Package not installed";
00362 break;
00363 #endif
00364 #ifdef EREMOTE
00365 case EREMOTE:
00366 error = "The object is remote";
00367 break;
00368 #endif
00369 #ifdef ENOLINK
00370 case ENOLINK:
00371 error = "The link has been severed";
00372 break;
00373 #endif
00374 #ifdef EADV
00375 case EADV:
00376 error = "Advertise error";
00377 break;
00378 #endif
00379 #ifdef ESRMNT
00380 case ESRMNT:
00381 error = "Srmount error";
00382 break;
00383 #endif
00384 #ifdef ECOMM
00385 case ECOMM:
00386 error = "Communication error on send";
00387 break;
00388 #endif
00389 #ifdef EPROTO
00390 case EPROTO:
00391 error = "Protocol error";
00392 break;
00393 #endif
00394 #ifdef EMULTIHOP
00395 case EMULTIHOP:
00396 error = "Multihop attempted";
00397 break;
00398 #endif
00399 #ifdef ELBIN
00400 case ELBIN:
00401 error = "Inode is remote (not really error)";
00402 break;
00403 #endif
00404 #ifdef EDOTDOT
00405 case EDOTDOT:
00406 error = "Cross mount point (not really error)";
00407 break;
00408 #endif
00409 #ifdef EBADMSG
00410 case EBADMSG:
00411 error = "Trying to read unreadable message";
00412 break;
00413 #endif
00414 #ifdef ENOTUNIQ
00415 case ENOTUNIQ:
00416 error = "Given log. name not unique";
00417 break;
00418 #endif
00419 #ifdef EBADFD
00420 case EBADFD:
00421 error = "f.d. invalid for this operation";
00422 break;
00423 #endif
00424 #ifdef EREMCHG
00425 case EREMCHG:
00426 error = "Remote address changed";
00427 break;
00428 #endif
00429 #ifdef ELIBACC
00430 case ELIBACC:
00431 error = "Can't access a needed shared lib";
00432 break;
00433 #endif
00434 #ifdef ELIBBAD
00435 case ELIBBAD:
00436 error = "Accessing a corrupted shared lib";
00437 break;
00438 #endif
00439 #ifdef ELIBSCN
00440 case ELIBSCN:
00441 error = ".lib section in a.out corrupted";
00442 break;
00443 #endif
00444 #ifdef ELIBMAX
00445 case ELIBMAX:
00446 error = "Attempting to link in too many libs";
00447 break;
00448 #endif
00449 #ifdef ELIBEXEC
00450 case ELIBEXEC:
00451 error = "Attempting to exec a shared library";
00452 break;
00453 #endif
00454 #ifdef ENOSYS
00455 case ENOSYS:
00456 error = "Function not implemented";
00457 break;
00458 #endif
00459 #ifdef ENMFILE
00460 case ENMFILE:
00461 error = "No more files";
00462 break;
00463 #endif
00464 #ifdef ENOTEMPTY
00465 case ENOTEMPTY:
00466 error = "Directory not empty";
00467 break;
00468 #endif
00469 #ifdef ENAMETOOLONG
00470 case ENAMETOOLONG:
00471 error = "File or path name too long";
00472 break;
00473 #endif
00474 #ifdef ELOOP
00475 case ELOOP:
00476 error = "Too many symbolic links";
00477 break;
00478 #endif
00479 #ifdef EOPNOTSUPP
00480 case EOPNOTSUPP:
00481 error = "Operation not supported on transport endpoint";
00482 break;
00483 #endif
00484 #ifdef EPFNOSUPPORT
00485 case EPFNOSUPPORT:
00486 error = "Protocol family not supported";
00487 break;
00488 #endif
00489 #ifdef ECONNRESET
00490 case ECONNRESET:
00491 error = "Connection reset by peer";
00492 break;
00493 #endif
00494 #ifdef ENOBUFS
00495 case ENOBUFS:
00496 error = "No buffer space available";
00497 break;
00498 #endif
00499 #ifdef EAFNOSUPPORT
00500 case EAFNOSUPPORT:
00501 error = "Address family not supported by protocol family";
00502 break;
00503 #endif
00504 #ifdef EPROTOTYPE
00505 case EPROTOTYPE:
00506 error = "Protocol wrong type for socket";
00507 break;
00508 #endif
00509 #ifdef ENOTSOCK
00510 case ENOTSOCK:
00511 error = "Socket operation on non-socket";
00512 break;
00513 #endif
00514 #ifdef ENOPROTOOPT
00515 case ENOPROTOOPT:
00516 error = "Protocol not available";
00517 break;
00518 #endif
00519 #ifdef ESHUTDOWN
00520 case ESHUTDOWN:
00521 error = "Can't send after socket shutdown";
00522 break;
00523 #endif
00524 #ifdef ECONNREFUSED
00525 case ECONNREFUSED:
00526 error = "Connection refused";
00527 break;
00528 #endif
00529 #ifdef EADDRINUSE
00530 case EADDRINUSE:
00531 error = "Address already in use";
00532 break;
00533 #endif
00534 #ifdef ECONNABORTED
00535 case ECONNABORTED:
00536 error = "Connection aborted";
00537 break;
00538 #endif
00539 #ifdef ENETUNREACH
00540 case ENETUNREACH:
00541 error = "Network is unreachable";
00542 break;
00543 #endif
00544 #ifdef ENETDOWN
00545 case ENETDOWN:
00546 error = "Network interface is not configured";
00547 break;
00548 #endif
00549 #ifdef ETIMEDOUT
00550 case ETIMEDOUT:
00551 error = "Connection timed out";
00552 break;
00553 #endif
00554 #ifdef EHOSTDOWN
00555 case EHOSTDOWN:
00556 error = "Host is down";
00557 break;
00558 #endif
00559 #ifdef EHOSTUNREACH
00560 case EHOSTUNREACH:
00561 error = "Host is unreachable";
00562 break;
00563 #endif
00564 #ifdef EINPROGRESS
00565 case EINPROGRESS:
00566 error = "Connection already in progress";
00567 break;
00568 #endif
00569 #ifdef EALREADY
00570 case EALREADY:
00571 error = "Socket already connected";
00572 break;
00573 #endif
00574 #ifdef EDESTADDRREQ
00575 case EDESTADDRREQ:
00576 error = "Destination address required";
00577 break;
00578 #endif
00579 #ifdef EMSGSIZE
00580 case EMSGSIZE:
00581 error = "Message too long";
00582 break;
00583 #endif
00584 #ifdef EPROTONOSUPPORT
00585 case EPROTONOSUPPORT:
00586 error = "Unknown protocol";
00587 break;
00588 #endif
00589 #ifdef ESOCKTNOSUPPORT
00590 case ESOCKTNOSUPPORT:
00591 error = "Socket type not supported";
00592 break;
00593 #endif
00594 #ifdef EADDRNOTAVAIL
00595 case EADDRNOTAVAIL:
00596 error = "Address not available";
00597 break;
00598 #endif
00599 #ifdef ENETRESET
00600 case ENETRESET:
00601 error = "Connection aborted by network";
00602 break;
00603 #endif
00604 #ifdef EISCONN
00605 case EISCONN:
00606 error = "Socket is already connected";
00607 break;
00608 #endif
00609 #ifdef ENOTCONN
00610 case ENOTCONN:
00611 error = "Socket is not connected";
00612 break;
00613 #endif
00614 #ifdef ETOOMANYREFS
00615 case ETOOMANYREFS:
00616 error = "Too many references: cannot splice";
00617 break;
00618 #endif
00619 #ifdef EPROCLIM
00620 case EPROCLIM:
00621 error = "Too many processes";
00622 break;
00623 #endif
00624 #ifdef EUSERS
00625 case EUSERS:
00626 error = "Too many users";
00627 break;
00628 #endif
00629 #ifdef EDQUOT
00630 case EDQUOT:
00631 error = "Disk quota exceeded";
00632 break;
00633 #endif
00634 #ifdef ESTALE
00635 case ESTALE:
00636 error = "Unknown error";
00637 break;
00638 #endif
00639 #ifdef ENOTSUP
00640 case ENOTSUP:
00641 error = "Not supported";
00642 break;
00643 #endif
00644 #ifdef ENOMEDIUM
00645 case ENOMEDIUM:
00646 error = "No medium (in tape drive)";
00647 break;
00648 #endif
00649 #ifdef ENOSHARE
00650 case ENOSHARE:
00651 error = "No such host or network path";
00652 break;
00653 #endif
00654 #ifdef ECASECLASH
00655 case ECASECLASH:
00656 error = "Filename exists with different case";
00657 break;
00658 #endif
00659 case 0:
00660 error = "No error";
00661 break;
00662 default:
00663 {
00664 char szPanic[250];
00665
00666 error = "Unknown error";
00667
00668 sprintf(szPanic, "Unknown error %i in PlibC _win_strerror()\n", errnum);
00669 __plibc_panic(0, szPanic);
00670 break;
00671 }
00672 }
00673
00674 return error;
00675 }
00676
00677