codes.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. // ####ECOSGPLCOPYRIGHTBEGIN####
  11. // -------------------------------------------
  12. // This file is part of eCos, the Embedded Configurable Operating System.
  13. // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
  14. //
  15. // eCos is free software; you can redistribute it and/or modify it under
  16. // the terms of the GNU General Public License as published by the Free
  17. // Software Foundation; either version 2 or (at your option) any later
  18. // version.
  19. //
  20. // eCos is distributed in the hope that it will be useful, but WITHOUT
  21. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  22. // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  23. // for more details.
  24. //
  25. // You should have received a copy of the GNU General Public License
  26. // along with eCos; if not, write to the Free Software Foundation, Inc.,
  27. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  28. //
  29. // As a special exception, if other files instantiate templates or use
  30. // macros or inline functions from this file, or you compile this file
  31. // and link it with other works to produce a work based on this file,
  32. // this file does not by itself cause the resulting work to be covered by
  33. // the GNU General Public License. However the source code for this file
  34. // must still be made available in accordance with section (3) of the GNU
  35. // General Public License v2.
  36. //
  37. // This exception does not invalidate any other reasons why a work based
  38. // on this file might be covered by the GNU General Public License.
  39. // -------------------------------------------
  40. // ####ECOSGPLCOPYRIGHTEND####
  41. //===========================================================================
  42. //#####DESCRIPTIONBEGIN####
  43. //
  44. // Author(s): jlarmour
  45. // Contributors: jlarmour
  46. // Date: 2000-04-14
  47. // Purpose: To provide a common set of error codes
  48. // Description: This provides a common set of error codes that all
  49. // packages can agree on. It doesn't preclude them defining
  50. // their own error return system, but this is a preferable
  51. // system to use to help error support be as general as
  52. // possible.
  53. //
  54. // We try and conform to the ANSI/POSIX error code format,
  55. // namely starting with the character 'E'
  56. //
  57. // Usage: #include <cyg/error/codes.h>
  58. //
  59. // Example:
  60. //
  61. // err=myfun();
  62. // if (err != ENOERR)
  63. // {
  64. // str=strerror(err);
  65. // printf("myfun returned error: %s\n", str);
  66. // }
  67. // else ....
  68. //
  69. //####DESCRIPTIONEND####
  70. //
  71. //=========================================================================*/
  72. /* CONFIGURATION */
  73. //#include <pkgconf/error.h> prife // Configuration header
  74. #ifdef __cplusplus
  75. extern "C" {
  76. #endif
  77. /* TYPE DEFINITIONS */
  78. /* A type for error codes which may be useful to explain the purpose of
  79. * a variable or return code. It shows that it contains an error code
  80. * of the type defined below */
  81. typedef int Cyg_ErrNo;
  82. /* CONSTANT DEFINITIONS */
  83. /* If adding to this list, you must also update strerror() with its text
  84. * If there is a common error of the same purpose on Unix, try and use its
  85. * name and number. If not, use one above 200 to prevent future conflicts
  86. *
  87. * Do not use negative numbers, so that functions can return positive on
  88. * success and -ESOMETHING on error, and it all works consistently.
  89. */
  90. #define ENOERR 0 /* No error */
  91. #define EPERM 1 /* Not permitted */
  92. #define ENOENT 2 /* No such entity */
  93. #define ESRCH 3 /* No such process */
  94. #define EINTR 4 /* Operation interrupted */
  95. #define EIO 5 /* I/O error */
  96. #define EBADF 9 /* Bad file handle */
  97. #define EAGAIN 11 /* Try again later */
  98. #define EWOULDBLOCK EAGAIN
  99. #define ENOMEM 12 /* Out of memory */
  100. #define EBUSY 16 /* Resource busy */
  101. #define EXDEV 18 /* Cross-device link */
  102. #define ENODEV 19 /* No such device */
  103. #define ENOTDIR 20 /* Not a directory */
  104. #define EISDIR 21 /* Is a directory */
  105. #define EINVAL 22 /* Invalid argument */
  106. #define ENFILE 23 /* Too many open files in system */
  107. #define EMFILE 24 /* Too many open files */
  108. #define EFBIG 27 /* File too large */
  109. #define ENOSPC 28 /* No space left on device */
  110. #define ESPIPE 29 /* Illegal seek */
  111. #define EROFS 30 /* Read-only file system */
  112. #define EDOM 33 /* Argument to math function outside valid */
  113. /* domain */
  114. #define ERANGE 34 /* Math result cannot be represented */
  115. #define EDEADLK 35 /* Resource deadlock would occur */
  116. #define EDEADLOCK EDEADLK
  117. #define ENOSYS 38 /* Function not implemented */
  118. #define ENAMETOOLONG 60 /* File name too long */
  119. #define ENOTEMPTY 66 /* Directory not empty */
  120. #define ENOTSUP 95 /* Not supported error */
  121. #define EEOF 200 /* End of file reached */
  122. #define ENOSUPP 201 /* Operation not supported */
  123. #define EDEVNOSUPP 202 /* Device does not support this operation */
  124. /* Additional errors used by networking */
  125. #define ENXIO 300 /* Device not configured */
  126. #define EACCES 301 /* Permission denied */
  127. #define EEXIST 302 /* File exists */
  128. #define ENOTTY 303 /* Inappropriate ioctl for device */
  129. #define EPIPE 304 /* Broken pipe */
  130. /* non-blocking and interrupt i/o */
  131. #define EINPROGRESS 310 /* Operation now in progress */
  132. #define EALREADY 311 /* Operation already in progress */
  133. /* ipc/network software -- argument errors */
  134. #define ENOTSOCK 320 /* Socket operation on non-socket */
  135. #define EDESTADDRREQ 321 /* Destination address required */
  136. #define EMSGSIZE 322 /* Message too long */
  137. #define EPROTOTYPE 323 /* Protocol wrong type for socket */
  138. #define ENOPROTOOPT 324 /* Protocol not available */
  139. #define EPROTONOSUPPORT 325 /* Protocol not supported */
  140. #define ESOCKTNOSUPPORT 326 /* Socket type not supported */
  141. #define EOPNOTSUPP 327 /* Operation not supported */
  142. #define EPFNOSUPPORT 328 /* Protocol family not supported */
  143. #define EAFNOSUPPORT 329 /* Address family not supported by */
  144. /* protocol family */
  145. #define EADDRINUSE 330 /* Address already in use */
  146. #define EADDRNOTAVAIL 331 /* Can't assign requested address */
  147. /* ipc/network software -- operational errors */
  148. #define ENETDOWN 350 /* Network is down */
  149. #define ENETUNREACH 351 /* Network is unreachable */
  150. #define ENETRESET 352 /* Network dropped connection on reset */
  151. #define ECONNABORTED 353 /* Software caused connection abort */
  152. #define ECONNRESET 354 /* Connection reset by peer */
  153. #define ENOBUFS 355 /* No buffer space available */
  154. #define EISCONN 356 /* Socket is already connected */
  155. #define ENOTCONN 357 /* Socket is not connected */
  156. #define ESHUTDOWN 358 /* Can't send after socket shutdown */
  157. #define ETOOMANYREFS 359 /* Too many references: can't splice */
  158. #define ETIMEDOUT 360 /* Operation timed out */
  159. #define ECONNREFUSED 361 /* Connection refused */
  160. #define EHOSTDOWN 364 /* Host is down */
  161. #define EHOSTUNREACH 365 /* No route to host */
  162. #ifdef __cplusplus
  163. } /* extern "C" */
  164. #endif
  165. #endif /* CYGONCE_ERROR_CODES_H multiple inclusion protection */
  166. /* EOF codes.h */