File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libiconv / srclib / strerror-override.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 09:29:43 2012 UTC (12 years, 1 month ago) by misho
Branches: libiconv, MAIN
CVS tags: v1_14p0, v1_14, HEAD
libiconv v1.14

    1: /* strerror-override.c --- POSIX compatible system error routine
    2: 
    3:    Copyright (C) 2010-2011 Free Software Foundation, Inc.
    4: 
    5:    This program is free software: you can redistribute it and/or modify
    6:    it under the terms of the GNU General Public License as published by
    7:    the Free Software Foundation; either version 3 of the License, or
    8:    (at your option) any later version.
    9: 
   10:    This program is distributed in the hope that it will be useful,
   11:    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13:    GNU General Public License for more details.
   14: 
   15:    You should have received a copy of the GNU General Public License
   16:    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   17: 
   18: /* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
   19: 
   20: #include <config.h>
   21: 
   22: #include "strerror-override.h"
   23: 
   24: #include <errno.h>
   25: 
   26: #if GNULIB_defined_ESOCK /* native Windows platforms */
   27: # if HAVE_WINSOCK2_H
   28: #  include <winsock2.h>
   29: # endif
   30: #endif
   31: 
   32: /* If ERRNUM maps to an errno value defined by gnulib, return a string
   33:    describing the error.  Otherwise return NULL.  */
   34: const char *
   35: strerror_override (int errnum)
   36: {
   37:   /* These error messages are taken from glibc/sysdeps/gnu/errlist.c.  */
   38:   switch (errnum)
   39:     {
   40: #if REPLACE_STRERROR_0
   41:     case 0:
   42:       return "Success";
   43: #endif
   44: 
   45: #if GNULIB_defined_ETXTBSY
   46:     case ETXTBSY:
   47:       return "Text file busy";
   48: #endif
   49: 
   50: #if GNULIB_defined_ESOCK /* native Windows platforms */
   51:       /* EWOULDBLOCK is the same as EAGAIN.  */
   52:     case EINPROGRESS:
   53:       return "Operation now in progress";
   54:     case EALREADY:
   55:       return "Operation already in progress";
   56:     case ENOTSOCK:
   57:       return "Socket operation on non-socket";
   58:     case EDESTADDRREQ:
   59:       return "Destination address required";
   60:     case EMSGSIZE:
   61:       return "Message too long";
   62:     case EPROTOTYPE:
   63:       return "Protocol wrong type for socket";
   64:     case ENOPROTOOPT:
   65:       return "Protocol not available";
   66:     case EPROTONOSUPPORT:
   67:       return "Protocol not supported";
   68:     case ESOCKTNOSUPPORT:
   69:       return "Socket type not supported";
   70:     case EOPNOTSUPP:
   71:       return "Operation not supported";
   72:     case EPFNOSUPPORT:
   73:       return "Protocol family not supported";
   74:     case EAFNOSUPPORT:
   75:       return "Address family not supported by protocol";
   76:     case EADDRINUSE:
   77:       return "Address already in use";
   78:     case EADDRNOTAVAIL:
   79:       return "Cannot assign requested address";
   80:     case ENETDOWN:
   81:       return "Network is down";
   82:     case ENETUNREACH:
   83:       return "Network is unreachable";
   84:     case ENETRESET:
   85:       return "Network dropped connection on reset";
   86:     case ECONNABORTED:
   87:       return "Software caused connection abort";
   88:     case ECONNRESET:
   89:       return "Connection reset by peer";
   90:     case ENOBUFS:
   91:       return "No buffer space available";
   92:     case EISCONN:
   93:       return "Transport endpoint is already connected";
   94:     case ENOTCONN:
   95:       return "Transport endpoint is not connected";
   96:     case ESHUTDOWN:
   97:       return "Cannot send after transport endpoint shutdown";
   98:     case ETOOMANYREFS:
   99:       return "Too many references: cannot splice";
  100:     case ETIMEDOUT:
  101:       return "Connection timed out";
  102:     case ECONNREFUSED:
  103:       return "Connection refused";
  104:     case ELOOP:
  105:       return "Too many levels of symbolic links";
  106:     case EHOSTDOWN:
  107:       return "Host is down";
  108:     case EHOSTUNREACH:
  109:       return "No route to host";
  110:     case EPROCLIM:
  111:       return "Too many processes";
  112:     case EUSERS:
  113:       return "Too many users";
  114:     case EDQUOT:
  115:       return "Disk quota exceeded";
  116:     case ESTALE:
  117:       return "Stale NFS file handle";
  118:     case EREMOTE:
  119:       return "Object is remote";
  120: # if HAVE_WINSOCK2_H
  121:       /* WSA_INVALID_HANDLE maps to EBADF */
  122:       /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
  123:       /* WSA_INVALID_PARAMETER maps to EINVAL */
  124:     case WSA_OPERATION_ABORTED:
  125:       return "Overlapped operation aborted";
  126:     case WSA_IO_INCOMPLETE:
  127:       return "Overlapped I/O event object not in signaled state";
  128:     case WSA_IO_PENDING:
  129:       return "Overlapped operations will complete later";
  130:       /* WSAEINTR maps to EINTR */
  131:       /* WSAEBADF maps to EBADF */
  132:       /* WSAEACCES maps to EACCES */
  133:       /* WSAEFAULT maps to EFAULT */
  134:       /* WSAEINVAL maps to EINVAL */
  135:       /* WSAEMFILE maps to EMFILE */
  136:       /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
  137:       /* WSAEINPROGRESS is EINPROGRESS */
  138:       /* WSAEALREADY is EALREADY */
  139:       /* WSAENOTSOCK is ENOTSOCK */
  140:       /* WSAEDESTADDRREQ is EDESTADDRREQ */
  141:       /* WSAEMSGSIZE is EMSGSIZE */
  142:       /* WSAEPROTOTYPE is EPROTOTYPE */
  143:       /* WSAENOPROTOOPT is ENOPROTOOPT */
  144:       /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */
  145:       /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
  146:       /* WSAEOPNOTSUPP is EOPNOTSUPP */
  147:       /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
  148:       /* WSAEAFNOSUPPORT is EAFNOSUPPORT */
  149:       /* WSAEADDRINUSE is EADDRINUSE */
  150:       /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */
  151:       /* WSAENETDOWN is ENETDOWN */
  152:       /* WSAENETUNREACH is ENETUNREACH */
  153:       /* WSAENETRESET is ENETRESET */
  154:       /* WSAECONNABORTED is ECONNABORTED */
  155:       /* WSAECONNRESET is ECONNRESET */
  156:       /* WSAENOBUFS is ENOBUFS */
  157:       /* WSAEISCONN is EISCONN */
  158:       /* WSAENOTCONN is ENOTCONN */
  159:       /* WSAESHUTDOWN is ESHUTDOWN */
  160:       /* WSAETOOMANYREFS is ETOOMANYREFS */
  161:       /* WSAETIMEDOUT is ETIMEDOUT */
  162:       /* WSAECONNREFUSED is ECONNREFUSED */
  163:       /* WSAELOOP is ELOOP */
  164:       /* WSAENAMETOOLONG maps to ENAMETOOLONG */
  165:       /* WSAEHOSTDOWN is EHOSTDOWN */
  166:       /* WSAEHOSTUNREACH is EHOSTUNREACH */
  167:       /* WSAENOTEMPTY maps to ENOTEMPTY */
  168:       /* WSAEPROCLIM is EPROCLIM */
  169:       /* WSAEUSERS is EUSERS */
  170:       /* WSAEDQUOT is EDQUOT */
  171:       /* WSAESTALE is ESTALE */
  172:       /* WSAEREMOTE is EREMOTE */
  173:     case WSASYSNOTREADY:
  174:       return "Network subsystem is unavailable";
  175:     case WSAVERNOTSUPPORTED:
  176:       return "Winsock.dll version out of range";
  177:     case WSANOTINITIALISED:
  178:       return "Successful WSAStartup not yet performed";
  179:     case WSAEDISCON:
  180:       return "Graceful shutdown in progress";
  181:     case WSAENOMORE: case WSA_E_NO_MORE:
  182:       return "No more results";
  183:     case WSAECANCELLED: case WSA_E_CANCELLED:
  184:       return "Call was canceled";
  185:     case WSAEINVALIDPROCTABLE:
  186:       return "Procedure call table is invalid";
  187:     case WSAEINVALIDPROVIDER:
  188:       return "Service provider is invalid";
  189:     case WSAEPROVIDERFAILEDINIT:
  190:       return "Service provider failed to initialize";
  191:     case WSASYSCALLFAILURE:
  192:       return "System call failure";
  193:     case WSASERVICE_NOT_FOUND:
  194:       return "Service not found";
  195:     case WSATYPE_NOT_FOUND:
  196:       return "Class type not found";
  197:     case WSAEREFUSED:
  198:       return "Database query was refused";
  199:     case WSAHOST_NOT_FOUND:
  200:       return "Host not found";
  201:     case WSATRY_AGAIN:
  202:       return "Nonauthoritative host not found";
  203:     case WSANO_RECOVERY:
  204:       return "Nonrecoverable error";
  205:     case WSANO_DATA:
  206:       return "Valid name, no data record of requested type";
  207:       /* WSA_QOS_* omitted */
  208: # endif
  209: #endif
  210: 
  211: #if GNULIB_defined_ENOMSG
  212:     case ENOMSG:
  213:       return "No message of desired type";
  214: #endif
  215: 
  216: #if GNULIB_defined_EIDRM
  217:     case EIDRM:
  218:       return "Identifier removed";
  219: #endif
  220: 
  221: #if GNULIB_defined_ENOLINK
  222:     case ENOLINK:
  223:       return "Link has been severed";
  224: #endif
  225: 
  226: #if GNULIB_defined_EPROTO
  227:     case EPROTO:
  228:       return "Protocol error";
  229: #endif
  230: 
  231: #if GNULIB_defined_EMULTIHOP
  232:     case EMULTIHOP:
  233:       return "Multihop attempted";
  234: #endif
  235: 
  236: #if GNULIB_defined_EBADMSG
  237:     case EBADMSG:
  238:       return "Bad message";
  239: #endif
  240: 
  241: #if GNULIB_defined_EOVERFLOW
  242:     case EOVERFLOW:
  243:       return "Value too large for defined data type";
  244: #endif
  245: 
  246: #if GNULIB_defined_ENOTSUP
  247:     case ENOTSUP:
  248:       return "Not supported";
  249: #endif
  250: 
  251: #if GNULIB_defined_ENETRESET
  252:     case ENETRESET:
  253:       return "Network dropped connection on reset";
  254: #endif
  255: 
  256: #if GNULIB_defined_ECONNABORTED
  257:     case ECONNABORTED:
  258:       return "Software caused connection abort";
  259: #endif
  260: 
  261: #if GNULIB_defined_ESTALE
  262:     case ESTALE:
  263:       return "Stale NFS file handle";
  264: #endif
  265: 
  266: #if GNULIB_defined_EDQUOT
  267:     case EDQUOT:
  268:       return "Disk quota exceeded";
  269: #endif
  270: 
  271: #if GNULIB_defined_ECANCELED
  272:     case ECANCELED:
  273:       return "Operation canceled";
  274: #endif
  275: 
  276:     default:
  277:       return NULL;
  278:     }
  279: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>