1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* strerror.c --- POSIX compatible system error routine
5 Copyright (C) 2007-2011 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
29 # if GNULIB_defined_ESOCK /* native Windows platforms */
31 # include <winsock2.h>
35 # include "intprops.h"
37 /* Use the system functions, not the gnulib overrides in this file. */
41 # if ! HAVE_DECL_STRERROR
42 # define strerror(n) NULL
48 char const *msg = NULL;
49 /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */
52 # if GNULIB_defined_ETXTBSY
54 msg = "Text file busy";
58 # if GNULIB_defined_ESOCK /* native Windows platforms */
59 /* EWOULDBLOCK is the same as EAGAIN. */
61 msg = "Operation now in progress";
64 msg = "Operation already in progress";
67 msg = "Socket operation on non-socket";
70 msg = "Destination address required";
73 msg = "Message too long";
76 msg = "Protocol wrong type for socket";
79 msg = "Protocol not available";
82 msg = "Protocol not supported";
85 msg = "Socket type not supported";
88 msg = "Operation not supported";
91 msg = "Protocol family not supported";
94 msg = "Address family not supported by protocol";
97 msg = "Address already in use";
100 msg = "Cannot assign requested address";
103 msg = "Network is down";
106 msg = "Network is unreachable";
109 msg = "Network dropped connection on reset";
112 msg = "Software caused connection abort";
115 msg = "Connection reset by peer";
118 msg = "No buffer space available";
121 msg = "Transport endpoint is already connected";
124 msg = "Transport endpoint is not connected";
127 msg = "Cannot send after transport endpoint shutdown";
130 msg = "Too many references: cannot splice";
133 msg = "Connection timed out";
136 msg = "Connection refused";
139 msg = "Too many levels of symbolic links";
142 msg = "Host is down";
145 msg = "No route to host";
148 msg = "Too many processes";
151 msg = "Too many users";
154 msg = "Disk quota exceeded";
157 msg = "Stale NFS file handle";
160 msg = "Object is remote";
163 /* WSA_INVALID_HANDLE maps to EBADF */
164 /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
165 /* WSA_INVALID_PARAMETER maps to EINVAL */
166 case WSA_OPERATION_ABORTED:
167 msg = "Overlapped operation aborted";
169 case WSA_IO_INCOMPLETE:
170 msg = "Overlapped I/O event object not in signaled state";
173 msg = "Overlapped operations will complete later";
175 /* WSAEINTR maps to EINTR */
176 /* WSAEBADF maps to EBADF */
177 /* WSAEACCES maps to EACCES */
178 /* WSAEFAULT maps to EFAULT */
179 /* WSAEINVAL maps to EINVAL */
180 /* WSAEMFILE maps to EMFILE */
181 /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
182 /* WSAEINPROGRESS is EINPROGRESS */
183 /* WSAEALREADY is EALREADY */
184 /* WSAENOTSOCK is ENOTSOCK */
185 /* WSAEDESTADDRREQ is EDESTADDRREQ */
186 /* WSAEMSGSIZE is EMSGSIZE */
187 /* WSAEPROTOTYPE is EPROTOTYPE */
188 /* WSAENOPROTOOPT is ENOPROTOOPT */
189 /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */
190 /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
191 /* WSAEOPNOTSUPP is EOPNOTSUPP */
192 /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
193 /* WSAEAFNOSUPPORT is EAFNOSUPPORT */
194 /* WSAEADDRINUSE is EADDRINUSE */
195 /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */
196 /* WSAENETDOWN is ENETDOWN */
197 /* WSAENETUNREACH is ENETUNREACH */
198 /* WSAENETRESET is ENETRESET */
199 /* WSAECONNABORTED is ECONNABORTED */
200 /* WSAECONNRESET is ECONNRESET */
201 /* WSAENOBUFS is ENOBUFS */
202 /* WSAEISCONN is EISCONN */
203 /* WSAENOTCONN is ENOTCONN */
204 /* WSAESHUTDOWN is ESHUTDOWN */
205 /* WSAETOOMANYREFS is ETOOMANYREFS */
206 /* WSAETIMEDOUT is ETIMEDOUT */
207 /* WSAECONNREFUSED is ECONNREFUSED */
208 /* WSAELOOP is ELOOP */
209 /* WSAENAMETOOLONG maps to ENAMETOOLONG */
210 /* WSAEHOSTDOWN is EHOSTDOWN */
211 /* WSAEHOSTUNREACH is EHOSTUNREACH */
212 /* WSAENOTEMPTY maps to ENOTEMPTY */
213 /* WSAEPROCLIM is EPROCLIM */
214 /* WSAEUSERS is EUSERS */
215 /* WSAEDQUOT is EDQUOT */
216 /* WSAESTALE is ESTALE */
217 /* WSAEREMOTE is EREMOTE */
219 msg = "Network subsystem is unavailable";
221 case WSAVERNOTSUPPORTED:
222 msg = "Winsock.dll version out of range";
224 case WSANOTINITIALISED:
225 msg = "Successful WSAStartup not yet performed";
228 msg = "Graceful shutdown in progress";
230 case WSAENOMORE: case WSA_E_NO_MORE:
231 msg = "No more results";
233 case WSAECANCELLED: case WSA_E_CANCELLED:
234 msg = "Call was canceled";
236 case WSAEINVALIDPROCTABLE:
237 msg = "Procedure call table is invalid";
239 case WSAEINVALIDPROVIDER:
240 msg = "Service provider is invalid";
242 case WSAEPROVIDERFAILEDINIT:
243 msg = "Service provider failed to initialize";
245 case WSASYSCALLFAILURE:
246 msg = "System call failure";
248 case WSASERVICE_NOT_FOUND:
249 msg = "Service not found";
251 case WSATYPE_NOT_FOUND:
252 msg = "Class type not found";
255 msg = "Database query was refused";
257 case WSAHOST_NOT_FOUND:
258 msg = "Host not found";
261 msg = "Nonauthoritative host not found";
264 msg = "Nonrecoverable error";
267 msg = "Valid name, no data record of requested type";
269 /* WSA_QOS_* omitted */
273 # if GNULIB_defined_ENOMSG
275 msg = "No message of desired type";
279 # if GNULIB_defined_EIDRM
281 msg = "Identifier removed";
285 # if GNULIB_defined_ENOLINK
287 msg = "Link has been severed";
291 # if GNULIB_defined_EPROTO
293 msg = "Protocol error";
297 # if GNULIB_defined_EMULTIHOP
299 msg = "Multihop attempted";
303 # if GNULIB_defined_EBADMSG
309 # if GNULIB_defined_EOVERFLOW
311 msg = "Value too large for defined data type";
315 # if GNULIB_defined_ENOTSUP
317 msg = "Not supported";
321 # if GNULIB_defined_ESTALE
323 msg = "Stale NFS file handle";
327 # if GNULIB_defined_EDQUOT
329 msg = "Disk quota exceeded";
333 # if GNULIB_defined_ECANCELED
335 msg = "Operation canceled";
344 char *result = strerror (n);
346 if (result == NULL || result[0] == '\0')
348 static char const fmt[] = "Unknown error (%d)";
349 static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
350 sprintf (msg_buf, fmt, n);