Mercurial > flash_v2
comparison packages/error/current/include/codes.h @ 0:3111d98ba7b3 ecos-v1_1-release
Initial commit of eCos version 1.1
| author | jlarmour |
|---|---|
| date | Tue, 11 May 1999 11:16:07 +0000 |
| parents | |
| children | 443894e2e912 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:3111d98ba7b3 |
|---|---|
| 1 #ifndef CYGONCE_ERROR_CODES_H | |
| 2 #define CYGONCE_ERROR_CODES_H | |
| 3 //=========================================================================== | |
| 4 // | |
| 5 // codes.h | |
| 6 // | |
| 7 // Common error code definitions | |
| 8 // | |
| 9 //=========================================================================== | |
| 10 //####COPYRIGHTBEGIN#### | |
| 11 // | |
| 12 // ------------------------------------------- | |
| 13 // The contents of this file are subject to the Cygnus eCos Public License | |
| 14 // Version 1.0 (the "License"); you may not use this file except in | |
| 15 // compliance with the License. You may obtain a copy of the License at | |
| 16 // http://sourceware.cygnus.com/ecos | |
| 17 // | |
| 18 // Software distributed under the License is distributed on an "AS IS" | |
| 19 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 20 // License for the specific language governing rights and limitations under | |
| 21 // the License. | |
| 22 // | |
| 23 // The Original Code is eCos - Embedded Cygnus Operating System, released | |
| 24 // September 30, 1998. | |
| 25 // | |
| 26 // The Initial Developer of the Original Code is Cygnus. Portions created | |
| 27 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. | |
| 28 // ------------------------------------------- | |
| 29 // | |
| 30 //####COPYRIGHTEND#### | |
| 31 //=========================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 34 // Author(s): jlarmour@cygnus.co.uk | |
| 35 // Contributors: jlarmour@cygnus.co.uk | |
| 36 // Date: 1998-06-11 | |
| 37 // Purpose: To provide a common set of error codes | |
| 38 // Description: This provides a common set of error codes that all packages can | |
| 39 // agree on. It doesn't preclude them defining their own error | |
| 40 // return system, but this is a preferable system to use to help | |
| 41 // error support be as general as possible. | |
| 42 // | |
| 43 // We try and conform to the ANSI/POSIX error code format, namely | |
| 44 // starting with the character 'E' | |
| 45 // | |
| 46 // Usage: #include <cyg/error/codes.h> | |
| 47 // | |
| 48 // Example: | |
| 49 // | |
| 50 // err=myfun(); | |
| 51 // if (err != ENOERR) | |
| 52 // { | |
| 53 // str=strerror(err); | |
| 54 // printf("myfun returned error: %s\n", str); | |
| 55 // } | |
| 56 // else .... | |
| 57 // | |
| 58 //####DESCRIPTIONEND#### | |
| 59 // | |
| 60 //=========================================================================== | |
| 61 | |
| 62 // CONFIGURATION | |
| 63 | |
| 64 #include <pkgconf/error.h> // Configuration header | |
| 65 #include <cyg/infra/cyg_type.h> // externC | |
| 66 | |
| 67 // Include the error package? | |
| 68 #ifdef CYGPKG_ERROR | |
| 69 | |
| 70 | |
| 71 // TYPE DEFINITIONS | |
| 72 | |
| 73 // A type for error codes which may be useful to explain the purpose of | |
| 74 // a variable or return code. It shows that it contains an error code | |
| 75 // of the type defined below | |
| 76 | |
| 77 typedef int Cyg_ErrNo; | |
| 78 | |
| 79 | |
| 80 // FUNCTION PROTOTYPES | |
| 81 | |
| 82 // ANSI standard strerror() function as described by ANSI chap. 7.11.6.2. | |
| 83 // This is normally provided by <string.h> | |
| 84 | |
| 85 externC char * | |
| 86 strerror( Cyg_ErrNo ); | |
| 87 | |
| 88 // prototype for the actual implementation. Equivalent to the above, but | |
| 89 // used internally by this product in preference | |
| 90 | |
| 91 externC char * | |
| 92 _strerror( Cyg_ErrNo ); | |
| 93 | |
| 94 | |
| 95 // CONSTANT DEFINITIONS | |
| 96 | |
| 97 // If adding to this list, you must also update strerror() with its text | |
| 98 // If there is a common error of the same purpose on Unix, try and use its | |
| 99 // name and number. If not, use one above 200 to prevent future conflicts | |
| 100 // | |
| 101 // Do not use negative numbers, so that functions can return positive on | |
| 102 // success and -ESOMETHING on error, and it all works consistently. | |
| 103 | |
| 104 #define ENOERR 0 // No error | |
| 105 #define EPERM 1 // Not permitted | |
| 106 #define ENOENT 2 // No such entity | |
| 107 #define ESRCH 3 // No such process | |
| 108 #define EINTR 4 // Operation interrupted | |
| 109 #define EIO 5 // I/O error | |
| 110 #define EBADF 9 // Bad file handle | |
| 111 #define EAGAIN 11 // Try again later | |
| 112 #define EWOULDBLOCK EAGAIN | |
| 113 #define ENOMEM 12 // Out of memory | |
| 114 #define EBUSY 16 // Resource busy | |
| 115 #define ENODEV 19 // No such device | |
| 116 #define EINVAL 22 // Invalid argument | |
| 117 #define EMFILE 24 // Too many open files | |
| 118 #define EDOM 33 // Argument to math function outside valid | |
| 119 // domain | |
| 120 #define ERANGE 34 // Math result cannot be represented | |
| 121 #define ENOSYS 38 // Function not implemented | |
| 122 | |
| 123 #define EEOF 200 // End of file reached | |
| 124 #define ENOSUPP 201 // Operation not supported | |
| 125 #define EDEVNOSUPP 202 // Device does not support this operation | |
| 126 | |
| 127 #endif // ifdef CYGPKG_ERROR | |
| 128 | |
| 129 #endif // CYGONCE_ERROR_CODES_H multiple inclusion protection | |
| 130 | |
| 131 // EOF codes.h |
