annotate lib/strerror.c @ 448:5cccf90bf838 3.0 tip

Fixed bug with complex external references generating invalid relocations in the object file
author lost@l-w.ca
date Fri, 05 Nov 2010 22:27:00 -0600
parents b8bf63962a99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
434
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
1 /* strerror.c --- POSIX compatible system error routine
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
2
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
3 Copyright (C) 2007-2010 Free Software Foundation, Inc.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
4
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
8 (at your option) any later version.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
9
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
13 GNU General Public License for more details.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
14
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
17
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
18 #include <config.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
19
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
20 #include <string.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
21
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
22 #if REPLACE_STRERROR
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
23
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
24 # include <errno.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
25 # include <stdio.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
26
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
27 # if GNULIB_defined_ESOCK /* native Windows platforms */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
28 # if HAVE_WINSOCK2_H
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
29 # include <winsock2.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
30 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
31 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
32
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
33 # include "intprops.h"
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
34
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
35 # undef strerror
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
36 # if ! HAVE_DECL_STRERROR
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
37 # define strerror(n) NULL
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
38 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
39
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
40 char *
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
41 rpl_strerror (int n)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
42 {
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
43 char const *msg = NULL;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
44 /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
45 switch (n)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
46 {
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
47 # if GNULIB_defined_ETXTBSY
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
48 case ETXTBSY:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
49 msg = "Text file busy";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
50 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
51 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
52
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
53 # if GNULIB_defined_ESOCK /* native Windows platforms */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
54 /* EWOULDBLOCK is the same as EAGAIN. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
55 case EINPROGRESS:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
56 msg = "Operation now in progress";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
57 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
58 case EALREADY:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
59 msg = "Operation already in progress";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
60 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
61 case ENOTSOCK:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
62 msg = "Socket operation on non-socket";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
63 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
64 case EDESTADDRREQ:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
65 msg = "Destination address required";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
66 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
67 case EMSGSIZE:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
68 msg = "Message too long";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
69 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
70 case EPROTOTYPE:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
71 msg = "Protocol wrong type for socket";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
72 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
73 case ENOPROTOOPT:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
74 msg = "Protocol not available";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
75 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
76 case EPROTONOSUPPORT:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
77 msg = "Protocol not supported";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
78 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
79 case ESOCKTNOSUPPORT:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
80 msg = "Socket type not supported";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
81 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
82 case EOPNOTSUPP:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
83 msg = "Operation not supported";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
84 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
85 case EPFNOSUPPORT:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
86 msg = "Protocol family not supported";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
87 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
88 case EAFNOSUPPORT:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
89 msg = "Address family not supported by protocol";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
90 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
91 case EADDRINUSE:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
92 msg = "Address already in use";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
93 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
94 case EADDRNOTAVAIL:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
95 msg = "Cannot assign requested address";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
96 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
97 case ENETDOWN:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
98 msg = "Network is down";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
99 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
100 case ENETUNREACH:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
101 msg = "Network is unreachable";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
102 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
103 case ENETRESET:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
104 msg = "Network dropped connection on reset";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
105 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
106 case ECONNABORTED:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
107 msg = "Software caused connection abort";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
108 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
109 case ECONNRESET:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
110 msg = "Connection reset by peer";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
111 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
112 case ENOBUFS:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
113 msg = "No buffer space available";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
114 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
115 case EISCONN:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
116 msg = "Transport endpoint is already connected";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
117 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
118 case ENOTCONN:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
119 msg = "Transport endpoint is not connected";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
120 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
121 case ESHUTDOWN:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
122 msg = "Cannot send after transport endpoint shutdown";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
123 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
124 case ETOOMANYREFS:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
125 msg = "Too many references: cannot splice";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
126 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
127 case ETIMEDOUT:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
128 msg = "Connection timed out";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
129 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
130 case ECONNREFUSED:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
131 msg = "Connection refused";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
132 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
133 case ELOOP:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
134 msg = "Too many levels of symbolic links";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
135 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
136 case EHOSTDOWN:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
137 msg = "Host is down";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
138 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
139 case EHOSTUNREACH:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
140 msg = "No route to host";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
141 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
142 case EPROCLIM:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
143 msg = "Too many processes";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
144 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
145 case EUSERS:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
146 msg = "Too many users";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
147 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
148 case EDQUOT:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
149 msg = "Disk quota exceeded";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
150 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
151 case ESTALE:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
152 msg = "Stale NFS file handle";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
153 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
154 case EREMOTE:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
155 msg = "Object is remote";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
156 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
157 # if HAVE_WINSOCK2_H
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
158 /* WSA_INVALID_HANDLE maps to EBADF */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
159 /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
160 /* WSA_INVALID_PARAMETER maps to EINVAL */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
161 case WSA_OPERATION_ABORTED:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
162 msg = "Overlapped operation aborted";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
163 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
164 case WSA_IO_INCOMPLETE:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
165 msg = "Overlapped I/O event object not in signaled state";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
166 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
167 case WSA_IO_PENDING:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
168 msg = "Overlapped operations will complete later";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
169 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
170 /* WSAEINTR maps to EINTR */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
171 /* WSAEBADF maps to EBADF */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
172 /* WSAEACCES maps to EACCES */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
173 /* WSAEFAULT maps to EFAULT */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
174 /* WSAEINVAL maps to EINVAL */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
175 /* WSAEMFILE maps to EMFILE */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
176 /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
177 /* WSAEINPROGRESS is EINPROGRESS */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
178 /* WSAEALREADY is EALREADY */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
179 /* WSAENOTSOCK is ENOTSOCK */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
180 /* WSAEDESTADDRREQ is EDESTADDRREQ */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
181 /* WSAEMSGSIZE is EMSGSIZE */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
182 /* WSAEPROTOTYPE is EPROTOTYPE */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
183 /* WSAENOPROTOOPT is ENOPROTOOPT */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
184 /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
185 /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
186 /* WSAEOPNOTSUPP is EOPNOTSUPP */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
187 /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
188 /* WSAEAFNOSUPPORT is EAFNOSUPPORT */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
189 /* WSAEADDRINUSE is EADDRINUSE */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
190 /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
191 /* WSAENETDOWN is ENETDOWN */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
192 /* WSAENETUNREACH is ENETUNREACH */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
193 /* WSAENETRESET is ENETRESET */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
194 /* WSAECONNABORTED is ECONNABORTED */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
195 /* WSAECONNRESET is ECONNRESET */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
196 /* WSAENOBUFS is ENOBUFS */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
197 /* WSAEISCONN is EISCONN */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
198 /* WSAENOTCONN is ENOTCONN */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
199 /* WSAESHUTDOWN is ESHUTDOWN */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
200 /* WSAETOOMANYREFS is ETOOMANYREFS */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
201 /* WSAETIMEDOUT is ETIMEDOUT */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
202 /* WSAECONNREFUSED is ECONNREFUSED */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
203 /* WSAELOOP is ELOOP */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
204 /* WSAENAMETOOLONG maps to ENAMETOOLONG */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
205 /* WSAEHOSTDOWN is EHOSTDOWN */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
206 /* WSAEHOSTUNREACH is EHOSTUNREACH */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
207 /* WSAENOTEMPTY maps to ENOTEMPTY */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
208 /* WSAEPROCLIM is EPROCLIM */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
209 /* WSAEUSERS is EUSERS */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
210 /* WSAEDQUOT is EDQUOT */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
211 /* WSAESTALE is ESTALE */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
212 /* WSAEREMOTE is EREMOTE */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
213 case WSASYSNOTREADY:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
214 msg = "Network subsystem is unavailable";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
215 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
216 case WSAVERNOTSUPPORTED:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
217 msg = "Winsock.dll version out of range";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
218 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
219 case WSANOTINITIALISED:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
220 msg = "Successful WSAStartup not yet performed";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
221 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
222 case WSAEDISCON:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
223 msg = "Graceful shutdown in progress";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
224 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
225 case WSAENOMORE: case WSA_E_NO_MORE:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
226 msg = "No more results";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
227 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
228 case WSAECANCELLED: case WSA_E_CANCELLED:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
229 msg = "Call was canceled";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
230 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
231 case WSAEINVALIDPROCTABLE:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
232 msg = "Procedure call table is invalid";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
233 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
234 case WSAEINVALIDPROVIDER:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
235 msg = "Service provider is invalid";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
236 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
237 case WSAEPROVIDERFAILEDINIT:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
238 msg = "Service provider failed to initialize";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
239 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
240 case WSASYSCALLFAILURE:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
241 msg = "System call failure";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
242 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
243 case WSASERVICE_NOT_FOUND:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
244 msg = "Service not found";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
245 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
246 case WSATYPE_NOT_FOUND:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
247 msg = "Class type not found";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
248 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
249 case WSAEREFUSED:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
250 msg = "Database query was refused";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
251 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
252 case WSAHOST_NOT_FOUND:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
253 msg = "Host not found";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
254 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
255 case WSATRY_AGAIN:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
256 msg = "Nonauthoritative host not found";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
257 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
258 case WSANO_RECOVERY:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
259 msg = "Nonrecoverable error";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
260 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
261 case WSANO_DATA:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
262 msg = "Valid name, no data record of requested type";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
263 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
264 /* WSA_QOS_* omitted */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
265 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
266 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
267
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
268 # if GNULIB_defined_ENOMSG
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
269 case ENOMSG:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
270 msg = "No message of desired type";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
271 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
272 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
273
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
274 # if GNULIB_defined_EIDRM
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
275 case EIDRM:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
276 msg = "Identifier removed";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
277 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
278 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
279
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
280 # if GNULIB_defined_ENOLINK
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
281 case ENOLINK:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
282 msg = "Link has been severed";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
283 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
284 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
285
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
286 # if GNULIB_defined_EPROTO
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
287 case EPROTO:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
288 msg = "Protocol error";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
289 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
290 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
291
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
292 # if GNULIB_defined_EMULTIHOP
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
293 case EMULTIHOP:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
294 msg = "Multihop attempted";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
295 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
296 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
297
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
298 # if GNULIB_defined_EBADMSG
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
299 case EBADMSG:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
300 msg = "Bad message";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
301 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
302 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
303
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
304 # if GNULIB_defined_EOVERFLOW
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
305 case EOVERFLOW:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
306 msg = "Value too large for defined data type";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
307 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
308 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
309
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
310 # if GNULIB_defined_ENOTSUP
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
311 case ENOTSUP:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
312 msg = "Not supported";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
313 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
314 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
315
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
316 # if GNULIB_defined_ESTALE
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
317 case ESTALE:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
318 msg = "Stale NFS file handle";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
319 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
320 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
321
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
322 # if GNULIB_defined_ECANCELED
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
323 case ECANCELED:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
324 msg = "Operation canceled";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
325 break;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
326 # endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
327 }
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
328
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
329 if (msg)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
330 return (char *) msg;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
331
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
332 {
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
333 char *result = strerror (n);
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
334
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
335 if (result == NULL || result[0] == '\0')
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
336 {
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
337 static char const fmt[] = "Unknown error (%d)";
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
338 static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
339 sprintf (msg_buf, fmt, n);
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
340 return msg_buf;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
341 }
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
342
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
343 return result;
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
344 }
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
345 }
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
346
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
347 #endif