tclPosixStr.cGo to the documentation of this file.00001 /* 00002 * tclPosixStr.c -- 00003 * 00004 * This file contains procedures that generate strings corresponding to 00005 * various POSIX-related codes, such as errno and signals. 00006 * 00007 * Copyright (c) 1991-1994 The Regents of the University of California. 00008 * Copyright (c) 1994-1996 Sun Microsystems, Inc. 00009 * 00010 * See the file "license.terms" for information on usage and redistribution 00011 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 00012 * 00013 * RCS: @(#) $Id: tclPosixStr.c,v 1.12 2005/11/07 15:16:03 dkf Exp $ 00014 */ 00015 00016 #include "tclInt.h" 00017 00018 /* 00019 *---------------------------------------------------------------------- 00020 * 00021 * Tcl_ErrnoId -- 00022 * 00023 * Return a textual identifier for the current errno value. 00024 * 00025 * Results: 00026 * This procedure returns a machine-readable textual identifier that 00027 * corresponds to the current errno value (e.g. "EPERM"). The identifier 00028 * is the same as the #define name in errno.h. 00029 * 00030 * Side effects: 00031 * None. 00032 * 00033 *---------------------------------------------------------------------- 00034 */ 00035 00036 CONST char * 00037 Tcl_ErrnoId(void) 00038 { 00039 switch (errno) { 00040 #ifdef E2BIG 00041 case E2BIG: return "E2BIG"; 00042 #endif 00043 #ifdef EACCES 00044 case EACCES: return "EACCES"; 00045 #endif 00046 #ifdef EADDRINUSE 00047 case EADDRINUSE: return "EADDRINUSE"; 00048 #endif 00049 #ifdef EADDRNOTAVAIL 00050 case EADDRNOTAVAIL: return "EADDRNOTAVAIL"; 00051 #endif 00052 #ifdef EADV 00053 case EADV: return "EADV"; 00054 #endif 00055 #ifdef EAFNOSUPPORT 00056 case EAFNOSUPPORT: return "EAFNOSUPPORT"; 00057 #endif 00058 #ifdef EAGAIN 00059 case EAGAIN: return "EAGAIN"; 00060 #endif 00061 #ifdef EALIGN 00062 case EALIGN: return "EALIGN"; 00063 #endif 00064 #if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY )) 00065 case EALREADY: return "EALREADY"; 00066 #endif 00067 #ifdef EBADE 00068 case EBADE: return "EBADE"; 00069 #endif 00070 #ifdef EBADF 00071 case EBADF: return "EBADF"; 00072 #endif 00073 #ifdef EBADFD 00074 case EBADFD: return "EBADFD"; 00075 #endif 00076 #ifdef EBADMSG 00077 case EBADMSG: return "EBADMSG"; 00078 #endif 00079 #ifdef EBADR 00080 case EBADR: return "EBADR"; 00081 #endif 00082 #ifdef EBADRPC 00083 case EBADRPC: return "EBADRPC"; 00084 #endif 00085 #ifdef EBADRQC 00086 case EBADRQC: return "EBADRQC"; 00087 #endif 00088 #ifdef EBADSLT 00089 case EBADSLT: return "EBADSLT"; 00090 #endif 00091 #ifdef EBFONT 00092 case EBFONT: return "EBFONT"; 00093 #endif 00094 #ifdef EBUSY 00095 case EBUSY: return "EBUSY"; 00096 #endif 00097 #ifdef ECHILD 00098 case ECHILD: return "ECHILD"; 00099 #endif 00100 #ifdef ECHRNG 00101 case ECHRNG: return "ECHRNG"; 00102 #endif 00103 #ifdef ECOMM 00104 case ECOMM: return "ECOMM"; 00105 #endif 00106 #ifdef ECONNABORTED 00107 case ECONNABORTED: return "ECONNABORTED"; 00108 #endif 00109 #ifdef ECONNREFUSED 00110 case ECONNREFUSED: return "ECONNREFUSED"; 00111 #endif 00112 #ifdef ECONNRESET 00113 case ECONNRESET: return "ECONNRESET"; 00114 #endif 00115 #if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) 00116 case EDEADLK: return "EDEADLK"; 00117 #endif 00118 #if defined(EDEADLOCK) && (!defined(EDEADLK) || (EDEADLOCK != EDEADLK)) 00119 case EDEADLOCK: return "EDEADLOCK"; 00120 #endif 00121 #ifdef EDESTADDRREQ 00122 case EDESTADDRREQ: return "EDESTADDRREQ"; 00123 #endif 00124 #ifdef EDIRTY 00125 case EDIRTY: return "EDIRTY"; 00126 #endif 00127 #ifdef EDOM 00128 case EDOM: return "EDOM"; 00129 #endif 00130 #ifdef EDOTDOT 00131 case EDOTDOT: return "EDOTDOT"; 00132 #endif 00133 #ifdef EDQUOT 00134 case EDQUOT: return "EDQUOT"; 00135 #endif 00136 #ifdef EDUPPKG 00137 case EDUPPKG: return "EDUPPKG"; 00138 #endif 00139 #ifdef EEXIST 00140 case EEXIST: return "EEXIST"; 00141 #endif 00142 #ifdef EFAULT 00143 case EFAULT: return "EFAULT"; 00144 #endif 00145 #ifdef EFBIG 00146 case EFBIG: return "EFBIG"; 00147 #endif 00148 #ifdef EHOSTDOWN 00149 case EHOSTDOWN: return "EHOSTDOWN"; 00150 #endif 00151 #ifdef EHOSTUNREACH 00152 case EHOSTUNREACH: return "EHOSTUNREACH"; 00153 #endif 00154 #if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS)) 00155 case EIDRM: return "EIDRM"; 00156 #endif 00157 #ifdef EINIT 00158 case EINIT: return "EINIT"; 00159 #endif 00160 #ifdef EINPROGRESS 00161 case EINPROGRESS: return "EINPROGRESS"; 00162 #endif 00163 #ifdef EINTR 00164 case EINTR: return "EINTR"; 00165 #endif 00166 #ifdef EINVAL 00167 case EINVAL: return "EINVAL"; 00168 #endif 00169 #ifdef EIO 00170 case EIO: return "EIO"; 00171 #endif 00172 #ifdef EISCONN 00173 case EISCONN: return "EISCONN"; 00174 #endif 00175 #ifdef EISDIR 00176 case EISDIR: return "EISDIR"; 00177 #endif 00178 #ifdef EISNAME 00179 case EISNAM: return "EISNAM"; 00180 #endif 00181 #ifdef ELBIN 00182 case ELBIN: return "ELBIN"; 00183 #endif 00184 #ifdef EL2HLT 00185 case EL2HLT: return "EL2HLT"; 00186 #endif 00187 #ifdef EL2NSYNC 00188 case EL2NSYNC: return "EL2NSYNC"; 00189 #endif 00190 #ifdef EL3HLT 00191 case EL3HLT: return "EL3HLT"; 00192 #endif 00193 #ifdef EL3RST 00194 case EL3RST: return "EL3RST"; 00195 #endif 00196 #ifdef ELIBACC 00197 case ELIBACC: return "ELIBACC"; 00198 #endif 00199 #ifdef ELIBBAD 00200 case ELIBBAD: return "ELIBBAD"; 00201 #endif 00202 #ifdef ELIBEXEC 00203 case ELIBEXEC: return "ELIBEXEC"; 00204 #endif 00205 #ifdef ELIBMAX 00206 case ELIBMAX: return "ELIBMAX"; 00207 #endif 00208 #ifdef ELIBSCN 00209 case ELIBSCN: return "ELIBSCN"; 00210 #endif 00211 #ifdef ELNRNG 00212 case ELNRNG: return "ELNRNG"; 00213 #endif 00214 #if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT)) 00215 case ELOOP: return "ELOOP"; 00216 #endif 00217 #ifdef EMFILE 00218 case EMFILE: return "EMFILE"; 00219 #endif 00220 #ifdef EMLINK 00221 case EMLINK: return "EMLINK"; 00222 #endif 00223 #ifdef EMSGSIZE 00224 case EMSGSIZE: return "EMSGSIZE"; 00225 #endif 00226 #ifdef EMULTIHOP 00227 case EMULTIHOP: return "EMULTIHOP"; 00228 #endif 00229 #ifdef ENAMETOOLONG 00230 case ENAMETOOLONG: return "ENAMETOOLONG"; 00231 #endif 00232 #ifdef ENAVAIL 00233 case ENAVAIL: return "ENAVAIL"; 00234 #endif 00235 #ifdef ENET 00236 case ENET: return "ENET"; 00237 #endif 00238 #ifdef ENETDOWN 00239 case ENETDOWN: return "ENETDOWN"; 00240 #endif 00241 #ifdef ENETRESET 00242 case ENETRESET: return "ENETRESET"; 00243 #endif 00244 #ifdef ENETUNREACH 00245 case ENETUNREACH: return "ENETUNREACH"; 00246 #endif 00247 #ifdef ENFILE 00248 case ENFILE: return "ENFILE"; 00249 #endif 00250 #ifdef ENOANO 00251 case ENOANO: return "ENOANO"; 00252 #endif 00253 #if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR)) 00254 case ENOBUFS: return "ENOBUFS"; 00255 #endif 00256 #ifdef ENOCSI 00257 case ENOCSI: return "ENOCSI"; 00258 #endif 00259 #if defined(ENODATA) && (!defined(ECONNREFUSED) || (ENODATA != ECONNREFUSED)) 00260 case ENODATA: return "ENODATA"; 00261 #endif 00262 #ifdef ENODEV 00263 case ENODEV: return "ENODEV"; 00264 #endif 00265 #ifdef ENOENT 00266 case ENOENT: return "ENOENT"; 00267 #endif 00268 #ifdef ENOEXEC 00269 case ENOEXEC: return "ENOEXEC"; 00270 #endif 00271 #ifdef ENOLCK 00272 case ENOLCK: return "ENOLCK"; 00273 #endif 00274 #ifdef ENOLINK 00275 case ENOLINK: return "ENOLINK"; 00276 #endif 00277 #ifdef ENOMEM 00278 case ENOMEM: return "ENOMEM"; 00279 #endif 00280 #ifdef ENOMSG 00281 case ENOMSG: return "ENOMSG"; 00282 #endif 00283 #ifdef ENONET 00284 case ENONET: return "ENONET"; 00285 #endif 00286 #ifdef ENOPKG 00287 case ENOPKG: return "ENOPKG"; 00288 #endif 00289 #ifdef ENOPROTOOPT 00290 case ENOPROTOOPT: return "ENOPROTOOPT"; 00291 #endif 00292 #ifdef ENOSPC 00293 case ENOSPC: return "ENOSPC"; 00294 #endif 00295 #if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR)) 00296 case ENOSR: return "ENOSR"; 00297 #endif 00298 #if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR)) 00299 case ENOSTR: return "ENOSTR"; 00300 #endif 00301 #ifdef ENOSYM 00302 case ENOSYM: return "ENOSYM"; 00303 #endif 00304 #ifdef ENOSYS 00305 case ENOSYS: return "ENOSYS"; 00306 #endif 00307 #ifdef ENOTBLK 00308 case ENOTBLK: return "ENOTBLK"; 00309 #endif 00310 #ifdef ENOTCONN 00311 case ENOTCONN: return "ENOTCONN"; 00312 #endif 00313 #ifdef ENOTDIR 00314 case ENOTDIR: return "ENOTDIR"; 00315 #endif 00316 #if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST)) 00317 case ENOTEMPTY: return "ENOTEMPTY"; 00318 #endif 00319 #ifdef ENOTNAM 00320 case ENOTNAM: return "ENOTNAM"; 00321 #endif 00322 #ifdef ENOTSOCK 00323 case ENOTSOCK: return "ENOTSOCK"; 00324 #endif 00325 #ifdef ENOTSUP 00326 case ENOTSUP: return "ENOTSUP"; 00327 #endif 00328 #ifdef ENOTTY 00329 case ENOTTY: return "ENOTTY"; 00330 #endif 00331 #ifdef ENOTUNIQ 00332 case ENOTUNIQ: return "ENOTUNIQ"; 00333 #endif 00334 #ifdef ENXIO 00335 case ENXIO: return "ENXIO"; 00336 #endif 00337 #if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP)) 00338 case EOPNOTSUPP: return "EOPNOTSUPP"; 00339 #endif 00340 #if defined(EOVERFLOW) && ( !defined(EFBIG) || (EOVERFLOW != EFBIG) ) && ( !defined(EINVAL) || (EOVERFLOW != EINVAL) ) 00341 case EOVERFLOW: return "EOVERFLOW"; 00342 #endif 00343 #ifdef EPERM 00344 case EPERM: return "EPERM"; 00345 #endif 00346 #if defined(EPFNOSUPPORT) && (!defined(ENOLCK) || (ENOLCK != EPFNOSUPPORT)) 00347 case EPFNOSUPPORT: return "EPFNOSUPPORT"; 00348 #endif 00349 #ifdef EPIPE 00350 case EPIPE: return "EPIPE"; 00351 #endif 00352 #ifdef EPROCLIM 00353 case EPROCLIM: return "EPROCLIM"; 00354 #endif 00355 #ifdef EPROCUNAVAIL 00356 case EPROCUNAVAIL: return "EPROCUNAVAIL"; 00357 #endif 00358 #ifdef EPROGMISMATCH 00359 case EPROGMISMATCH: return "EPROGMISMATCH"; 00360 #endif 00361 #ifdef EPROGUNAVAIL 00362 case EPROGUNAVAIL: return "EPROGUNAVAIL"; 00363 #endif 00364 #ifdef EPROTO 00365 case EPROTO: return "EPROTO"; 00366 #endif 00367 #ifdef EPROTONOSUPPORT 00368 case EPROTONOSUPPORT: return "EPROTONOSUPPORT"; 00369 #endif 00370 #ifdef EPROTOTYPE 00371 case EPROTOTYPE: return "EPROTOTYPE"; 00372 #endif 00373 #ifdef ERANGE 00374 case ERANGE: return "ERANGE"; 00375 #endif 00376 #if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED)) 00377 case EREFUSED: return "EREFUSED"; 00378 #endif 00379 #ifdef EREMCHG 00380 case EREMCHG: return "EREMCHG"; 00381 #endif 00382 #ifdef EREMDEV 00383 case EREMDEV: return "EREMDEV"; 00384 #endif 00385 #ifdef EREMOTE 00386 case EREMOTE: return "EREMOTE"; 00387 #endif 00388 #ifdef EREMOTEIO 00389 case EREMOTEIO: return "EREMOTEIO"; 00390 #endif 00391 #ifdef EREMOTERELEASE 00392 case EREMOTERELEASE: return "EREMOTERELEASE"; 00393 #endif 00394 #ifdef EROFS 00395 case EROFS: return "EROFS"; 00396 #endif 00397 #ifdef ERPCMISMATCH 00398 case ERPCMISMATCH: return "ERPCMISMATCH"; 00399 #endif 00400 #ifdef ERREMOTE 00401 case ERREMOTE: return "ERREMOTE"; 00402 #endif 00403 #ifdef ESHUTDOWN 00404 case ESHUTDOWN: return "ESHUTDOWN"; 00405 #endif 00406 #ifdef ESOCKTNOSUPPORT 00407 case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT"; 00408 #endif 00409 #ifdef ESPIPE 00410 case ESPIPE: return "ESPIPE"; 00411 #endif 00412 #ifdef ESRCH 00413 case ESRCH: return "ESRCH"; 00414 #endif 00415 #ifdef ESRMNT 00416 case ESRMNT: return "ESRMNT"; 00417 #endif 00418 #ifdef ESTALE 00419 case ESTALE: return "ESTALE"; 00420 #endif 00421 #ifdef ESUCCESS 00422 case ESUCCESS: return "ESUCCESS"; 00423 #endif 00424 #if defined(ETIME) && (!defined(ELOOP) || (ETIME != ELOOP)) 00425 case ETIME: return "ETIME"; 00426 #endif 00427 #if defined(ETIMEDOUT) && (!defined(ENOSTR) || (ETIMEDOUT != ENOSTR)) 00428 case ETIMEDOUT: return "ETIMEDOUT"; 00429 #endif 00430 #ifdef ETOOMANYREFS 00431 case ETOOMANYREFS: return "ETOOMANYREFS"; 00432 #endif 00433 #ifdef ETXTBSY 00434 case ETXTBSY: return "ETXTBSY"; 00435 #endif 00436 #ifdef EUCLEAN 00437 case EUCLEAN: return "EUCLEAN"; 00438 #endif 00439 #ifdef EUNATCH 00440 case EUNATCH: return "EUNATCH"; 00441 #endif 00442 #ifdef EUSERS 00443 case EUSERS: return "EUSERS"; 00444 #endif 00445 #ifdef EVERSION 00446 case EVERSION: return "EVERSION"; 00447 #endif 00448 #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) 00449 case EWOULDBLOCK: return "EWOULDBLOCK"; 00450 #endif 00451 #ifdef EXDEV 00452 case EXDEV: return "EXDEV"; 00453 #endif 00454 #ifdef EXFULL 00455 case EXFULL: return "EXFULL"; 00456 #endif 00457 } 00458 return "unknown error"; 00459 } 00460 00461 /* 00462 *---------------------------------------------------------------------- 00463 * 00464 * Tcl_ErrnoMsg -- 00465 * 00466 * Return a human-readable message corresponding to a given errno value. 00467 * 00468 * Results: 00469 * The return value is the standard POSIX error message for errno. This 00470 * procedure is used instead of strerror because strerror returns 00471 * slightly different values on different machines (e.g. different 00472 * capitalizations), which cause problems for things such as regression 00473 * tests. This procedure provides messages for most standard errors, then 00474 * it calls strerror for things it doesn't understand. 00475 * 00476 * Side effects: 00477 * None. 00478 * 00479 *---------------------------------------------------------------------- 00480 */ 00481 00482 CONST char * 00483 Tcl_ErrnoMsg( 00484 int err) /* Error number (such as in errno variable). */ 00485 { 00486 switch (err) { 00487 #ifdef E2BIG 00488 case E2BIG: return "argument list too long"; 00489 #endif 00490 #ifdef EACCES 00491 case EACCES: return "permission denied"; 00492 #endif 00493 #ifdef EADDRINUSE 00494 case EADDRINUSE: return "address already in use"; 00495 #endif 00496 #ifdef EADDRNOTAVAIL 00497 case EADDRNOTAVAIL: return "can't assign requested address"; 00498 #endif 00499 #ifdef EADV 00500 case EADV: return "advertise error"; 00501 #endif 00502 #ifdef EAFNOSUPPORT 00503 case EAFNOSUPPORT: return "address family not supported by protocol family"; 00504 #endif 00505 #ifdef EAGAIN 00506 case EAGAIN: return "resource temporarily unavailable"; 00507 #endif 00508 #ifdef EALIGN 00509 case EALIGN: return "EALIGN"; 00510 #endif 00511 #if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY )) 00512 case EALREADY: return "operation already in progress"; 00513 #endif 00514 #ifdef EBADE 00515 case EBADE: return "bad exchange descriptor"; 00516 #endif 00517 #ifdef EBADF 00518 case EBADF: return "bad file number"; 00519 #endif 00520 #ifdef EBADFD 00521 case EBADFD: return "file descriptor in bad state"; 00522 #endif 00523 #ifdef EBADMSG 00524 case EBADMSG: return "not a data message"; 00525 #endif 00526 #ifdef EBADR 00527 case EBADR: return "bad request descriptor"; 00528 #endif 00529 #ifdef EBADRPC 00530 case EBADRPC: return "RPC structure is bad"; 00531 #endif 00532 #ifdef EBADRQC 00533 case EBADRQC: return "bad request code"; 00534 #endif 00535 #ifdef EBADSLT 00536 case EBADSLT: return "invalid slot"; 00537 #endif 00538 #ifdef EBFONT 00539 case EBFONT: return "bad font file format"; 00540 #endif 00541 #ifdef EBUSY 00542 case EBUSY: return "file busy"; 00543 #endif 00544 #ifdef ECHILD 00545 case ECHILD: return "no children"; 00546 #endif 00547 #ifdef ECHRNG 00548 case ECHRNG: return "channel number out of range"; 00549 #endif 00550 #ifdef ECOMM 00551 case ECOMM: return "communication error on send"; 00552 #endif 00553 #ifdef ECONNABORTED 00554 case ECONNABORTED: return "software caused connection abort"; 00555 #endif 00556 #ifdef ECONNREFUSED 00557 case ECONNREFUSED: return "connection refused"; 00558 #endif 00559 #ifdef ECONNRESET 00560 case ECONNRESET: return "connection reset by peer"; 00561 #endif 00562 #if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) 00563 case EDEADLK: return "resource deadlock avoided"; 00564 #endif 00565 #if defined(EDEADLOCK) && (!defined(EDEADLK) || (EDEADLOCK != EDEADLK)) 00566 case EDEADLOCK: return "resource deadlock avoided"; 00567 #endif 00568 #ifdef EDESTADDRREQ 00569 case EDESTADDRREQ: return "destination address required"; 00570 #endif 00571 #ifdef EDIRTY 00572 case EDIRTY: return "mounting a dirty fs w/o force"; 00573 #endif 00574 #ifdef EDOM 00575 case EDOM: return "math argument out of range"; 00576 #endif 00577 #ifdef EDOTDOT 00578 case EDOTDOT: return "cross mount point"; 00579 #endif 00580 #ifdef EDQUOT 00581 case EDQUOT: return "disk quota exceeded"; 00582 #endif 00583 #ifdef EDUPPKG 00584 case EDUPPKG: return "duplicate package name"; 00585 #endif 00586 #ifdef EEXIST 00587 case EEXIST: return "file already exists"; 00588 #endif 00589 #ifdef EFAULT 00590 case EFAULT: return "bad address in system call argument"; 00591 #endif 00592 #ifdef EFBIG 00593 case EFBIG: return "file too large"; 00594 #endif 00595 #ifdef EHOSTDOWN 00596 case EHOSTDOWN: return "host is down"; 00597 #endif 00598 #ifdef EHOSTUNREACH 00599 case EHOSTUNREACH: return "host is unreachable"; 00600 #endif 00601 #if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS)) 00602 case EIDRM: return "identifier removed"; 00603 #endif 00604 #ifdef EINIT 00605 case EINIT: return "initialization error"; 00606 #endif 00607 #ifdef EINPROGRESS 00608 case EINPROGRESS: return "operation now in progress"; 00609 #endif 00610 #ifdef EINTR 00611 case EINTR: return "interrupted system call"; 00612 #endif 00613 #ifdef EINVAL 00614 case EINVAL: return "invalid argument"; 00615 #endif 00616 #ifdef EIO 00617 case EIO: return "I/O error"; 00618 #endif 00619 #ifdef EISCONN 00620 case EISCONN: return "socket is already connected"; 00621 #endif 00622 #ifdef EISDIR 00623 case EISDIR: return "illegal operation on a directory"; 00624 #endif 00625 #ifdef EISNAME 00626 case EISNAM: return "is a name file"; 00627 #endif 00628 #ifdef ELBIN 00629 case ELBIN: return "ELBIN"; 00630 #endif 00631 #ifdef EL2HLT 00632 case EL2HLT: return "level 2 halted"; 00633 #endif 00634 #ifdef EL2NSYNC 00635 case EL2NSYNC: return "level 2 not synchronized"; 00636 #endif 00637 #ifdef EL3HLT 00638 case EL3HLT: return "level 3 halted"; 00639 #endif 00640 #ifdef EL3RST 00641 case EL3RST: return "level 3 reset"; 00642 #endif 00643 #ifdef ELIBACC 00644 case ELIBACC: return "can not access a needed shared library"; 00645 #endif 00646 #ifdef ELIBBAD 00647 case ELIBBAD: return "accessing a corrupted shared library"; 00648 #endif 00649 #ifdef ELIBEXEC 00650 case ELIBEXEC: return "can not exec a shared library directly"; 00651 #endif 00652 #ifdef ELIBMAX 00653 case ELIBMAX: return 00654 "attempting to link in more shared libraries than system limit"; 00655 #endif 00656 #ifdef ELIBSCN 00657 case ELIBSCN: return ".lib section in a.out corrupted"; 00658 #endif 00659 #ifdef ELNRNG 00660 case ELNRNG: return "link number out of range"; 00661 #endif 00662 #if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT)) 00663 case ELOOP: return "too many levels of symbolic links"; 00664 #endif 00665 #ifdef EMFILE 00666 case EMFILE: return "too many open files"; 00667 #endif 00668 #ifdef EMLINK 00669 case EMLINK: return "too many links"; 00670 #endif 00671 #ifdef EMSGSIZE 00672 case EMSGSIZE: return "message too long"; 00673 #endif 00674 #ifdef EMULTIHOP 00675 case EMULTIHOP: return "multihop attempted"; 00676 #endif 00677 #ifdef ENAMETOOLONG 00678 case ENAMETOOLONG: return "file name too long"; 00679 #endif 00680 #ifdef ENAVAIL 00681 case ENAVAIL: return "not available"; 00682 #endif 00683 #ifdef ENET 00684 case ENET: return "ENET"; 00685 #endif 00686 #ifdef ENETDOWN 00687 case ENETDOWN: return "network is down"; 00688 #endif 00689 #ifdef ENETRESET 00690 case ENETRESET: return "network dropped connection on reset"; 00691 #endif 00692 #ifdef ENETUNREACH 00693 case ENETUNREACH: return "network is unreachable"; 00694 #endif 00695 #ifdef ENFILE 00696 case ENFILE: return "file table overflow"; 00697 #endif 00698 #ifdef ENOANO 00699 case ENOANO: return "anode table overflow"; 00700 #endif 00701 #if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR)) 00702 case ENOBUFS: return "no buffer space available"; 00703 #endif 00704 #ifdef ENOCSI 00705 case ENOCSI: return "no CSI structure available"; 00706 #endif 00707 #if defined(ENODATA) && (!defined(ECONNREFUSED) || (ENODATA != ECONNREFUSED)) 00708 case ENODATA: return "no data available"; 00709 #endif 00710 #ifdef ENODEV 00711 case ENODEV: return "no such device"; 00712 #endif 00713 #ifdef ENOENT 00714 case ENOENT: return "no such file or directory"; 00715 #endif 00716 #ifdef ENOEXEC 00717 case ENOEXEC: return "exec format error"; 00718 #endif 00719 #ifdef ENOLCK 00720 case ENOLCK: return "no locks available"; 00721 #endif 00722 #ifdef ENOLINK 00723 case ENOLINK: return "link has be severed"; 00724 #endif 00725 #ifdef ENOMEM 00726 case ENOMEM: return "not enough memory"; 00727 #endif 00728 #ifdef ENOMSG 00729 case ENOMSG: return "no message of desired type"; 00730 #endif 00731 #ifdef ENONET 00732 case ENONET: return "machine is not on the network"; 00733 #endif 00734 #ifdef ENOPKG 00735 case ENOPKG: return "package not installed"; 00736 #endif 00737 #ifdef ENOPROTOOPT 00738 case ENOPROTOOPT: return "bad protocol option"; 00739 #endif 00740 #ifdef ENOSPC 00741 case ENOSPC: return "no space left on device"; 00742 #endif 00743 #if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR)) 00744 case ENOSR: return "out of stream resources"; 00745 #endif 00746 #if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR)) 00747 case ENOSTR: return "not a stream device"; 00748 #endif 00749 #ifdef ENOSYM 00750 case ENOSYM: return "unresolved symbol name"; 00751 #endif 00752 #ifdef ENOSYS 00753 case ENOSYS: return "function not implemented"; 00754 #endif 00755 #ifdef ENOTBLK 00756 case ENOTBLK: return "block device required"; 00757 #endif 00758 #ifdef ENOTCONN 00759 case ENOTCONN: return "socket is not connected"; 00760 #endif 00761 #ifdef ENOTDIR 00762 case ENOTDIR: return "not a directory"; 00763 #endif 00764 #if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST)) 00765 case ENOTEMPTY: return "directory not empty"; 00766 #endif 00767 #ifdef ENOTNAM 00768 case ENOTNAM: return "not a name file"; 00769 #endif 00770 #ifdef ENOTSOCK 00771 case ENOTSOCK: return "socket operation on non-socket"; 00772 #endif 00773 #ifdef ENOTSUP 00774 case ENOTSUP: return "operation not supported"; 00775 #endif 00776 #ifdef ENOTTY 00777 case ENOTTY: return "inappropriate device for ioctl"; 00778 #endif 00779 #ifdef ENOTUNIQ 00780 case ENOTUNIQ: return "name not unique on network"; 00781 #endif 00782 #ifdef ENXIO 00783 case ENXIO: return "no such device or address"; 00784 #endif 00785 #if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP)) 00786 case EOPNOTSUPP: return "operation not supported on socket"; 00787 #endif 00788 #if defined(EOVERFLOW) && ( !defined(EFBIG) || (EOVERFLOW != EFBIG) ) && ( !defined(EINVAL) || (EOVERFLOW != EINVAL) ) 00789 case EOVERFLOW: return "file too big"; 00790 #endif 00791 #ifdef EPERM 00792 case EPERM: return "not owner"; 00793 #endif 00794 #if defined(EPFNOSUPPORT) && (!defined(ENOLCK) || (ENOLCK != EPFNOSUPPORT)) 00795 case EPFNOSUPPORT: return "protocol family not supported"; 00796 #endif 00797 #ifdef EPIPE 00798 case EPIPE: return "broken pipe"; 00799 #endif 00800 #ifdef EPROCLIM 00801 case EPROCLIM: return "too many processes"; 00802 #endif 00803 #ifdef EPROCUNAVAIL 00804 case EPROCUNAVAIL: return "bad procedure for program"; 00805 #endif 00806 #ifdef EPROGMISMATCH 00807 case EPROGMISMATCH: return "program version wrong"; 00808 #endif 00809 #ifdef EPROGUNAVAIL 00810 case EPROGUNAVAIL: return "RPC program not available"; 00811 #endif 00812 #ifdef EPROTO 00813 case EPROTO: return "protocol error"; 00814 #endif 00815 #ifdef EPROTONOSUPPORT 00816 case EPROTONOSUPPORT: return "protocol not suppored"; 00817 #endif 00818 #ifdef EPROTOTYPE 00819 case EPROTOTYPE: return "protocol wrong type for socket"; 00820 #endif 00821 #ifdef ERANGE 00822 case ERANGE: return "math result unrepresentable"; 00823 #endif 00824 #if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED)) 00825 case EREFUSED: return "EREFUSED"; 00826 #endif 00827 #ifdef EREMCHG 00828 case EREMCHG: return "remote address changed"; 00829 #endif 00830 #ifdef EREMDEV 00831 case EREMDEV: return "remote device"; 00832 #endif 00833 #ifdef EREMOTE 00834 case EREMOTE: return "pathname hit remote file system"; 00835 #endif 00836 #ifdef EREMOTEIO 00837 case EREMOTEIO: return "remote i/o error"; 00838 #endif 00839 #ifdef EREMOTERELEASE 00840 case EREMOTERELEASE: return "EREMOTERELEASE"; 00841 #endif 00842 #ifdef EROFS 00843 case EROFS: return "read-only file system"; 00844 #endif 00845 #ifdef ERPCMISMATCH 00846 case ERPCMISMATCH: return "RPC version is wrong"; 00847 #endif 00848 #ifdef ERREMOTE 00849 case ERREMOTE: return "object is remote"; 00850 #endif 00851 #ifdef ESHUTDOWN 00852 case ESHUTDOWN: return "can't send afer socket shutdown"; 00853 #endif 00854 #ifdef ESOCKTNOSUPPORT 00855 case ESOCKTNOSUPPORT: return "socket type not supported"; 00856 #endif 00857 #ifdef ESPIPE 00858 case ESPIPE: return "invalid seek"; 00859 #endif 00860 #ifdef ESRCH 00861 case ESRCH: return "no such process"; 00862 #endif 00863 #ifdef ESRMNT 00864 case ESRMNT: return "srmount error"; 00865 #endif 00866 #ifdef ESTALE 00867 case ESTALE: return "stale remote file handle"; 00868 #endif 00869 #ifdef ESUCCESS 00870 case ESUCCESS: return "Error 0"; 00871 #endif 00872 #if defined(ETIME) && (!defined(ELOOP) || (ETIME != ELOOP)) 00873 case ETIME: return "timer expired"; 00874 #endif 00875 #if defined(ETIMEDOUT) && (!defined(ENOSTR) || (ETIMEDOUT != ENOSTR)) 00876 case ETIMEDOUT: return "connection timed out"; 00877 #endif 00878 #ifdef ETOOMANYREFS 00879 case ETOOMANYREFS: return "too many references: can't splice"; 00880 #endif 00881 #ifdef ETXTBSY 00882 case ETXTBSY: return "text file or pseudo-device busy"; 00883 #endif 00884 #ifdef EUCLEAN 00885 case EUCLEAN: return "structure needs cleaning"; 00886 #endif 00887 #ifdef EUNATCH 00888 case EUNATCH: return "protocol driver not attached"; 00889 #endif 00890 #ifdef EUSERS 00891 case EUSERS: return "too many users"; 00892 #endif 00893 #ifdef EVERSION 00894 case EVERSION: return "version mismatch"; 00895 #endif 00896 #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) 00897 case EWOULDBLOCK: return "operation would block"; 00898 #endif 00899 #ifdef EXDEV 00900 case EXDEV: return "cross-domain link"; 00901 #endif 00902 #ifdef EXFULL 00903 case EXFULL: return "message tables full"; 00904 #endif 00905 default: 00906 #ifdef NO_STRERROR 00907 return "unknown POSIX error"; 00908 #else 00909 return strerror(errno); 00910 #endif 00911 } 00912 } 00913 00914 /* 00915 *---------------------------------------------------------------------- 00916 * 00917 * Tcl_SignalId -- 00918 * 00919 * Return a textual identifier for a signal number. 00920 * 00921 * Results: 00922 * This procedure returns a machine-readable textual identifier that 00923 * corresponds to sig. The identifier is the same as the #define name in 00924 * signal.h. 00925 * 00926 * Side effects: 00927 * None. 00928 * 00929 *---------------------------------------------------------------------- 00930 */ 00931 00932 CONST char * 00933 Tcl_SignalId( 00934 int sig) /* Number of signal. */ 00935 { 00936 switch (sig) { 00937 #ifdef SIGABRT 00938 case SIGABRT: return "SIGABRT"; 00939 #endif 00940 #ifdef SIGALRM 00941 case SIGALRM: return "SIGALRM"; 00942 #endif 00943 #ifdef SIGBUS 00944 case SIGBUS: return "SIGBUS"; 00945 #endif 00946 #ifdef SIGCHLD 00947 case SIGCHLD: return "SIGCHLD"; 00948 #endif 00949 #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD)) 00950 case SIGCLD: return "SIGCLD"; 00951 #endif 00952 #ifdef SIGCONT 00953 case SIGCONT: return "SIGCONT"; 00954 #endif 00955 #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU)) 00956 case SIGEMT: return "SIGEMT"; 00957 #endif 00958 #ifdef SIGFPE 00959 case SIGFPE: return "SIGFPE"; 00960 #endif 00961 #ifdef SIGHUP 00962 case SIGHUP: return "SIGHUP"; 00963 #endif 00964 #ifdef SIGILL 00965 case SIGILL: return "SIGILL"; 00966 #endif 00967 #ifdef SIGINT 00968 case SIGINT: return "SIGINT"; 00969 #endif 00970 #ifdef SIGIO 00971 case SIGIO: return "SIGIO"; 00972 #endif 00973 #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGIOT != SIGABRT)) 00974 case SIGIOT: return "SIGIOT"; 00975 #endif 00976 #ifdef SIGKILL 00977 case SIGKILL: return "SIGKILL"; 00978 #endif 00979 #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) && (!defined(SIGPROF) || (SIGLOST != SIGPROF)) && (!defined(SIGIO) || (SIGLOST != SIGIO)) 00980 case SIGLOST: return "SIGLOST"; 00981 #endif 00982 #ifdef SIGPIPE 00983 case SIGPIPE: return "SIGPIPE"; 00984 #endif 00985 #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO)) 00986 case SIGPOLL: return "SIGPOLL"; 00987 #endif 00988 #ifdef SIGPROF 00989 case SIGPROF: return "SIGPROF"; 00990 #endif 00991 #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) && (!defined(SIGLOST) || (SIGPWR != SIGLOST)) 00992 case SIGPWR: return "SIGPWR"; 00993 #endif 00994 #ifdef SIGQUIT 00995 case SIGQUIT: return "SIGQUIT"; 00996 #endif 00997 #ifdef SIGSEGV 00998 case SIGSEGV: return "SIGSEGV"; 00999 #endif 01000 #ifdef SIGSTOP 01001 case SIGSTOP: return "SIGSTOP"; 01002 #endif 01003 #ifdef SIGSYS 01004 case SIGSYS: return "SIGSYS"; 01005 #endif 01006 #ifdef SIGTERM 01007 case SIGTERM: return "SIGTERM"; 01008 #endif 01009 #ifdef SIGTRAP 01010 case SIGTRAP: return "SIGTRAP"; 01011 #endif 01012 #ifdef SIGTSTP 01013 case SIGTSTP: return "SIGTSTP"; 01014 #endif 01015 #ifdef SIGTTIN 01016 case SIGTTIN: return "SIGTTIN"; 01017 #endif 01018 #ifdef SIGTTOU 01019 case SIGTTOU: return "SIGTTOU"; 01020 #endif 01021 #if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO)) 01022 case SIGURG: return "SIGURG"; 01023 #endif 01024 #if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO)) 01025 case SIGUSR1: return "SIGUSR1"; 01026 #endif 01027 #if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG)) 01028 case SIGUSR2: return "SIGUSR2"; 01029 #endif 01030 #ifdef SIGVTALRM 01031 case SIGVTALRM: return "SIGVTALRM"; 01032 #endif 01033 #ifdef SIGWINCH 01034 case SIGWINCH: return "SIGWINCH"; 01035 #endif 01036 #ifdef SIGXCPU 01037 case SIGXCPU: return "SIGXCPU"; 01038 #endif 01039 #ifdef SIGXFSZ 01040 case SIGXFSZ: return "SIGXFSZ"; 01041 #endif 01042 } 01043 return "unknown signal"; 01044 } 01045 01046 /* 01047 *---------------------------------------------------------------------- 01048 * 01049 * Tcl_SignalMsg -- 01050 * 01051 * Return a human-readable message describing a signal. 01052 * 01053 * Results: 01054 * This procedure returns a string describing sig that should make sense 01055 * to a human. It may not be easy for a machine to parse. 01056 * 01057 * Side effects: 01058 * None. 01059 * 01060 *---------------------------------------------------------------------- 01061 */ 01062 01063 CONST char * 01064 Tcl_SignalMsg( 01065 int sig) /* Number of signal. */ 01066 { 01067 switch (sig) { 01068 #ifdef SIGABRT 01069 case SIGABRT: return "SIGABRT"; 01070 #endif 01071 #ifdef SIGALRM 01072 case SIGALRM: return "alarm clock"; 01073 #endif 01074 #ifdef SIGBUS 01075 case SIGBUS: return "bus error"; 01076 #endif 01077 #ifdef SIGCHLD 01078 case SIGCHLD: return "child status changed"; 01079 #endif 01080 #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD)) 01081 case SIGCLD: return "child status changed"; 01082 #endif 01083 #ifdef SIGCONT 01084 case SIGCONT: return "continue after stop"; 01085 #endif 01086 #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU)) 01087 case SIGEMT: return "EMT instruction"; 01088 #endif 01089 #ifdef SIGFPE 01090 case SIGFPE: return "floating-point exception"; 01091 #endif 01092 #ifdef SIGHUP 01093 case SIGHUP: return "hangup"; 01094 #endif 01095 #ifdef SIGILL 01096 case SIGILL: return "illegal instruction"; 01097 #endif 01098 #ifdef SIGINT 01099 case SIGINT: return "interrupt"; 01100 #endif 01101 #ifdef SIGIO 01102 case SIGIO: return "input/output possible on file"; 01103 #endif 01104 #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGABRT != SIGIOT)) 01105 case SIGIOT: return "IOT instruction"; 01106 #endif 01107 #ifdef SIGKILL 01108 case SIGKILL: return "kill signal"; 01109 #endif 01110 #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) && (!defined(SIGPROF) || (SIGLOST != SIGPROF)) && (!defined(SIGIO) || (SIGLOST != SIGIO)) 01111 case SIGLOST: return "resource lost"; 01112 #endif 01113 #ifdef SIGPIPE 01114 case SIGPIPE: return "write on pipe with no readers"; 01115 #endif 01116 #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO)) 01117 case SIGPOLL: return "input/output possible on file"; 01118 #endif 01119 #ifdef SIGPROF 01120 case SIGPROF: return "profiling alarm"; 01121 #endif 01122 #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) && (!defined(SIGLOST) || (SIGPWR != SIGLOST)) 01123 case SIGPWR: return "power-fail restart"; 01124 #endif 01125 #ifdef SIGQUIT 01126 case SIGQUIT: return "quit signal"; 01127 #endif 01128 #ifdef SIGSEGV 01129 case SIGSEGV: return "segmentation violation"; 01130 #endif 01131 #ifdef SIGSTOP 01132 case SIGSTOP: return "stop"; 01133 #endif 01134 #ifdef SIGSYS 01135 case SIGSYS: return "bad argument to system call"; 01136 #endif 01137 #ifdef SIGTERM 01138 case SIGTERM: return "software termination signal"; 01139 #endif 01140 #ifdef SIGTRAP 01141 case SIGTRAP: return "trace trap"; 01142 #endif 01143 #ifdef SIGTSTP 01144 case SIGTSTP: return "stop signal from tty"; 01145 #endif 01146 #ifdef SIGTTIN 01147 case SIGTTIN: return "background tty read"; 01148 #endif 01149 #ifdef SIGTTOU 01150 case SIGTTOU: return "background tty write"; 01151 #endif 01152 #if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO)) 01153 case SIGURG: return "urgent I/O condition"; 01154 #endif 01155 #if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO)) 01156 case SIGUSR1: return "user-defined signal 1"; 01157 #endif 01158 #if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG)) 01159 case SIGUSR2: return "user-defined signal 2"; 01160 #endif 01161 #ifdef SIGVTALRM 01162 case SIGVTALRM: return "virtual time alarm"; 01163 #endif 01164 #ifdef SIGWINCH 01165 case SIGWINCH: return "window changed"; 01166 #endif 01167 #ifdef SIGXCPU 01168 case SIGXCPU: return "exceeded CPU time limit"; 01169 #endif 01170 #ifdef SIGXFSZ 01171 case SIGXFSZ: return "exceeded file size limit"; 01172 #endif 01173 } 01174 return "unknown signal"; 01175 } 01176 01177 /* 01178 * Local Variables: 01179 * mode: c 01180 * c-basic-offset: 4 01181 * fill-column: 78 01182 * End: 01183 */
Generated on Wed Mar 12 12:18:20 2008 by 1.5.1 |