| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#include <config.h> |
| 21 |
|
| 22 |
#include "strerror-override.h" |
| 23 |
|
| 24 |
#include <errno.h> |
| 25 |
|
| 26 |
#if GNULIB_defined_EWINSOCK |
| 27 |
# if HAVE_WINSOCK2_H |
| 28 |
# include <winsock2.h> |
| 29 |
# endif |
| 30 |
#endif |
| 31 |
|
| 32 |
#if !GNULIB_defined_strerror_override_macro |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
const char * |
| 37 |
strerror_override (int errnum) |
| 38 |
{ |
| 39 |
|
| 40 |
switch (errnum) |
| 41 |
{ |
| 42 |
# if REPLACE_STRERROR_0 |
| 43 |
case 0: |
| 44 |
return "Success"; |
| 45 |
# endif |
| 46 |
|
| 47 |
# if GNULIB_defined_ESOCK |
| 48 |
case EINPROGRESS: |
| 49 |
return "Operation now in progress"; |
| 50 |
case EALREADY: |
| 51 |
return "Operation already in progress"; |
| 52 |
case ENOTSOCK: |
| 53 |
return "Socket operation on non-socket"; |
| 54 |
case EDESTADDRREQ: |
| 55 |
return "Destination address required"; |
| 56 |
case EMSGSIZE: |
| 57 |
return "Message too long"; |
| 58 |
case EPROTOTYPE: |
| 59 |
return "Protocol wrong type for socket"; |
| 60 |
case ENOPROTOOPT: |
| 61 |
return "Protocol not available"; |
| 62 |
case EPROTONOSUPPORT: |
| 63 |
return "Protocol not supported"; |
| 64 |
case EOPNOTSUPP: |
| 65 |
return "Operation not supported"; |
| 66 |
case EAFNOSUPPORT: |
| 67 |
return "Address family not supported by protocol"; |
| 68 |
case EADDRINUSE: |
| 69 |
return "Address already in use"; |
| 70 |
case EADDRNOTAVAIL: |
| 71 |
return "Cannot assign requested address"; |
| 72 |
case ENETDOWN: |
| 73 |
return "Network is down"; |
| 74 |
case ENETUNREACH: |
| 75 |
return "Network is unreachable"; |
| 76 |
case ECONNRESET: |
| 77 |
return "Connection reset by peer"; |
| 78 |
case ENOBUFS: |
| 79 |
return "No buffer space available"; |
| 80 |
case EISCONN: |
| 81 |
return "Transport endpoint is already connected"; |
| 82 |
case ENOTCONN: |
| 83 |
return "Transport endpoint is not connected"; |
| 84 |
case ETIMEDOUT: |
| 85 |
return "Connection timed out"; |
| 86 |
case ECONNREFUSED: |
| 87 |
return "Connection refused"; |
| 88 |
case ELOOP: |
| 89 |
return "Too many levels of symbolic links"; |
| 90 |
case EHOSTUNREACH: |
| 91 |
return "No route to host"; |
| 92 |
case EWOULDBLOCK: |
| 93 |
return "Operation would block"; |
| 94 |
# endif |
| 95 |
# if GNULIB_defined_ESTREAMS |
| 96 |
case ETXTBSY: |
| 97 |
return "Text file busy"; |
| 98 |
case ENODATA: |
| 99 |
return "No data available"; |
| 100 |
case ENOSR: |
| 101 |
return "Out of streams resources"; |
| 102 |
case ENOSTR: |
| 103 |
return "Device not a stream"; |
| 104 |
case ETIME: |
| 105 |
return "Timer expired"; |
| 106 |
case EOTHER: |
| 107 |
return "Other error"; |
| 108 |
# endif |
| 109 |
# if GNULIB_defined_EWINSOCK |
| 110 |
case ESOCKTNOSUPPORT: |
| 111 |
return "Socket type not supported"; |
| 112 |
case EPFNOSUPPORT: |
| 113 |
return "Protocol family not supported"; |
| 114 |
case ESHUTDOWN: |
| 115 |
return "Cannot send after transport endpoint shutdown"; |
| 116 |
case ETOOMANYREFS: |
| 117 |
return "Too many references: cannot splice"; |
| 118 |
case EHOSTDOWN: |
| 119 |
return "Host is down"; |
| 120 |
case EPROCLIM: |
| 121 |
return "Too many processes"; |
| 122 |
case EUSERS: |
| 123 |
return "Too many users"; |
| 124 |
case EDQUOT: |
| 125 |
return "Disk quota exceeded"; |
| 126 |
case ESTALE: |
| 127 |
return "Stale NFS file handle"; |
| 128 |
case EREMOTE: |
| 129 |
return "Object is remote"; |
| 130 |
# if HAVE_WINSOCK2_H |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
case WSA_OPERATION_ABORTED: |
| 135 |
return "Overlapped operation aborted"; |
| 136 |
case WSA_IO_INCOMPLETE: |
| 137 |
return "Overlapped I/O event object not in signaled state"; |
| 138 |
case WSA_IO_PENDING: |
| 139 |
return "Overlapped operations will complete later"; |
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
case WSASYSNOTREADY: |
| 184 |
return "Network subsystem is unavailable"; |
| 185 |
case WSAVERNOTSUPPORTED: |
| 186 |
return "Winsock.dll version out of range"; |
| 187 |
case WSANOTINITIALISED: |
| 188 |
return "Successful WSAStartup not yet performed"; |
| 189 |
case WSAEDISCON: |
| 190 |
return "Graceful shutdown in progress"; |
| 191 |
case WSAENOMORE: case WSA_E_NO_MORE: |
| 192 |
return "No more results"; |
| 193 |
case WSAECANCELLED: case WSA_E_CANCELLED: |
| 194 |
return "Call was canceled"; |
| 195 |
case WSAEINVALIDPROCTABLE: |
| 196 |
return "Procedure call table is invalid"; |
| 197 |
case WSAEINVALIDPROVIDER: |
| 198 |
return "Service provider is invalid"; |
| 199 |
case WSAEPROVIDERFAILEDINIT: |
| 200 |
return "Service provider failed to initialize"; |
| 201 |
case WSASYSCALLFAILURE: |
| 202 |
return "System call failure"; |
| 203 |
case WSASERVICE_NOT_FOUND: |
| 204 |
return "Service not found"; |
| 205 |
case WSATYPE_NOT_FOUND: |
| 206 |
return "Class type not found"; |
| 207 |
case WSAEREFUSED: |
| 208 |
return "Database query was refused"; |
| 209 |
case WSAHOST_NOT_FOUND: |
| 210 |
return "Host not found"; |
| 211 |
case WSATRY_AGAIN: |
| 212 |
return "Nonauthoritative host not found"; |
| 213 |
case WSANO_RECOVERY: |
| 214 |
return "Nonrecoverable error"; |
| 215 |
case WSANO_DATA: |
| 216 |
return "Valid name, no data record of requested type"; |
| 217 |
|
| 218 |
# endif |
| 219 |
# endif |
| 220 |
|
| 221 |
# if GNULIB_defined_ENOMSG |
| 222 |
case ENOMSG: |
| 223 |
return "No message of desired type"; |
| 224 |
# endif |
| 225 |
|
| 226 |
# if GNULIB_defined_EIDRM |
| 227 |
case EIDRM: |
| 228 |
return "Identifier removed"; |
| 229 |
# endif |
| 230 |
|
| 231 |
# if GNULIB_defined_ENOLINK |
| 232 |
case ENOLINK: |
| 233 |
return "Link has been severed"; |
| 234 |
# endif |
| 235 |
|
| 236 |
# if GNULIB_defined_EPROTO |
| 237 |
case EPROTO: |
| 238 |
return "Protocol error"; |
| 239 |
# endif |
| 240 |
|
| 241 |
# if GNULIB_defined_EMULTIHOP |
| 242 |
case EMULTIHOP: |
| 243 |
return "Multihop attempted"; |
| 244 |
# endif |
| 245 |
|
| 246 |
# if GNULIB_defined_EBADMSG |
| 247 |
case EBADMSG: |
| 248 |
return "Bad message"; |
| 249 |
# endif |
| 250 |
|
| 251 |
# if GNULIB_defined_EOVERFLOW |
| 252 |
case EOVERFLOW: |
| 253 |
return "Value too large for defined data type"; |
| 254 |
# endif |
| 255 |
|
| 256 |
# if GNULIB_defined_ENOTSUP |
| 257 |
case ENOTSUP: |
| 258 |
return "Not supported"; |
| 259 |
# endif |
| 260 |
|
| 261 |
# if GNULIB_defined_ENETRESET |
| 262 |
case ENETRESET: |
| 263 |
return "Network dropped connection on reset"; |
| 264 |
# endif |
| 265 |
|
| 266 |
# if GNULIB_defined_ECONNABORTED |
| 267 |
case ECONNABORTED: |
| 268 |
return "Software caused connection abort"; |
| 269 |
# endif |
| 270 |
|
| 271 |
# if GNULIB_defined_ESTALE |
| 272 |
case ESTALE: |
| 273 |
return "Stale NFS file handle"; |
| 274 |
# endif |
| 275 |
|
| 276 |
# if GNULIB_defined_EDQUOT |
| 277 |
case EDQUOT: |
| 278 |
return "Disk quota exceeded"; |
| 279 |
# endif |
| 280 |
|
| 281 |
# if GNULIB_defined_ECANCELED |
| 282 |
case ECANCELED: |
| 283 |
return "Operation canceled"; |
| 284 |
# endif |
| 285 |
|
| 286 |
# if GNULIB_defined_EOWNERDEAD |
| 287 |
case EOWNERDEAD: |
| 288 |
return "Owner died"; |
| 289 |
# endif |
| 290 |
|
| 291 |
# if GNULIB_defined_ENOTRECOVERABLE |
| 292 |
case ENOTRECOVERABLE: |
| 293 |
return "State not recoverable"; |
| 294 |
# endif |
| 295 |
|
| 296 |
# if GNULIB_defined_EILSEQ |
| 297 |
case EILSEQ: |
| 298 |
return "Invalid or incomplete multibyte or wide character"; |
| 299 |
# endif |
| 300 |
|
| 301 |
default: |
| 302 |
return NULL; |
| 303 |
} |
| 304 |
} |
| 305 |
|
| 306 |
#endif |