1 //===========================================================================
5 // ANSI error code string routine
7 //===========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later version.
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 // You should have received a copy of the GNU General Public License along
23 // with eCos; if not, write to the Free Software Foundation, Inc.,
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 // As a special exception, if other files instantiate templates or use macros
27 // or inline functions from this file, or you compile this file and link it
28 // with other works to produce a work based on this file, this file does not
29 // by itself cause the resulting work to be covered by the GNU General Public
30 // License. However the source code for this file must still be made available
31 // in accordance with section (3) of the GNU General Public License.
33 // This exception does not invalidate any other reasons why a work based on
34 // this file might be covered by the GNU General Public License.
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 // at http://sources.redhat.com/ecos/ecos-license/
38 // -------------------------------------------
39 //####ECOSGPLCOPYRIGHTEND####
40 //===========================================================================
41 //#####DESCRIPTIONBEGIN####
43 // Author(s): jlarmour
46 // Purpose: To provide the strerror() implementation
47 // Description: This implements strerror() as described in ANSI chap 7.11.6.2
48 // Usage: See <cyg/error/codes.h>
50 //####DESCRIPTIONEND####
52 //===========================================================================
57 #include <pkgconf/error.h> // Configuration header
61 #include <cyg/infra/cyg_type.h> // Common project-wide type definitions
62 #include <cyg/infra/cyg_trac.h> // Tracing support
63 #include <cyg/error/codes.h> // Error code definitions and header for this
69 strerror( int errnum ) __attribute__ ((weak, alias("__strerror") ));
74 __strerror( int errnum )
78 CYG_REPORT_FUNCNAMETYPE( "__strerror", "String form of error is \"%s\"" );
85 s = (char *)"No error";
91 s = (char *)"Not permitted";
97 s = (char *)"No such entity";
103 s = (char *)"No such process";
109 s = (char *)"Operation interrupted";
115 s = (char *)"I/O error";
121 s = (char *)"Bad file handle";
127 s = (char *)"Try again later";
133 s = (char *)"Out of memory";
139 s = (char *)"Resource busy";
145 s = (char *)"No such device";
151 s = (char *)"Not a directory";
157 s = (char *)"Is a directory";
163 s = (char *)"Invalid argument";
169 s = (char *)"Too many open files in system";
175 s = (char *)"Too many open files";
181 s = (char *)"File too large";
187 s = (char *)"No space left on device";
193 s = (char *)"Illegal seek";
199 s = (char *)"Read-only file system";
205 s = (char *)"Argument to math function outside valid domain";
211 s = (char *)"Math result cannot be represented";
217 s = (char *)"Resource deadlock would occur";
223 s = (char *)"Function not implemented";
229 s = (char *)"File name too long";
235 s = (char *)"Not supported";
241 s = (char *)"End of file reached";
247 s = (char *)"Operation not supported";
253 s = (char *)"Device does not support this operation";
259 s = (char *)"Improper link";
263 // Additional errors used by networking
266 s = (char *)"Device not configured";
271 s = (char *)"Permission denied";
276 s = (char *)"File exists";
281 s = (char *)"Inappropriate ioctl for device";
286 s = (char *)"Broken pipe";
291 s = (char *)"Operation now in progress";
296 s = (char *)"Operation already in progress";
301 s = (char *)"Socket operation on non-socket";
306 s = (char *)"Destination address required";
311 s = (char *)"Message too long";
316 s = (char *)"Protocol wrong type for socket";
321 s = (char *)"Protocol not available";
324 #ifdef EPROTONOSUPPORT
325 case EPROTONOSUPPORT:
326 s = (char *)"Protocol not supported";
329 #ifdef ESOCKTNOSUPPORT
330 case ESOCKTNOSUPPORT:
331 s = (char *)"Socket type not supported";
336 s = (char *)"Operation not supported";
341 s = (char *)"Protocol family not supported";
346 s = (char *)"Address family not supported by protocol family";
351 s = (char *)"Address already in use";
356 s = (char *)"Can't assign requested address";
361 s = (char *)"Network is down";
366 s = (char *)"Network is unreachable";
371 s = (char *)"Network dropped connection on reset";
376 s = (char *)"Software caused connection abort";
381 s = (char *)"Connection reset by peer";
386 s = (char *)"No buffer space available";
391 s = (char *)"Socket is already connected";
396 s = (char *)"Socket is not connected";
401 s = (char *)"Can't send after socket shutdown";
406 s = (char *)"Too many references: can't splice";
411 s = (char *)"Operation timed out";
416 s = (char *)"Connection refused";
421 s = (char *)"Host is down";
426 s = (char *)"No route to host";
431 s = (char *)"Unknown error";
436 CYG_REPORT_RETVAL(s);