internal string ErrorDescription() { if (_value >= 0) { return(string.Empty); } else { lock (s_descriptions) { string description; if (s_descriptions.TryGetValue(_value, out description)) { return(description); } description = ErrorInterop.StrError(-_value); s_descriptions.Add(_value, description); return(description); } } }
static PosixResult() { const int count = 82; var nativeValues = new int[count]; ErrorInterop.GetErrnoValues(nativeValues, count); var names = new Dictionary <int, string>(count); InitErrorInfo(ref s_E2BIG, nativeValues[0], names, "E2BIG"); InitErrorInfo(ref s_EACCES, nativeValues[1], names, "EACCES"); InitErrorInfo(ref s_EADDRINUSE, nativeValues[2], names, "EADDRINUSE"); InitErrorInfo(ref s_EADDRNOTAVAIL, nativeValues[3], names, "EADDRNOTAVAIL"); InitErrorInfo(ref s_EAFNOSUPPORT, nativeValues[4], names, "EAFNOSUPPORT"); InitErrorInfo(ref s_EAGAIN, nativeValues[5], names, "EAGAIN"); InitErrorInfo(ref s_EALREADY, nativeValues[6], names, "EALREADY"); InitErrorInfo(ref s_EBADF, nativeValues[7], names, "EBADF"); InitErrorInfo(ref s_EBADMSG, nativeValues[8], names, "EBADMSG"); InitErrorInfo(ref s_EBUSY, nativeValues[9], names, "EBUSY"); InitErrorInfo(ref s_ECANCELED, nativeValues[10], names, "ECANCELED"); InitErrorInfo(ref s_ECHILD, nativeValues[11], names, "ECHILD"); InitErrorInfo(ref s_ECONNABORTED, nativeValues[12], names, "ECONNABORTED"); InitErrorInfo(ref s_ECONNREFUSED, nativeValues[13], names, "ECONNREFUSED"); InitErrorInfo(ref s_ECONNRESET, nativeValues[14], names, "ECONNRESET"); InitErrorInfo(ref s_EDEADLK, nativeValues[15], names, "EDEADLK"); InitErrorInfo(ref s_EDESTADDRREQ, nativeValues[16], names, "EDESTADDRREQ"); InitErrorInfo(ref s_EDOM, nativeValues[17], names, "EDOM"); InitErrorInfo(ref s_EDQUOT, nativeValues[18], names, "EDQUOT"); InitErrorInfo(ref s_EEXIST, nativeValues[19], names, "EEXIST"); InitErrorInfo(ref s_EFAULT, nativeValues[20], names, "EFAULT"); InitErrorInfo(ref s_EFBIG, nativeValues[21], names, "EFBIG"); InitErrorInfo(ref s_EHOSTUNREACH, nativeValues[22], names, "EHOSTUNREACH"); InitErrorInfo(ref s_EIDRM, nativeValues[23], names, "EIDRM"); InitErrorInfo(ref s_EILSEQ, nativeValues[24], names, "EILSEQ"); InitErrorInfo(ref s_EINPROGRESS, nativeValues[25], names, "EINPROGRESS"); InitErrorInfo(ref s_EINTR, nativeValues[26], names, "EINTR"); InitErrorInfo(ref s_EINVAL, nativeValues[27], names, "EINVAL"); InitErrorInfo(ref s_EIO, nativeValues[28], names, "EIO"); InitErrorInfo(ref s_EISCONN, nativeValues[29], names, "EISCONN"); InitErrorInfo(ref s_EISDIR, nativeValues[30], names, "EISDIR"); InitErrorInfo(ref s_ELOOP, nativeValues[31], names, "ELOOP"); InitErrorInfo(ref s_EMFILE, nativeValues[32], names, "EMFILE"); InitErrorInfo(ref s_EMLINK, nativeValues[33], names, "EMLINK"); InitErrorInfo(ref s_EMSGSIZE, nativeValues[34], names, "EMSGSIZE"); InitErrorInfo(ref s_EMULTIHOP, nativeValues[35], names, "EMULTIHOP"); InitErrorInfo(ref s_ENAMETOOLONG, nativeValues[36], names, "ENAMETOOLONG"); InitErrorInfo(ref s_ENETDOWN, nativeValues[37], names, "ENETDOWN"); InitErrorInfo(ref s_ENETRESET, nativeValues[38], names, "ENETRESET"); InitErrorInfo(ref s_ENETUNREACH, nativeValues[39], names, "ENETUNREACH"); InitErrorInfo(ref s_ENFILE, nativeValues[40], names, "ENFILE"); InitErrorInfo(ref s_ENOBUFS, nativeValues[41], names, "ENOBUFS"); InitErrorInfo(ref s_ENODEV, nativeValues[42], names, "ENODEV"); InitErrorInfo(ref s_ENOENT, nativeValues[43], names, "ENOENT"); InitErrorInfo(ref s_ENOEXEC, nativeValues[44], names, "ENOEXEC"); InitErrorInfo(ref s_ENOLCK, nativeValues[45], names, "ENOLCK"); InitErrorInfo(ref s_ENOLINK, nativeValues[46], names, "ENOLINK"); InitErrorInfo(ref s_ENOMEM, nativeValues[47], names, "ENOMEM"); InitErrorInfo(ref s_ENOMSG, nativeValues[48], names, "ENOMSG"); InitErrorInfo(ref s_ENOPROTOOPT, nativeValues[49], names, "ENOPROTOOPT"); InitErrorInfo(ref s_ENOSPC, nativeValues[50], names, "ENOSPC"); InitErrorInfo(ref s_ENOSYS, nativeValues[51], names, "ENOSYS"); InitErrorInfo(ref s_ENOTCONN, nativeValues[52], names, "ENOTCONN"); InitErrorInfo(ref s_ENOTDIR, nativeValues[53], names, "ENOTDIR"); InitErrorInfo(ref s_ENOTEMPTY, nativeValues[54], names, "ENOTEMPTY"); InitErrorInfo(ref s_ENOTRECOVERABLE, nativeValues[55], names, "ENOTRECOVERABLE"); InitErrorInfo(ref s_ENOTSOCK, nativeValues[56], names, "ENOTSOCK"); InitErrorInfo(ref s_ENOTSUP, nativeValues[57], names, "ENOTSUP"); InitErrorInfo(ref s_ENOTTY, nativeValues[58], names, "ENOTTY"); InitErrorInfo(ref s_ENXIO, nativeValues[59], names, "ENXIO"); InitErrorInfo(ref s_EOVERFLOW, nativeValues[60], names, "EOVERFLOW"); InitErrorInfo(ref s_EOWNERDEAD, nativeValues[61], names, "EOWNERDEAD"); InitErrorInfo(ref s_EPERM, nativeValues[62], names, "EPERM"); InitErrorInfo(ref s_EPIPE, nativeValues[63], names, "EPIPE"); InitErrorInfo(ref s_EPROTO, nativeValues[64], names, "EPROTO"); InitErrorInfo(ref s_EPROTONOSUPPORT, nativeValues[65], names, "EPROTONOSUPPORT"); InitErrorInfo(ref s_EPROTOTYPE, nativeValues[66], names, "EPROTOTYPE"); InitErrorInfo(ref s_ERANGE, nativeValues[67], names, "ERANGE"); InitErrorInfo(ref s_EROFS, nativeValues[68], names, "EROFS"); InitErrorInfo(ref s_ESPIPE, nativeValues[69], names, "ESPIPE"); InitErrorInfo(ref s_ESRCH, nativeValues[70], names, "ESRCH"); InitErrorInfo(ref s_ESTALE, nativeValues[71], names, "ESTALE"); InitErrorInfo(ref s_ETIMEDOUT, nativeValues[72], names, "ETIMEDOUT"); InitErrorInfo(ref s_ETXTBSY, nativeValues[73], names, "ETXTBSY"); InitErrorInfo(ref s_EXDEV, nativeValues[74], names, "EXDEV"); InitErrorInfo(ref s_ESOCKTNOSUPPORT, nativeValues[75], names, "ESOCKTNOSUPPORT"); InitErrorInfo(ref s_EPFNOSUPPORT, nativeValues[76], names, "EPFNOSUPPORT"); InitErrorInfo(ref s_ESHUTDOWN, nativeValues[77], names, "ESHUTDOWN"); InitErrorInfo(ref s_EHOSTDOWN, nativeValues[78], names, "EHOSTDOWN"); InitErrorInfo(ref s_ENODATA, nativeValues[79], names, "ENODATA"); InitErrorInfo(ref s_EOPNOTSUPP, nativeValues[80], names, "EOPNOTSUPP"); InitErrorInfo(ref s_EWOULDBLOCK, nativeValues[81], names, "EWOULDBLOCK"); s_names = names; s_descriptions = new Dictionary <int, string>(); }