|
|
1.1 ! root 1: #include <errno.h> ! 2: ! 3: /* imported */ ! 4: extern int errno; ! 5: extern char *errstr; ! 6: ! 7: char *msgs[] = { ! 8: "DK controller system error", ! 9: "destination busy", ! 10: "remote node not answering", ! 11: "destination not answering", ! 12: "unassigned destination", ! 13: "DK system overload", ! 14: "server already exists", ! 15: "call rejected by destination", ! 16: }; ! 17: ! 18: int errs[] = { ! 19: EIO, ! 20: EBUSY, ! 21: EIO, ! 22: EIO, ! 23: ENOENT, ! 24: EBUSY, ! 25: EEXIST, ! 26: EACCES, ! 27: }; ! 28: ! 29: struct uerrs { ! 30: int v9; ! 31: int dk; ! 32: }; ! 33: ! 34: struct uerrs uerrs[] = { ! 35: { EIO, 3 }, ! 36: { EBUSY, 1 }, ! 37: { ENOENT, 3 }, ! 38: { EEXIST, 3 }, ! 39: { EACCES, 7 }, ! 40: { 0, 3 }, ! 41: }; ! 42: ! 43: /* ! 44: * Convert a Unix error code to a dk error code ! 45: */ ! 46: int ! 47: utodkerr(uerr) ! 48: { ! 49: register struct uerrs *up; ! 50: ! 51: for(up=uerrs; up->v9; up++) ! 52: if(up->v9 == uerr) ! 53: return up->dk; ! 54: return up->dk; ! 55: } ! 56: ! 57: /* ! 58: * Convert a dk error code to a Unix errstr and errno ! 59: */ ! 60: dktouerr(dkerr) ! 61: { ! 62: dkerr &= 0x7f; ! 63: if (dkerr<=0 || dkerr>=sizeof(errs)/sizeof(int)) { ! 64: errno = EGREG; ! 65: errstr = "unknown error"; ! 66: return; ! 67: } ! 68: errno = errs[dkerr]; ! 69: errstr = msgs[dkerr]; ! 70: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.