1 /* strerror-override.c --- POSIX compatible system error routine
3 Copyright (C) 2010-2011 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_ESOCK /* 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_ETXTBSY
47 return "Text file busy";
50 #if GNULIB_defined_ESOCK /* native Windows platforms */
51 /* EWOULDBLOCK is the same as EAGAIN. */
53 return "Operation now in progress";
55 return "Operation already in progress";
57 return "Socket operation on non-socket";
59 return "Destination address required";
61 return "Message too long";
63 return "Protocol wrong type for socket";
65 return "Protocol not available";
67 return "Protocol not supported";
69 return "Socket type not supported";
71 return "Operation not supported";
73 return "Protocol family not supported";
75 return "Address family not supported by protocol";
77 return "Address already in use";
79 return "Cannot assign requested address";
81 return "Network is down";
83 return "Network is unreachable";
85 return "Network dropped connection on reset";
87 return "Software caused connection abort";
89 return "Connection reset by peer";
91 return "No buffer space available";
93 return "Transport endpoint is already connected";
95 return "Transport endpoint is not connected";
97 return "Cannot send after transport endpoint shutdown";
99 return "Too many references: cannot splice";
101 return "Connection timed out";
103 return "Connection refused";
105 return "Too many levels of symbolic links";
107 return "Host is down";
109 return "No route to host";
111 return "Too many processes";
113 return "Too many users";
115 return "Disk quota exceeded";
117 return "Stale NFS file handle";
119 return "Object is remote";
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";
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 */
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";
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";
198 return "Database query was refused";
199 case WSAHOST_NOT_FOUND
:
200 return "Host not found";
202 return "Nonauthoritative host not found";
204 return "Nonrecoverable error";
206 return "Valid name, no data record of requested type";
207 /* WSA_QOS_* omitted */
211 #if GNULIB_defined_ENOMSG
213 return "No message of desired type";
216 #if GNULIB_defined_EIDRM
218 return "Identifier removed";
221 #if GNULIB_defined_ENOLINK
223 return "Link has been severed";
226 #if GNULIB_defined_EPROTO
228 return "Protocol error";
231 #if GNULIB_defined_EMULTIHOP
233 return "Multihop attempted";
236 #if GNULIB_defined_EBADMSG
238 return "Bad message";
241 #if GNULIB_defined_EOVERFLOW
243 return "Value too large for defined data type";
246 #if GNULIB_defined_ENOTSUP
248 return "Not supported";
251 #if GNULIB_defined_ENETRESET
253 return "Network dropped connection on reset";
256 #if GNULIB_defined_ECONNABORTED
258 return "Software caused connection abort";
261 #if GNULIB_defined_ESTALE
263 return "Stale NFS file handle";
266 #if GNULIB_defined_EDQUOT
268 return "Disk quota exceeded";
271 #if GNULIB_defined_ECANCELED
273 return "Operation canceled";