errno.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /* errno is not a global variable, because that would make using it
  2. non-reentrant. Instead, its address is returned by the function
  3. __errno. */
  4. #ifndef _SYS_ERRNO_H_
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. #define _SYS_ERRNO_H_
  9. #include <sys/reent.h>
  10. #ifdef _REENT_THREAD_LOCAL
  11. #define errno (_tls_errno)
  12. #else /* _REENT_THREAD_LOCAL */
  13. #ifndef _REENT_ONLY
  14. #define errno (*__errno())
  15. extern int *__errno (void);
  16. #endif
  17. #endif /* _REENT_THREAD_LOCAL */
  18. /* Please don't use these variables directly.
  19. Use strerror instead. */
  20. extern __IMPORT const char * const _sys_errlist[];
  21. extern __IMPORT int _sys_nerr;
  22. #ifdef __CYGWIN__
  23. extern __IMPORT const char * const sys_errlist[];
  24. extern __IMPORT int sys_nerr;
  25. extern __IMPORT char *program_invocation_name;
  26. extern __IMPORT char *program_invocation_short_name;
  27. #endif
  28. #define __errno_r(ptr) _REENT_ERRNO(ptr)
  29. #define EPERM 1 /* Not owner */
  30. #define ENOENT 2 /* No such file or directory */
  31. #define ESRCH 3 /* No such process */
  32. #define EINTR 4 /* Interrupted system call */
  33. #define EIO 5 /* I/O error */
  34. #define ENXIO 6 /* No such device or address */
  35. #define E2BIG 7 /* Arg list too long */
  36. #define ENOEXEC 8 /* Exec format error */
  37. #define EBADF 9 /* Bad file number */
  38. #define ECHILD 10 /* No children */
  39. #define EAGAIN 11 /* No more processes */
  40. #define ENOMEM 12 /* Not enough space */
  41. #define EACCES 13 /* Permission denied */
  42. #define EFAULT 14 /* Bad address */
  43. #ifdef __LINUX_ERRNO_EXTENSIONS__
  44. #define ENOTBLK 15 /* Block device required */
  45. #endif
  46. #define EBUSY 16 /* Device or resource busy */
  47. #define EEXIST 17 /* File exists */
  48. #define EXDEV 18 /* Cross-device link */
  49. #define ENODEV 19 /* No such device */
  50. #define ENOTDIR 20 /* Not a directory */
  51. #define EISDIR 21 /* Is a directory */
  52. #define EINVAL 22 /* Invalid argument */
  53. #define ENFILE 23 /* Too many open files in system */
  54. #define EMFILE 24 /* File descriptor value too large */
  55. #define ENOTTY 25 /* Not a character device */
  56. #define ETXTBSY 26 /* Text file busy */
  57. #define EFBIG 27 /* File too large */
  58. #define ENOSPC 28 /* No space left on device */
  59. #define ESPIPE 29 /* Illegal seek */
  60. #define EROFS 30 /* Read-only file system */
  61. #define EMLINK 31 /* Too many links */
  62. #define EPIPE 32 /* Broken pipe */
  63. #define EDOM 33 /* Mathematics argument out of domain of function */
  64. #define ERANGE 34 /* Result too large */
  65. #define ENOMSG 35 /* No message of desired type */
  66. #define EIDRM 36 /* Identifier removed */
  67. #ifdef __LINUX_ERRNO_EXTENSIONS__
  68. #define ECHRNG 37 /* Channel number out of range */
  69. #define EL2NSYNC 38 /* Level 2 not synchronized */
  70. #define EL3HLT 39 /* Level 3 halted */
  71. #define EL3RST 40 /* Level 3 reset */
  72. #define ELNRNG 41 /* Link number out of range */
  73. #define EUNATCH 42 /* Protocol driver not attached */
  74. #define ENOCSI 43 /* No CSI structure available */
  75. #define EL2HLT 44 /* Level 2 halted */
  76. #endif
  77. #define EDEADLK 45 /* Deadlock */
  78. #define ENOLCK 46 /* No lock */
  79. #ifdef __LINUX_ERRNO_EXTENSIONS__
  80. #define EBADE 50 /* Invalid exchange */
  81. #define EBADR 51 /* Invalid request descriptor */
  82. #define EXFULL 52 /* Exchange full */
  83. #define ENOANO 53 /* No anode */
  84. #define EBADRQC 54 /* Invalid request code */
  85. #define EBADSLT 55 /* Invalid slot */
  86. #define EDEADLOCK 56 /* File locking deadlock error */
  87. #define EBFONT 57 /* Bad font file fmt */
  88. #endif
  89. #define ENOSTR 60 /* Not a stream */
  90. #define ENODATA 61 /* No data (for no delay io) */
  91. #define ETIME 62 /* Stream ioctl timeout */
  92. #define ENOSR 63 /* No stream resources */
  93. #ifdef __LINUX_ERRNO_EXTENSIONS__
  94. #define ENONET 64 /* Machine is not on the network */
  95. #define ENOPKG 65 /* Package not installed */
  96. #define EREMOTE 66 /* The object is remote */
  97. #endif
  98. #define ENOLINK 67 /* Virtual circuit is gone */
  99. #ifdef __LINUX_ERRNO_EXTENSIONS__
  100. #define EADV 68 /* Advertise error */
  101. #define ESRMNT 69 /* Srmount error */
  102. #define ECOMM 70 /* Communication error on send */
  103. #endif
  104. #define EPROTO 71 /* Protocol error */
  105. #define EMULTIHOP 74 /* Multihop attempted */
  106. #ifdef __LINUX_ERRNO_EXTENSIONS__
  107. #define ELBIN 75 /* Inode is remote (not really error) */
  108. #define EDOTDOT 76 /* Cross mount point (not really error) */
  109. #endif
  110. #define EBADMSG 77 /* Bad message */
  111. #define EFTYPE 79 /* Inappropriate file type or format */
  112. #ifdef __LINUX_ERRNO_EXTENSIONS__
  113. #define ENOTUNIQ 80 /* Given log. name not unique */
  114. #define EBADFD 81 /* f.d. invalid for this operation */
  115. #define EREMCHG 82 /* Remote address changed */
  116. #define ELIBACC 83 /* Can't access a needed shared lib */
  117. #define ELIBBAD 84 /* Accessing a corrupted shared lib */
  118. #define ELIBSCN 85 /* .lib section in a.out corrupted */
  119. #define ELIBMAX 86 /* Attempting to link in too many libs */
  120. #define ELIBEXEC 87 /* Attempting to exec a shared library */
  121. #endif
  122. #define ENOSYS 88 /* Function not implemented */
  123. #ifdef __CYGWIN__
  124. #define ENMFILE 89 /* No more files */
  125. #endif
  126. #define ENOTEMPTY 90 /* Directory not empty */
  127. #define ENAMETOOLONG 91 /* File or path name too long */
  128. #define ELOOP 92 /* Too many symbolic links */
  129. #define EOPNOTSUPP 95 /* Operation not supported on socket */
  130. #define EPFNOSUPPORT 96 /* Protocol family not supported */
  131. #define ECONNRESET 104 /* Connection reset by peer */
  132. #define ENOBUFS 105 /* No buffer space available */
  133. #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
  134. #define EPROTOTYPE 107 /* Protocol wrong type for socket */
  135. #define ENOTSOCK 108 /* Socket operation on non-socket */
  136. #define ENOPROTOOPT 109 /* Protocol not available */
  137. #ifdef __LINUX_ERRNO_EXTENSIONS__
  138. #define ESHUTDOWN 110 /* Can't send after socket shutdown */
  139. #endif
  140. #define ECONNREFUSED 111 /* Connection refused */
  141. #define EADDRINUSE 112 /* Address already in use */
  142. #define ECONNABORTED 113 /* Software caused connection abort */
  143. #define ENETUNREACH 114 /* Network is unreachable */
  144. #define ENETDOWN 115 /* Network interface is not configured */
  145. #define ETIMEDOUT 116 /* Connection timed out */
  146. #define EHOSTDOWN 117 /* Host is down */
  147. #define EHOSTUNREACH 118 /* Host is unreachable */
  148. #define EINPROGRESS 119 /* Connection already in progress */
  149. #define EALREADY 120 /* Socket already connected */
  150. #define EDESTADDRREQ 121 /* Destination address required */
  151. #define EMSGSIZE 122 /* Message too long */
  152. #define EPROTONOSUPPORT 123 /* Unknown protocol */
  153. #ifdef __LINUX_ERRNO_EXTENSIONS__
  154. #define ESOCKTNOSUPPORT 124 /* Socket type not supported */
  155. #endif
  156. #define EADDRNOTAVAIL 125 /* Address not available */
  157. #define ENETRESET 126 /* Connection aborted by network */
  158. #define EISCONN 127 /* Socket is already connected */
  159. #define ENOTCONN 128 /* Socket is not connected */
  160. #define ETOOMANYREFS 129
  161. #ifdef __LINUX_ERRNO_EXTENSIONS__
  162. #define EPROCLIM 130
  163. #define EUSERS 131
  164. #endif
  165. #define EDQUOT 132
  166. #define ESTALE 133
  167. #define ENOTSUP 134 /* Not supported */
  168. #ifdef __LINUX_ERRNO_EXTENSIONS__
  169. #define ENOMEDIUM 135 /* No medium (in tape drive) */
  170. #endif
  171. #if defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
  172. #define ENOSHARE (_Pragma("GCC warning \"'ENOSHARE' is no longer used by Cygwin\"") 136)
  173. #define ECASECLASH (_Pragma("GCC warning \"'ECASECLASH' is no longer used by Cygwin\"") 137)
  174. #endif
  175. #define EILSEQ 138 /* Illegal byte sequence */
  176. #define EOVERFLOW 139 /* Value too large for defined data type */
  177. #define ECANCELED 140 /* Operation canceled */
  178. #define ENOTRECOVERABLE 141 /* State not recoverable */
  179. #define EOWNERDEAD 142 /* Previous owner died */
  180. #ifdef __LINUX_ERRNO_EXTENSIONS__
  181. #define ESTRPIPE 143 /* Streams pipe error */
  182. #endif
  183. #define EWOULDBLOCK EAGAIN /* Operation would block */
  184. #define __ELASTERROR 2000 /* Users can add values starting here */
  185. #ifdef __cplusplus
  186. }
  187. #endif
  188. #endif /* _SYS_ERRNO_H */