Annotation of micropolis/src/tcl/compat/strerror.c, revision 1.1.1.1

1.1       root        1: /* 
                      2:  * strerror.c --
                      3:  *
                      4:  *     Source code for the "strerror" library routine.
                      5:  *
                      6:  * Copyright 1988-1991 Regents of the University of California
                      7:  * Permission to use, copy, modify, and distribute this
                      8:  * software and its documentation for any purpose and without
                      9:  * fee is hereby granted, provided that the above copyright
                     10:  * notice appears in all copies.  The University of California
                     11:  * makes no representations about the suitability of this
                     12:  * software for any purpose.  It is provided "as is" without
                     13:  * express or implied warranty.
                     14:  */
                     15: 
                     16: #ifndef lint
                     17: static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/strerror.c,v 1.2 91/12/16 09:26:48 ouster Exp $ SPRITE (Berkeley)";
                     18: #endif /* not lint */
                     19: 
                     20: #include <tclint.h>
                     21: #include <tclunix.h>
                     22: 
                     23: /*
                     24:  *----------------------------------------------------------------------
                     25:  *
                     26:  * strerror --
                     27:  *
                     28:  *     Map an integer error number into a printable string.
                     29:  *
                     30:  * Results:
                     31:  *     The return value is a pointer to a string describing
                     32:  *     error.  The first character of string isn't capitalized.
                     33:  *
                     34:  * Side effects:
                     35:  *     Each call to this procedure may overwrite the value returned
                     36:  *     by the previous call.
                     37:  *
                     38:  *----------------------------------------------------------------------
                     39:  */
                     40: 
                     41: char *
                     42: strerror(error)
                     43:     int error;                 /* Integer identifying error (must be
                     44:                                 * one of the officially-defined Sprite
                     45:                                 * errors, as defined in errno.h). */
                     46: {
                     47:     static char msg[50];
                     48: 
                     49: #if TCL_SYS_ERRLIST
                     50:     if ((error <= sys_nerr) && (error > 0)) {
                     51:        return sys_errlist[error];
                     52:     }
                     53: #else
                     54:     switch (error) {
                     55: #ifdef E2BIG
                     56:        case E2BIG: return "argument list too long";
                     57: #endif
                     58: #ifdef EACCES
                     59:        case EACCES: return "permission denied";
                     60: #endif
                     61: #ifdef EADDRINUSE
                     62:        case EADDRINUSE: return "address already in use";
                     63: #endif
                     64: #ifdef EADDRNOTAVAIL
                     65:        case EADDRNOTAVAIL: return "can't assign requested address";
                     66: #endif
                     67: #ifdef EADV
                     68:        case EADV: return "advertise error";
                     69: #endif
                     70: #ifdef EAFNOSUPPORT
                     71:        case EAFNOSUPPORT: return "address family not supported by protocol family";
                     72: #endif
                     73: #ifdef EAGAIN
                     74:        case EAGAIN: return "no more processes";
                     75: #endif
                     76: #ifdef EALIGN
                     77:        case EALIGN: return "EALIGN";
                     78: #endif
                     79: #ifdef EALREADY
                     80:        case EALREADY: return "operation already in progress";
                     81: #endif
                     82: #ifdef EBADE
                     83:        case EBADE: return "bad exchange descriptor";
                     84: #endif
                     85: #ifdef EBADF
                     86:        case EBADF: return "bad file number";
                     87: #endif
                     88: #ifdef EBADFD
                     89:        case EBADFD: return "file descriptor in bad state";
                     90: #endif
                     91: #ifdef EBADMSG
                     92:        case EBADMSG: return "not a data message";
                     93: #endif
                     94: #ifdef EBADR
                     95:        case EBADR: return "bad request descriptor";
                     96: #endif
                     97: #ifdef EBADRPC
                     98:        case EBADRPC: return "RPC structure is bad";
                     99: #endif
                    100: #ifdef EBADRQC
                    101:        case EBADRQC: return "bad request code";
                    102: #endif
                    103: #ifdef EBADSLT
                    104:        case EBADSLT: return "invalid slot";
                    105: #endif
                    106: #ifdef EBFONT
                    107:        case EBFONT: return "bad font file format";
                    108: #endif
                    109: #ifdef EBUSY
                    110:        case EBUSY: return "mount device busy";
                    111: #endif
                    112: #ifdef ECHILD
                    113:        case ECHILD: return "no children";
                    114: #endif
                    115: #ifdef ECHRNG
                    116:        case ECHRNG: return "channel number out of range";
                    117: #endif
                    118: #ifdef ECOMM
                    119:        case ECOMM: return "communication error on send";
                    120: #endif
                    121: #ifdef ECONNABORTED
                    122:        case ECONNABORTED: return "software caused connection abort";
                    123: #endif
                    124: #ifdef ECONNREFUSED
                    125:        case ECONNREFUSED: return "connection refused";
                    126: #endif
                    127: #ifdef ECONNRESET
                    128:        case ECONNRESET: return "connection reset by peer";
                    129: #endif
                    130: #if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
                    131:        case EDEADLK: return "resource deadlock avoided";
                    132: #endif
                    133: #ifdef EDEADLOCK
                    134:        case EDEADLOCK: return "resource deadlock avoided";
                    135: #endif
                    136: #ifdef EDESTADDRREQ
                    137:        case EDESTADDRREQ: return "destination address required";
                    138: #endif
                    139: #ifdef EDIRTY
                    140:        case EDIRTY: return "mounting a dirty fs w/o force";
                    141: #endif
                    142: #ifdef EDOM
                    143:        case EDOM: return "math argument out of range";
                    144: #endif
                    145: #ifdef EDOTDOT
                    146:        case EDOTDOT: return "cross mount point";
                    147: #endif
                    148: #ifdef EDQUOT
                    149:        case EDQUOT: return "disk quota exceeded";
                    150: #endif
                    151: #ifdef EDUPPKG
                    152:        case EDUPPKG: return "duplicate package name";
                    153: #endif
                    154: #ifdef EEXIST
                    155:        case EEXIST: return "file already exists";
                    156: #endif
                    157: #ifdef EFAULT
                    158:        case EFAULT: return "bad address in system call argument";
                    159: #endif
                    160: #ifdef EFBIG
                    161:        case EFBIG: return "file too large";
                    162: #endif
                    163: #ifdef EHOSTDOWN
                    164:        case EHOSTDOWN: return "host is down";
                    165: #endif
                    166: #ifdef EHOSTUNREACH
                    167:        case EHOSTUNREACH: return "host is unreachable";
                    168: #endif
                    169: #ifdef EIDRM
                    170:        case EIDRM: return "identifier removed";
                    171: #endif
                    172: #ifdef EINIT
                    173:        case EINIT: return "initialization error";
                    174: #endif
                    175: #ifdef EINPROGRESS
                    176:        case EINPROGRESS: return "operation now in progress";
                    177: #endif
                    178: #ifdef EINTR
                    179:        case EINTR: return "interrupted system call";
                    180: #endif
                    181: #ifdef EINVAL
                    182:        case EINVAL: return "invalid argument";
                    183: #endif
                    184: #ifdef EIO
                    185:        case EIO: return "I/O error";
                    186: #endif
                    187: #ifdef EISCONN
                    188:        case EISCONN: return "socket is already connected";
                    189: #endif
                    190: #ifdef EISDIR
                    191:        case EISDIR: return "illegal operation on a directory";
                    192: #endif
                    193: #ifdef EISNAME
                    194:        case EISNAM: return "is a name file";
                    195: #endif
                    196: #ifdef ELBIN
                    197:        case ELBIN: return "ELBIN";
                    198: #endif
                    199: #ifdef EL2HLT
                    200:        case EL2HLT: return "level 2 halted";
                    201: #endif
                    202: #ifdef EL2NSYNC
                    203:        case EL2NSYNC: return "level 2 not synchronized";
                    204: #endif
                    205: #ifdef EL3HLT
                    206:        case EL3HLT: return "level 3 halted";
                    207: #endif
                    208: #ifdef EL3RST
                    209:        case EL3RST: return "level 3 reset";
                    210: #endif
                    211: #ifdef ELIBACC
                    212:        case ELIBACC: return "can not access a needed shared library";
                    213: #endif
                    214: #ifdef ELIBBAD
                    215:        case ELIBBAD: return "accessing a corrupted shared library";
                    216: #endif
                    217: #ifdef ELIBEXEC
                    218:        case ELIBEXEC: return "can not exec a shared library directly";
                    219: #endif
                    220: #ifdef ELIBMAX
                    221:        case ELIBMAX: return
                    222:                "attempting to link in more shared libraries than system limit";
                    223: #endif
                    224: #ifdef ELIBSCN
                    225:        case ELIBSCN: return ".lib section in a.out corrupted";
                    226: #endif
                    227: #ifdef ELNRNG
                    228:        case ELNRNG: return "link number out of range";
                    229: #endif
                    230: #ifdef ELOOP
                    231:        case ELOOP: return "too many levels of symbolic links";
                    232: #endif
                    233: #ifdef EMFILE
                    234:        case EMFILE: return "too many open files";
                    235: #endif
                    236: #ifdef EMLINK
                    237:        case EMLINK: return "too many links";
                    238: #endif
                    239: #ifdef EMSGSIZE
                    240:        case EMSGSIZE: return "message too long";
                    241: #endif
                    242: #ifdef EMULTIHOP
                    243:        case EMULTIHOP: return "multihop attempted";
                    244: #endif
                    245: #ifdef ENAMETOOLONG
                    246:        case ENAMETOOLONG: return "file name too long";
                    247: #endif
                    248: #ifdef ENAVAIL
                    249:        case ENAVAIL: return "not available";
                    250: #endif
                    251: #ifdef ENET
                    252:        case ENET: return "ENET";
                    253: #endif
                    254: #ifdef ENETDOWN
                    255:        case ENETDOWN: return "network is down";
                    256: #endif
                    257: #ifdef ENETRESET
                    258:        case ENETRESET: return "network dropped connection on reset";
                    259: #endif
                    260: #ifdef ENETUNREACH
                    261:        case ENETUNREACH: return "network is unreachable";
                    262: #endif
                    263: #ifdef ENFILE
                    264:        case ENFILE: return "file table overflow";
                    265: #endif
                    266: #ifdef ENOANO
                    267:        case ENOANO: return "anode table overflow";
                    268: #endif
                    269: #if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
                    270:        case ENOBUFS: return "no buffer space available";
                    271: #endif
                    272: #ifdef ENOCSI
                    273:        case ENOCSI: return "no CSI structure available";
                    274: #endif
                    275: #ifdef ENODATA
                    276:        case ENODATA: return "no data available";
                    277: #endif
                    278: #ifdef ENODEV
                    279:        case ENODEV: return "no such device";
                    280: #endif
                    281: #ifdef ENOENT
                    282:        case ENOENT: return "no such file or directory";
                    283: #endif
                    284: #ifdef ENOEXEC
                    285:        case ENOEXEC: return "exec format error";
                    286: #endif
                    287: #ifdef ENOLCK
                    288:        case ENOLCK: return "no locks available";
                    289: #endif
                    290: #ifdef ENOLINK
                    291:        case ENOLINK: return "link has be severed";
                    292: #endif
                    293: #ifdef ENOMEM
                    294:        case ENOMEM: return "not enough memory";
                    295: #endif
                    296: #ifdef ENOMSG
                    297:        case ENOMSG: return "no message of desired type";
                    298: #endif
                    299: #ifdef ENONET
                    300:        case ENONET: return "machine is not on the network";
                    301: #endif
                    302: #ifdef ENOPKG
                    303:        case ENOPKG: return "package not installed";
                    304: #endif
                    305: #ifdef ENOPROTOOPT
                    306:        case ENOPROTOOPT: return "bad proocol option";
                    307: #endif
                    308: #ifdef ENOSPC
                    309:        case ENOSPC: return "no space left on device";
                    310: #endif
                    311: #ifdef ENOSR
                    312:        case ENOSR: return "out of stream resources";
                    313: #endif
                    314: #ifdef ENOSTR
                    315:        case ENOSTR: return "not a stream device";
                    316: #endif
                    317: #ifdef ENOSYM
                    318:        case ENOSYM: return "unresolved symbol name";
                    319: #endif
                    320: #ifdef ENOSYS
                    321:        case ENOSYS: return "function not implemented";
                    322: #endif
                    323: #ifdef ENOTBLK
                    324:        case ENOTBLK: return "block device required";
                    325: #endif
                    326: #ifdef ENOTCONN
                    327:        case ENOTCONN: return "socket is not connected";
                    328: #endif
                    329: #ifdef ENOTDIR
                    330:        case ENOTDIR: return "not a directory";
                    331: #endif
                    332: #ifdef ENOTEMPTY
                    333:        case ENOTEMPTY: return "directory not empty";
                    334: #endif
                    335: #ifdef ENOTNAM
                    336:        case ENOTNAM: return "not a name file";
                    337: #endif
                    338: #ifdef ENOTSOCK
                    339:        case ENOTSOCK: return "socket operation on non-socket";
                    340: #endif
                    341: #ifdef ENOTTY
                    342:        case ENOTTY: return "inappropriate device for ioctl";
                    343: #endif
                    344: #ifdef ENOTUNIQ
                    345:        case ENOTUNIQ: return "name not unique on network";
                    346: #endif
                    347: #ifdef ENXIO
                    348:        case ENXIO: return "no such device or address";
                    349: #endif
                    350: #ifdef EOPNOTSUPP
                    351:        case EOPNOTSUPP: return "operation not supported on socket";
                    352: #endif
                    353: #ifdef EPERM
                    354:        case EPERM: return "not owner";
                    355: #endif
                    356: #ifdef EPFNOSUPPORT
                    357:        case EPFNOSUPPORT: return "protocol family not supported";
                    358: #endif
                    359: #ifdef EPIPE
                    360:        case EPIPE: return "broken pipe";
                    361: #endif
                    362: #ifdef EPROCLIM
                    363:        case EPROCLIM: return "too many processes";
                    364: #endif
                    365: #ifdef EPROCUNAVAIL
                    366:        case EPROCUNAVAIL: return "bad procedure for program";
                    367: #endif
                    368: #ifdef EPROGMISMATCH
                    369:        case EPROGMISMATCH: return "program version wrong";
                    370: #endif
                    371: #ifdef EPROGUNAVAIL
                    372:        case EPROGUNAVAIL: return "RPC program not available";
                    373: #endif
                    374: #ifdef EPROTO
                    375:        case EPROTO: return "protocol error";
                    376: #endif
                    377: #ifdef EPROTONOSUPPORT
                    378:        case EPROTONOSUPPORT: return "protocol not suppored";
                    379: #endif
                    380: #ifdef EPROTOTYPE
                    381:        case EPROTOTYPE: return "protocol wrong type for socket";
                    382: #endif
                    383: #ifdef ERANGE
                    384:        case ERANGE: return "math result unrepresentable";
                    385: #endif
                    386: #if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
                    387:        case EREFUSED: return "EREFUSED";
                    388: #endif
                    389: #ifdef EREMCHG
                    390:        case EREMCHG: return "remote address changed";
                    391: #endif
                    392: #ifdef EREMDEV
                    393:        case EREMDEV: return "remote device";
                    394: #endif
                    395: #ifdef EREMOTE
                    396:        case EREMOTE: return "pathname hit remote file system";
                    397: #endif
                    398: #ifdef EREMOTEIO
                    399:        case EREMOTEIO: return "remote i/o error";
                    400: #endif
                    401: #ifdef EREMOTERELEASE
                    402:        case EREMOTERELEASE: return "EREMOTERELEASE";
                    403: #endif
                    404: #ifdef EROFS
                    405:        case EROFS: return "read-only file system";
                    406: #endif
                    407: #ifdef ERPCMISMATCH
                    408:        case ERPCMISMATCH: return "RPC version is wrong";
                    409: #endif
                    410: #ifdef ERREMOTE
                    411:        case ERREMOTE: return "object is remote";
                    412: #endif
                    413: #ifdef ESHUTDOWN
                    414:        case ESHUTDOWN: return "can't send afer socket shutdown";
                    415: #endif
                    416: #ifdef ESOCKTNOSUPPORT
                    417:        case ESOCKTNOSUPPORT: return "socket type not supported";
                    418: #endif
                    419: #ifdef ESPIPE
                    420:        case ESPIPE: return "invalid seek";
                    421: #endif
                    422: #ifdef ESRCH
                    423:        case ESRCH: return "no such process";
                    424: #endif
                    425: #ifdef ESRMNT
                    426:        case ESRMNT: return "srmount error";
                    427: #endif
                    428: #ifdef ESTALE
                    429:        case ESTALE: return "stale remote file handle";
                    430: #endif
                    431: #ifdef ESUCCESS
                    432:        case ESUCCESS: return "Error 0";
                    433: #endif
                    434: #ifdef ETIME
                    435:        case ETIME: return "timer expired";
                    436: #endif
                    437: #ifdef ETIMEDOUT
                    438:        case ETIMEDOUT: return "connection timed out";
                    439: #endif
                    440: #ifdef ETOOMANYREFS
                    441:        case ETOOMANYREFS: return "too many references: can't splice";
                    442: #endif
                    443: #ifdef ETXTBSY
                    444:        case ETXTBSY: return "text file or pseudo-device busy";
                    445: #endif
                    446: #ifdef EUCLEAN
                    447:        case EUCLEAN: return "structure needs cleaning";
                    448: #endif
                    449: #ifdef EUNATCH
                    450:        case EUNATCH: return "protocol driver not attached";
                    451: #endif
                    452: #ifdef EUSERS
                    453:        case EUSERS: return "too many users";
                    454: #endif
                    455: #ifdef EVERSION
                    456:        case EVERSION: return "version mismatch";
                    457: #endif
                    458: #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
                    459:        case EWOULDBLOCK: return "operation would block";
                    460: #endif
                    461: #ifdef EXDEV
                    462:        case EXDEV: return "cross-domain link";
                    463: #endif
                    464: #ifdef EXFULL
                    465:        case EXFULL: return "message tables full";
                    466: #endif
                    467:     }
                    468: #endif /* ! TCL_SYS_ERRLIST */
                    469:     sprintf(msg, "unknown error (%d)", error);
                    470:     return msg;
                    471: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.