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-2010 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"
38 # if ! HAVE_DECL_STRERROR
39 # define strerror(n) NULL
45 char const *msg = NULL;
46 /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */
49 # if GNULIB_defined_ETXTBSY
51 msg = "Text file busy";
55 # if GNULIB_defined_ESOCK /* native Windows platforms */
56 /* EWOULDBLOCK is the same as EAGAIN. */
58 msg = "Operation now in progress";
61 msg = "Operation already in progress";
64 msg = "Socket operation on non-socket";
67 msg = "Destination address required";
70 msg = "Message too long";
73 msg = "Protocol wrong type for socket";
76 msg = "Protocol not available";
79 msg = "Protocol not supported";
82 msg = "Socket type not supported";
85 msg = "Operation not supported";
88 msg = "Protocol family not supported";
91 msg = "Address family not supported by protocol";
94 msg = "Address already in use";
97 msg = "Cannot assign requested address";
100 msg = "Network is down";
103 msg = "Network is unreachable";
106 msg = "Network dropped connection on reset";
109 msg = "Software caused connection abort";
112 msg = "Connection reset by peer";
115 msg = "No buffer space available";
118 msg = "Transport endpoint is already connected";
121 msg = "Transport endpoint is not connected";
124 msg = "Cannot send after transport endpoint shutdown";
127 msg = "Too many references: cannot splice";
130 msg = "Connection timed out";
133 msg = "Connection refused";
136 msg = "Too many levels of symbolic links";
139 msg = "Host is down";
142 msg = "No route to host";
145 msg = "Too many processes";
148 msg = "Too many users";
151 msg = "Disk quota exceeded";
154 msg = "Stale NFS file handle";
157 msg = "Object is remote";
160 /* WSA_INVALID_HANDLE maps to EBADF */
161 /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
162 /* WSA_INVALID_PARAMETER maps to EINVAL */
163 case WSA_OPERATION_ABORTED:
164 msg = "Overlapped operation aborted";
166 case WSA_IO_INCOMPLETE:
167 msg = "Overlapped I/O event object not in signaled state";
170 msg = "Overlapped operations will complete later";
172 /* WSAEINTR maps to EINTR */
173 /* WSAEBADF maps to EBADF */
174 /* WSAEACCES maps to EACCES */
175 /* WSAEFAULT maps to EFAULT */
176 /* WSAEINVAL maps to EINVAL */
177 /* WSAEMFILE maps to EMFILE */
178 /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
179 /* WSAEINPROGRESS is EINPROGRESS */
180 /* WSAEALREADY is EALREADY */
181 /* WSAENOTSOCK is ENOTSOCK */
182 /* WSAEDESTADDRREQ is EDESTADDRREQ */
183 /* WSAEMSGSIZE is EMSGSIZE */
184 /* WSAEPROTOTYPE is EPROTOTYPE */
185 /* WSAENOPROTOOPT is ENOPROTOOPT */
186 /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */
187 /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
188 /* WSAEOPNOTSUPP is EOPNOTSUPP */
189 /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
190 /* WSAEAFNOSUPPORT is EAFNOSUPPORT */
191 /* WSAEADDRINUSE is EADDRINUSE */
192 /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */
193 /* WSAENETDOWN is ENETDOWN */
194 /* WSAENETUNREACH is ENETUNREACH */
195 /* WSAENETRESET is ENETRESET */
196 /* WSAECONNABORTED is ECONNABORTED */
197 /* WSAECONNRESET is ECONNRESET */
198 /* WSAENOBUFS is ENOBUFS */
199 /* WSAEISCONN is EISCONN */
200 /* WSAENOTCONN is ENOTCONN */
201 /* WSAESHUTDOWN is ESHUTDOWN */
202 /* WSAETOOMANYREFS is ETOOMANYREFS */
203 /* WSAETIMEDOUT is ETIMEDOUT */
204 /* WSAECONNREFUSED is ECONNREFUSED */
205 /* WSAELOOP is ELOOP */
206 /* WSAENAMETOOLONG maps to ENAMETOOLONG */
207 /* WSAEHOSTDOWN is EHOSTDOWN */
208 /* WSAEHOSTUNREACH is EHOSTUNREACH */
209 /* WSAENOTEMPTY maps to ENOTEMPTY */
210 /* WSAEPROCLIM is EPROCLIM */
211 /* WSAEUSERS is EUSERS */
212 /* WSAEDQUOT is EDQUOT */
213 /* WSAESTALE is ESTALE */
214 /* WSAEREMOTE is EREMOTE */
216 msg = "Network subsystem is unavailable";
218 case WSAVERNOTSUPPORTED:
219 msg = "Winsock.dll version out of range";
221 case WSANOTINITIALISED:
222 msg = "Successful WSAStartup not yet performed";
225 msg = "Graceful shutdown in progress";
227 case WSAENOMORE: case WSA_E_NO_MORE:
228 msg = "No more results";
230 case WSAECANCELLED: case WSA_E_CANCELLED:
231 msg = "Call was canceled";
233 case WSAEINVALIDPROCTABLE:
234 msg = "Procedure call table is invalid";
236 case WSAEINVALIDPROVIDER:
237 msg = "Service provider is invalid";
239 case WSAEPROVIDERFAILEDINIT:
240 msg = "Service provider failed to initialize";
242 case WSASYSCALLFAILURE:
243 msg = "System call failure";
245 case WSASERVICE_NOT_FOUND:
246 msg = "Service not found";
248 case WSATYPE_NOT_FOUND:
249 msg = "Class type not found";
252 msg = "Database query was refused";
254 case WSAHOST_NOT_FOUND:
255 msg = "Host not found";
258 msg = "Nonauthoritative host not found";
261 msg = "Nonrecoverable error";
264 msg = "Valid name, no data record of requested type";
266 /* WSA_QOS_* omitted */
270 # if GNULIB_defined_ENOMSG
272 msg = "No message of desired type";
276 # if GNULIB_defined_EIDRM
278 msg = "Identifier removed";
282 # if GNULIB_defined_ENOLINK
284 msg = "Link has been severed";
288 # if GNULIB_defined_EPROTO
290 msg = "Protocol error";
294 # if GNULIB_defined_EMULTIHOP
296 msg = "Multihop attempted";
300 # if GNULIB_defined_EBADMSG
306 # if GNULIB_defined_EOVERFLOW
308 msg = "Value too large for defined data type";
312 # if GNULIB_defined_ENOTSUP
314 msg = "Not supported";
318 # if GNULIB_defined_ESTALE
320 msg = "Stale NFS file handle";
324 # if GNULIB_defined_ECANCELED
326 msg = "Operation canceled";
335 char *result = strerror (n);
337 if (result == NULL || result[0] == '\0')
339 static char const fmt[] = "Unknown error (%d)";
340 static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
341 sprintf (msg_buf, fmt, n);