Annotation of researchv10no/cmd/nupas/ipc/sun_err.c, revision 1.1

1.1     ! root        1: /*
        !             2:        Error codes on SGI MIPS system:
        !             3: 
        !             4: EX_USAGE       64      command line usage error
        !             5: EX_DATAERR     65      data format error
        !             6: EX_NOINPUT     66      cannot open input
        !             7: EX_NOUSER      67      addressee unknown
        !             8: EX_NOHOST      68      host name unknown:
        !             9:                                unknown service
        !            10:                                        gethostbyname if host not found.)
        !            11:                                connection timed out
        !            12: EX_UNAVAILABLE 69      service unavailable
        !            13: EX_SOFTWARE    70      internal software error
        !            14: EX_OSERR       71      system error (e.g., can't fork)
        !            15: EX_OSFILE      72      critical OS file missing
        !            16: EX_CANTCREAT   73      can't create (user) output file
        !            17: EX_IOERR       74      input/output error
        !            18: EX_TEMPFAIL    75      temp failure; user is invited to retry
        !            19:                                Connection refused (code returned by
        !            20: EX_PROTOCOL    76      remote error in protocol
        !            21: EX_NOPERM      77      permission denied
        !            22: */
        !            23: 
        !            24: #include <errno.h>
        !            25: #include <stdio.h>
        !            26: #include <sysexits.h>
        !            27: #include <string.h>
        !            28: 
        !            29: extern char *sys_errlist[ ];
        !            30: extern int sys_nerr;
        !            31: 
        !            32: extern int ipcdebug;
        !            33: 
        !            34: /*
        !            35:  * A known place to keep a copy of the system-supplied
        !            36:  * error message.
        !            37:  */
        !            38: int syserrno;
        !            39: char syserrstr[128];
        !            40: 
        !            41: 
        !            42: /*
        !            43:  * Copy the actual OS-supplied errno and string in a known
        !            44:  * place.
        !            45:  */
        !            46: ipcgetsyserr()
        !            47: {
        !            48:        syserrno = errno;
        !            49:        if (ipcdebug)
        !            50:                fprintf(stderr, "ipcgetsyserr: errno=%d\n", syserrno);
        !            51:        if (errno < sys_nerr)
        !            52:                strcpy(syserrstr, sys_errlist[errno]);
        !            53:        else
        !            54:                sprintf(syserrstr, "Unknown error number %d", errno);
        !            55: }
        !            56: 
        !            57: /*
        !            58:  * map the system error in syserrno into one of the
        !            59:  * errors in sysexits.h
        !            60:  */
        !            61: int
        !            62: ipcmaperror()
        !            63: {
        !            64:        switch (syserrno) {
        !            65:        case EAGAIN:
        !            66:        case ENFILE:
        !            67:        case EMFILE:
        !            68:        case ENOSPC:
        !            69:        case ENETDOWN:
        !            70:        case ENETUNREACH:
        !            71:        case ENETRESET:
        !            72:        case ECONNABORTED:
        !            73:        case ECONNRESET:
        !            74:        case ENOBUFS:
        !            75:        case ETIMEDOUT:
        !            76:        case ECONNREFUSED:
        !            77:                                return EX_TEMPFAIL;
        !            78:        case EHOSTDOWN:
        !            79:        case EHOSTUNREACH:
        !            80:                                return EX_NOHOST;
        !            81: 
        !            82:        default:                return EX_OSERR;
        !            83:        }
        !            84: }

unix.superglobalmegacorp.com

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