1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
|
//===========================================================================
//
// strerror.cxx
//
// ANSI error code string routine
//
//===========================================================================
// ####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later
// version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License
// along with eCos; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// As a special exception, if other files instantiate templates or use
// macros or inline functions from this file, or you compile this file
// and link it with other works to produce a work based on this file,
// this file does not by itself cause the resulting work to be covered by
// the GNU General Public License. However the source code for this file
// must still be made available in accordance with section (3) of the GNU
// General Public License v2.
//
// This exception does not invalidate any other reasons why a work based
// on this file might be covered by the GNU General Public License.
// -------------------------------------------
// ####ECOSGPLCOPYRIGHTEND####
//===========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): jlarmour
// Contributors:
// Date: 2000-04-14
// Purpose: To provide the strerror() implementation
// Description: This implements strerror() as described in ANSI chap 7.11.6.2
// Usage: See <cyg/error/codes.h>
//
//####DESCRIPTIONEND####
//
//===========================================================================
// CONFIGURATION
#include <pkgconf/error.h> // Configuration header
// INCLUDES
#include <cyg/infra/cyg_type.h> // Common project-wide type definitions
#include <cyg/infra/cyg_trac.h> // Tracing support
#include <cyg/error/codes.h> // Error code definitions and header for this
// file
// EXPORTED SYMBOLS
externC char *
strerror( int errnum ) __attribute__ ((weak, alias("__strerror") ));
// FUNCTIONS
externC char *
__strerror( int errnum )
{
register char *s;
CYG_REPORT_FUNCNAMETYPE( "__strerror", "String form of error is \"%s\"" );
switch (errnum)
{
#ifdef ENOERR
case ENOERR:
s = (char *)"No error";
break;
#endif
#ifdef EPERM
case EPERM:
s = (char *)"Not permitted";
break;
#endif
#ifdef ENOENT
case ENOENT:
s = (char *)"No such entity";
break;
#endif
#ifdef ESRCH
case ESRCH:
s = (char *)"No such process";
break;
#endif
#ifdef EINTR
case EINTR:
s = (char *)"Operation interrupted";
break;
#endif
#ifdef EIO
case EIO:
s = (char *)"I/O error";
break;
#endif
#ifdef EBADF
case EBADF:
s = (char *)"Bad file handle";
break;
#endif
#ifdef EAGAIN
case EAGAIN:
s = (char *)"Try again later";
break;
#endif
#ifdef ENOMEM
case ENOMEM:
s = (char *)"Out of memory";
break;
#endif
#ifdef EBUSY
case EBUSY:
s = (char *)"Resource busy";
break;
#endif
#ifdef ENODEV
case ENODEV:
s = (char *)"No such device";
break;
#endif
#ifdef ENOTDIR
case ENOTDIR:
s = (char *)"Not a directory";
break;
#endif
#ifdef EISDIR
case EISDIR:
s = (char *)"Is a directory";
break;
#endif
#ifdef EINVAL
case EINVAL:
s = (char *)"Invalid argument";
break;
#endif
#ifdef ENFILE
case ENFILE:
s = (char *)"Too many open files in system";
break;
#endif
#ifdef EMFILE
case EMFILE:
s = (char *)"Too many open files";
break;
#endif
#ifdef EFBIG
case EFBIG:
s = (char *)"File too large";
break;
#endif
#ifdef ENOSPC
case ENOSPC:
s = (char *)"No space left on device";
break;
#endif
#ifdef ESPIPE
case ESPIPE:
s = (char *)"Illegal seek";
break;
#endif
#ifdef EROFS
case EROFS:
s = (char *)"Read-only file system";
break;
#endif
#ifdef EDOM
case EDOM:
s = (char *)"Argument to math function outside valid domain";
break;
#endif
#ifdef ERANGE
case ERANGE:
s = (char *)"Math result cannot be represented";
break;
#endif
#ifdef EDEADLK
case EDEADLK:
s = (char *)"Resource deadlock would occur";
break;
#endif
#ifdef ENOSYS
case ENOSYS:
s = (char *)"Function not implemented";
break;
#endif
#ifdef ENAMETOOLONG
case ENAMETOOLONG:
s = (char *)"File name too long";
break;
#endif
#ifdef ENOTSUP
case ENOTSUP:
s = (char *)"Not supported";
break;
#endif
#ifdef EEOF
case EEOF:
s = (char *)"End of file reached";
break;
#endif
#ifdef ENOSUPP
case ENOSUPP:
s = (char *)"Operation not supported";
break;
#endif
#ifdef EDEVNOSUPP
case EDEVNOSUPP:
s = (char *)"Device does not support this operation";
break;
#endif
#ifdef EXDEV
case EXDEV:
s = (char *)"Improper link";
break;
#endif
// Additional errors used by networking
#ifdef ENXIO
case ENXIO:
s = (char *)"Device not configured";
break;
#endif
#ifdef EACCES
case EACCES:
s = (char *)"Permission denied";
break;
#endif
#ifdef EEXIST
case EEXIST:
s = (char *)"File exists";
break;
#endif
#ifdef ENOTTY
case ENOTTY:
s = (char *)"Inappropriate ioctl for device";
break;
#endif
#ifdef EPIPE
case EPIPE:
s = (char *)"Broken pipe";
break;
#endif
#ifdef EINPROGRESS
case EINPROGRESS:
s = (char *)"Operation now in progress";
break;
#endif
#ifdef EALREADY
case EALREADY:
s = (char *)"Operation already in progress";
break;
#endif
#ifdef ENOTSOCK
case ENOTSOCK:
s = (char *)"Socket operation on non-socket";
break;
#endif
#ifdef EDESTADDRREQ
case EDESTADDRREQ:
s = (char *)"Destination address required";
break;
#endif
#ifdef EMSGSIZE
case EMSGSIZE:
s = (char *)"Message too long";
break;
#endif
#ifdef EPROTOTYPE
case EPROTOTYPE:
s = (char *)"Protocol wrong type for socket";
break;
#endif
#ifdef ENOPROTOOPT
case ENOPROTOOPT:
s = (char *)"Protocol not available";
break;
#endif
#ifdef EPROTONOSUPPORT
case EPROTONOSUPPORT:
s = (char *)"Protocol not supported";
break;
#endif
#ifdef ESOCKTNOSUPPORT
case ESOCKTNOSUPPORT:
s = (char *)"Socket type not supported";
break;
#endif
#ifdef EOPNOTSUPP
case EOPNOTSUPP:
s = (char *)"Operation not supported";
break;
#endif
#ifdef EPFNOSUPPORT
case EPFNOSUPPORT:
s = (char *)"Protocol family not supported";
break;
#endif
#ifdef EAFNOSUPPORT
case EAFNOSUPPORT:
s = (char *)"Address family not supported by protocol family";
break;
#endif
#ifdef EADDRINUSE
case EADDRINUSE:
s = (char *)"Address already in use";
break;
#endif
#ifdef EADDRNOTAVAIL
case EADDRNOTAVAIL:
s = (char *)"Can't assign requested address";
break;
#endif
#ifdef ENETDOWN
case ENETDOWN:
s = (char *)"Network is down";
break;
#endif
#ifdef ENETUNREACH
case ENETUNREACH:
s = (char *)"Network is unreachable";
break;
#endif
#ifdef ENETRESET
case ENETRESET:
s = (char *)"Network dropped connection on reset";
break;
#endif
#ifdef ECONNABORTED
case ECONNABORTED:
s = (char *)"Software caused connection abort";
break;
#endif
#ifdef ECONNRESET
case ECONNRESET:
s = (char *)"Connection reset by peer";
break;
#endif
#ifdef ENOBUFS
case ENOBUFS:
s = (char *)"No buffer space available";
break;
#endif
#ifdef EISCONN
case EISCONN:
s = (char *)"Socket is already connected";
break;
#endif
#ifdef ENOTCONN
case ENOTCONN:
s = (char *)"Socket is not connected";
break;
#endif
#ifdef ESHUTDOWN
case ESHUTDOWN:
s = (char *)"Can't send after socket shutdown";
break;
#endif
#ifdef ETOOMANYREFS
case ETOOMANYREFS:
s = (char *)"Too many references: can't splice";
break;
#endif
#ifdef ETIMEDOUT
case ETIMEDOUT:
s = (char *)"Operation timed out";
break;
#endif
#ifdef ECONNREFUSED
case ECONNREFUSED:
s = (char *)"Connection refused";
break;
#endif
#ifdef EHOSTDOWN
case EHOSTDOWN:
s = (char *)"Host is down";
break;
#endif
#ifdef EHOSTUNREACH
case EHOSTUNREACH:
s = (char *)"No route to host";
break;
#endif
default:
s = (char *)"Unknown error";
break;
} // switch
CYG_REPORT_RETVAL(s);
return s;
} // __strerror()
// EOF strerror.cxx
|