1 /* strerror-override.c --- POSIX compatible system error routine
3 Copyright (C) 2010-2012 Free Software Foundation, Inc.
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.
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.
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/>. */
18 /* Written by Bruno Haible <bruno@clisp.org>, 2010. */
22 #include "strerror-override.h"
26 #if GNULIB_defined_EWINSOCK /* native Windows platforms */
28 # include <winsock2.h>
32 /* If ERRNUM maps to an errno value defined by gnulib, return a string
33 describing the error. Otherwise return NULL. */
35 strerror_override (int errnum
)
37 /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */
40 #if REPLACE_STRERROR_0
45 #if GNULIB_defined_ESOCK /* native Windows platforms with older <errno.h> */
47 return "Operation now in progress";
49 return "Operation already in progress";
51 return "Socket operation on non-socket";
53 return "Destination address required";
55 return "Message too long";
57 return "Protocol wrong type for socket";
59 return "Protocol not available";
61 return "Protocol not supported";
63 return "Operation not supported";
65 return "Address family not supported by protocol";
67 return "Address already in use";
69 return "Cannot assign requested address";
71 return "Network is down";
73 return "Network is unreachable";
75 return "Connection reset by peer";
77 return "No buffer space available";
79 return "Transport endpoint is already connected";
81 return "Transport endpoint is not connected";
83 return "Connection timed out";
85 return "Connection refused";
87 return "Too many levels of symbolic links";
89 return "No route to host";
91 return "Operation would block";
93 return "Text file busy";
95 return "No data available";
97 return "Out of streams resources";
99 return "Device not a stream";
100 case ENOTRECOVERABLE
:
101 return "State not recoverable";
105 return "Timer expired";
107 return "Other error";
109 #if GNULIB_defined_EWINSOCK /* native Windows platforms */
110 case ESOCKTNOSUPPORT
:
111 return "Socket type not supported";
113 return "Protocol family not supported";
115 return "Cannot send after transport endpoint shutdown";
117 return "Too many references: cannot splice";
119 return "Host is down";
121 return "Too many processes";
123 return "Too many users";
125 return "Disk quota exceeded";
127 return "Stale NFS file handle";
129 return "Object is remote";
131 /* WSA_INVALID_HANDLE maps to EBADF */
132 /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
133 /* WSA_INVALID_PARAMETER maps to EINVAL */
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";
139 return "Overlapped operations will complete later";
140 /* WSAEINTR maps to EINTR */
141 /* WSAEBADF maps to EBADF */
142 /* WSAEACCES maps to EACCES */
143 /* WSAEFAULT maps to EFAULT */
144 /* WSAEINVAL maps to EINVAL */
145 /* WSAEMFILE maps to EMFILE */
146 /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
147 /* WSAEINPROGRESS maps to EINPROGRESS */
148 /* WSAEALREADY maps to EALREADY */
149 /* WSAENOTSOCK maps to ENOTSOCK */
150 /* WSAEDESTADDRREQ maps to EDESTADDRREQ */
151 /* WSAEMSGSIZE maps to EMSGSIZE */
152 /* WSAEPROTOTYPE maps to EPROTOTYPE */
153 /* WSAENOPROTOOPT maps to ENOPROTOOPT */
154 /* WSAEPROTONOSUPPORT maps to EPROTONOSUPPORT */
155 /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
156 /* WSAEOPNOTSUPP maps to EOPNOTSUPP */
157 /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
158 /* WSAEAFNOSUPPORT maps to EAFNOSUPPORT */
159 /* WSAEADDRINUSE maps to EADDRINUSE */
160 /* WSAEADDRNOTAVAIL maps to EADDRNOTAVAIL */
161 /* WSAENETDOWN maps to ENETDOWN */
162 /* WSAENETUNREACH maps to ENETUNREACH */
163 /* WSAENETRESET maps to ENETRESET */
164 /* WSAECONNABORTED maps to ECONNABORTED */
165 /* WSAECONNRESET maps to ECONNRESET */
166 /* WSAENOBUFS maps to ENOBUFS */
167 /* WSAEISCONN maps to EISCONN */
168 /* WSAENOTCONN maps to ENOTCONN */
169 /* WSAESHUTDOWN is ESHUTDOWN */
170 /* WSAETOOMANYREFS is ETOOMANYREFS */
171 /* WSAETIMEDOUT maps to ETIMEDOUT */
172 /* WSAECONNREFUSED maps to ECONNREFUSED */
173 /* WSAELOOP maps to ELOOP */
174 /* WSAENAMETOOLONG maps to ENAMETOOLONG */
175 /* WSAEHOSTDOWN is EHOSTDOWN */
176 /* WSAEHOSTUNREACH maps to EHOSTUNREACH */
177 /* WSAENOTEMPTY maps to ENOTEMPTY */
178 /* WSAEPROCLIM is EPROCLIM */
179 /* WSAEUSERS is EUSERS */
180 /* WSAEDQUOT is EDQUOT */
181 /* WSAESTALE is ESTALE */
182 /* WSAEREMOTE is EREMOTE */
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";
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";
208 return "Database query was refused";
209 case WSAHOST_NOT_FOUND
:
210 return "Host not found";
212 return "Nonauthoritative host not found";
214 return "Nonrecoverable error";
216 return "Valid name, no data record of requested type";
217 /* WSA_QOS_* omitted */
221 #if GNULIB_defined_ENOMSG
223 return "No message of desired type";
226 #if GNULIB_defined_EIDRM
228 return "Identifier removed";
231 #if GNULIB_defined_ENOLINK
233 return "Link has been severed";
236 #if GNULIB_defined_EPROTO
238 return "Protocol error";
241 #if GNULIB_defined_EMULTIHOP
243 return "Multihop attempted";
246 #if GNULIB_defined_EBADMSG
248 return "Bad message";
251 #if GNULIB_defined_EOVERFLOW
253 return "Value too large for defined data type";
256 #if GNULIB_defined_ENOTSUP
258 return "Not supported";
261 #if GNULIB_defined_ENETRESET
263 return "Network dropped connection on reset";
266 #if GNULIB_defined_ECONNABORTED
268 return "Software caused connection abort";
271 #if GNULIB_defined_ESTALE
273 return "Stale NFS file handle";
276 #if GNULIB_defined_EDQUOT
278 return "Disk quota exceeded";
281 #if GNULIB_defined_ECANCELED
283 return "Operation canceled";