You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

errno.h 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. /*
  2. * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. *
  19. * You can also choose to distribute this program under the terms of
  20. * the Unmodified Binary Distribution Licence (as given in the file
  21. * COPYING.UBDL), provided that you have satisfied its requirements.
  22. */
  23. #ifndef ERRNO_H
  24. #define ERRNO_H
  25. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  26. /** @file
  27. *
  28. * Error codes
  29. *
  30. * Return status codes as used within iPXE are designed to allow for
  31. * maximum visibility into the source of an error even in an end-user
  32. * build with no debugging. They are constructed as follows:
  33. *
  34. * Bits 7-0 : Platform-specific error code
  35. *
  36. * This is a losslessly compressed representation of the closest
  37. * equivalent error code defined by the platform (e.g. BIOS/PXE or
  38. * EFI). It is used to generate errors to be returned to external
  39. * code.
  40. *
  41. * Bits 12-8 : Per-file disambiguator
  42. *
  43. * When the same error code can be generated from multiple points
  44. * within a file, this field can be used to identify the unique
  45. * instance.
  46. *
  47. * Bits 23-13 : File identifier
  48. *
  49. * This is a unique identifier for the file generating the error
  50. * (e.g. ERRFILE_tcp for tcp.c).
  51. *
  52. * Bits 30-24 : POSIX error code
  53. *
  54. * This is the closest equivalent POSIX error code (e.g. ENOMEM).
  55. *
  56. * Bit 31 : Reserved
  57. *
  58. * Errors are usually return as negative error codes (e.g. -EINVAL);
  59. * bit 31 is therefore unusable.
  60. *
  61. *
  62. * The convention within the code is that errors are negative and
  63. * expressed using the POSIX error, e.g.
  64. *
  65. * return -EINVAL;
  66. *
  67. * By various bits of preprocessor magic, the platform-specific error
  68. * code and file identifier are already incorporated into the
  69. * definition of the POSIX error macro, which keeps the code
  70. * relatively clean.
  71. *
  72. *
  73. * Functions that wish to return failures should be declared as
  74. * returning an integer @c rc "Return status code". A return value of
  75. * zero indicates success, a non-zero value indicates failure. The
  76. * return value can be passed directly to strerror() in order to
  77. * generate a human-readable error message, e.g.
  78. *
  79. * if ( ( rc = some_function ( ... ) ) != 0 ) {
  80. * DBG ( "Whatever I was trying to do failed: %s\n", strerror ( rc ) );
  81. * return rc;
  82. * }
  83. *
  84. * As illustrated in the above example, error returns should generally
  85. * be directly propagated upward to the calling function.
  86. *
  87. *
  88. * Individual files may declare localised errors using
  89. * __einfo_uniqify(). For example, iscsi.c declares a localised
  90. * version of EACCES for the error of "access denied due to incorrect
  91. * target username":
  92. *
  93. * #define EACCES_INCORRECT_TARGET_USERNAME \
  94. * __einfo_error ( EINFO_EACCES_INCORRECT_TARGET_USERNAME )
  95. * #define EINFO_EACCES_INCORRECT_TARGET_USERNAME \
  96. * __einfo_uniqify ( EINFO_EACCESS, 0x01, "Incorrect target username" )
  97. *
  98. * which can then be used as:
  99. *
  100. * return -EACCES_INCORRECT_TARGET_USERNAME;
  101. *
  102. */
  103. /* Get definitions for platform-specific error codes */
  104. #define PLATFORM_ERRNO(_platform) <ipxe/errno/_platform.h>
  105. #include PLATFORM_ERRNO(PLATFORM)
  106. /* Get definitions for file identifiers */
  107. #include <ipxe/errfile.h>
  108. /* If we do not have a valid file identifier, generate a compiler
  109. * warning upon usage of any error codes. (Don't just use a #warning,
  110. * because some files include errno.h but don't ever actually use any
  111. * error codes.)
  112. */
  113. #if ! ERRFILE
  114. extern char missing_errfile_declaration[] __attribute__ (( deprecated ));
  115. #undef ERRFILE
  116. #define ERRFILE ( ( int ) ( 0 * ( ( intptr_t ) missing_errfile_declaration ) ) )
  117. #endif
  118. /**
  119. * Declare error information
  120. *
  121. * @v platform Platform error code (uncompressed)
  122. * @v posix POSIX error code (0x00-0x7f)
  123. * @v uniq Error disambiguator (0x00-0x1f)
  124. * @v desc Error description
  125. * @ret einfo Error information
  126. */
  127. #define __einfo( platform, posix, uniq, desc ) ( platform, posix, uniq, desc )
  128. /**
  129. * Get platform error code
  130. *
  131. * @v einfo Error information
  132. * @ret platform Platform error code (uncompressed)
  133. */
  134. #define __einfo_platform( einfo ) __einfo_extract_platform einfo
  135. #define __einfo_extract_platform( platform, posix, uniq, desc ) platform
  136. /**
  137. * Get POSIX error code
  138. *
  139. * @v einfo Error information
  140. * @ret posix POSIX error code
  141. */
  142. #define __einfo_posix( einfo ) __einfo_extract_posix einfo
  143. #define __einfo_extract_posix( platform, posix, uniq, desc ) posix
  144. /**
  145. * Get error disambiguator
  146. *
  147. * @v einfo Error information
  148. * @ret uniq Error disambiguator
  149. */
  150. #define __einfo_uniq( einfo ) __einfo_extract_uniq einfo
  151. #define __einfo_extract_uniq( platform, posix, uniq, desc ) uniq
  152. /**
  153. * Get error description
  154. *
  155. * @v einfo Error information
  156. * @ret desc Error description
  157. */
  158. #define __einfo_desc( einfo ) __einfo_extract_desc einfo
  159. #define __einfo_extract_desc( platform, posix, uniq, desc ) desc
  160. /**
  161. * Declare disambiguated error
  162. *
  163. * @v einfo_base Base error information
  164. * @v uniq Error disambiguator (0x00-0x1f)
  165. * @v desc Error description
  166. * @ret einfo Error information
  167. */
  168. #define __einfo_uniqify( einfo_base, uniq, desc ) \
  169. __einfo ( __einfo_platform ( einfo_base ), \
  170. __einfo_posix ( einfo_base ), \
  171. uniq, desc )
  172. /**
  173. * Declare platform-generated error
  174. *
  175. * @v einfo_base Base error information
  176. * @v platform Platform error code (uncompressed)
  177. * @v desc Error description
  178. * @ret einfo Error information
  179. */
  180. #define __einfo_platformify( einfo_base, platform, desc ) \
  181. __einfo ( platform, __einfo_posix ( einfo_base ), \
  182. __einfo_uniq ( einfo_base ), desc )
  183. /**
  184. * Get error code
  185. *
  186. * @v einfo Error information
  187. * @ret errno Error code
  188. */
  189. #define __einfo_errno( einfo ) \
  190. ( ( int ) \
  191. ( ( __einfo_posix ( einfo ) << 24 ) | ( ERRFILE ) | \
  192. ( __einfo_uniq ( einfo ) << 8 ) | \
  193. ( PLATFORM_TO_ERRNO ( __einfo_platform ( einfo ) ) << 0 ) ) )
  194. /**
  195. * Disambiguate a base error based on non-constant information
  196. *
  197. * @v einfo_base Base error information
  198. * @v uniq Error disambiguator (0x00-0x1f)
  199. * @v ... List of expected possible disambiguated errors
  200. * @ret error Error
  201. *
  202. * EUNIQ() should be used when information from an external source is
  203. * being incorporated into an error. For example, the 802.11 stack
  204. * uses EUNIQ() to incorporate 802.11 status codes returned by an
  205. * access point into an error.
  206. *
  207. * EUNIQ() should not be used for constant error disambiguators; use
  208. * __einfo_uniqify() instead.
  209. */
  210. #define EUNIQ( einfo_base, uniq, ... ) ( { \
  211. euniq_discard ( 0, ##__VA_ARGS__ ); \
  212. ( ( int ) ( __einfo_error ( einfo_base ) | \
  213. ( (uniq) << 8 ) ) ); } )
  214. static inline void euniq_discard ( int dummy __unused, ... ) {}
  215. /**
  216. * Generate an error based on an external platform error code
  217. *
  218. * @v einfo_base Base error information
  219. * @v platform Platform error code (uncompressed)
  220. * @v ... List of expected possible platform-generated errors
  221. * @ret error Error
  222. *
  223. * EPLATFORM() should be used when a platform error code resulting
  224. * from an external platform API call is being incorporated into an
  225. * error. For example, EFI code uses EPLATFORM() to generate errors
  226. * resulting from calls to EFI APIs such as
  227. * InstallMultipleProtocolInterfaces().
  228. *
  229. * EPLATFORM() should not be used for constant platform-generated
  230. * errors; use __einfo_platformify() instead.
  231. */
  232. #define EPLATFORM( einfo_base, platform, ... ) ( { \
  233. eplatform_discard ( 0, ##__VA_ARGS__ ); \
  234. ( ( int ) ( __einfo_error ( einfo_base ) | \
  235. PLATFORM_TO_ERRNO ( platform ) ) ); } )
  236. static inline void eplatform_discard ( int dummy __unused, ... ) {}
  237. /**
  238. * Declare error
  239. *
  240. * @v einfo Error information
  241. * @ret error Error
  242. */
  243. #define __einfo_error( einfo ) ( { \
  244. __asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
  245. ".align 8\n\t" \
  246. "\n1:\n\t" \
  247. ".long ( 4f - 1b )\n\t" \
  248. ".long %c0\n\t" \
  249. ".long ( 2f - 1b )\n\t" \
  250. ".long ( 3f - 1b )\n\t" \
  251. ".long %c1\n\t" \
  252. "\n2:\t.asciz \"" __einfo_desc ( einfo ) "\"\n\t" \
  253. "\n3:\t.asciz \"" __FILE__ "\"\n\t" \
  254. ".align 8\n\t" \
  255. "\n4:\n\t" \
  256. ".previous\n\t" : : \
  257. "i" ( __einfo_errno ( einfo ) ), \
  258. "i" ( __LINE__ ) ); \
  259. __einfo_errno ( einfo ); } )
  260. /**
  261. * @defgroup posixerrors POSIX error codes
  262. *
  263. * The names and meanings (but not the values) of these error codes
  264. * are defined by POSIX.
  265. *
  266. * @{
  267. */
  268. /** Operation completed successfully */
  269. #define ENOERR __einfo_error ( EINFO_ENOERR )
  270. #define EINFO_ENOERR __einfo ( PLATFORM_ENOERR, 0x00, 0, \
  271. "Operation completed successfully" )
  272. /** Argument list too long */
  273. #define E2BIG __einfo_error ( EINFO_E2BIG )
  274. #define EINFO_E2BIG __einfo ( PLATFORM_E2BIG, 0x01, 0, \
  275. "Argument list too long" )
  276. /** Permission denied */
  277. #define EACCES __einfo_error ( EINFO_EACCES )
  278. #define EINFO_EACCES __einfo ( PLATFORM_EACCES, 0x02, 0, \
  279. "Permission denied" )
  280. /** Address already in use */
  281. #define EADDRINUSE __einfo_error ( EINFO_EADDRINUSE )
  282. #define EINFO_EADDRINUSE __einfo ( PLATFORM_EADDRINUSE, 0x03, 0, \
  283. "Address already in use" )
  284. /** Address not available */
  285. #define EADDRNOTAVAIL __einfo_error ( EINFO_EADDRNOTAVAIL )
  286. #define EINFO_EADDRNOTAVAIL __einfo ( PLATFORM_EADDRNOTAVAIL, 0x04, 0, \
  287. "Address not available" )
  288. /** Address family not supported */
  289. #define EAFNOSUPPORT __einfo_error ( EINFO_EAFNOSUPPORT )
  290. #define EINFO_EAFNOSUPPORT __einfo ( PLATFORM_EAFNOSUPPORT, 0x05, 0, \
  291. "Address family not supported" )
  292. /** Resource temporarily unavailable */
  293. #define EAGAIN __einfo_error ( EINFO_EAGAIN )
  294. #define EINFO_EAGAIN __einfo ( PLATFORM_EAGAIN, 0x06, 0, \
  295. "Resource temporarily unavailable" )
  296. /** Connection already in progress */
  297. #define EALREADY __einfo_error ( EINFO_EALREADY )
  298. #define EINFO_EALREADY __einfo ( PLATFORM_EALREADY, 0x07, 0, \
  299. "Connection already in progress" )
  300. /** Bad file descriptor */
  301. #define EBADF __einfo_error ( EINFO_EBADF )
  302. #define EINFO_EBADF __einfo ( PLATFORM_EBADF, 0x08, 0, \
  303. "Bad file descriptor" )
  304. /** Bad message */
  305. #define EBADMSG __einfo_error ( EINFO_EBADMSG )
  306. #define EINFO_EBADMSG __einfo ( PLATFORM_EBADMSG, 0x09, 0, \
  307. "Bad message" )
  308. /** Device or resource busy */
  309. #define EBUSY __einfo_error ( EINFO_EBUSY )
  310. #define EINFO_EBUSY __einfo ( PLATFORM_EBUSY, 0x0a, 0, \
  311. "Device or resource busy" )
  312. /** Operation canceled */
  313. #define ECANCELED __einfo_error ( EINFO_ECANCELED )
  314. #define EINFO_ECANCELED __einfo ( PLATFORM_ECANCELED, 0x0b, 0, \
  315. "Operation canceled" )
  316. /** No child processes */
  317. #define ECHILD __einfo_error ( EINFO_ECHILD )
  318. #define EINFO_ECHILD __einfo ( PLATFORM_ECHILD, 0x0c, 0, \
  319. "No child processes" )
  320. /** Connection aborted */
  321. #define ECONNABORTED __einfo_error ( EINFO_ECONNABORTED )
  322. #define EINFO_ECONNABORTED __einfo ( PLATFORM_ECONNABORTED, 0x0d, 0, \
  323. "Connection aborted" )
  324. /** Connection refused */
  325. #define ECONNREFUSED __einfo_error ( EINFO_ECONNREFUSED )
  326. #define EINFO_ECONNREFUSED __einfo ( PLATFORM_ECONNREFUSED, 0x0e, 0, \
  327. "Connection refused" )
  328. /** Connection reset */
  329. #define ECONNRESET __einfo_error ( EINFO_ECONNRESET )
  330. #define EINFO_ECONNRESET __einfo ( PLATFORM_ECONNRESET, 0x0f, 0, \
  331. "Connection reset" )
  332. /** Resource deadlock avoided */
  333. #define EDEADLK __einfo_error ( EINFO_EDEADLK )
  334. #define EINFO_EDEADLK __einfo ( PLATFORM_EDEADLK, 0x10, 0, \
  335. "Resource deadlock avoided" )
  336. /** Destination address required */
  337. #define EDESTADDRREQ __einfo_error ( EINFO_EDESTADDRREQ )
  338. #define EINFO_EDESTADDRREQ __einfo ( PLATFORM_EDESTADDRREQ, 0x11, 0, \
  339. "Destination address required" )
  340. /** Mathematics argument out of domain of function */
  341. #define EDOM __einfo_error ( EINFO_EDOM )
  342. #define EINFO_EDOM __einfo ( PLATFORM_EDOM, 0x12, 0, \
  343. "Mathematics argument out of domain of function" )
  344. /** Disk quota exceeded */
  345. #define EDQUOT __einfo_error ( EINFO_EDQUOT )
  346. #define EINFO_EDQUOT __einfo ( PLATFORM_EDQUOT, 0x13, 0, \
  347. "Disk quote exceeded" )
  348. /** File exists */
  349. #define EEXIST __einfo_error ( EINFO_EEXIST )
  350. #define EINFO_EEXIST __einfo ( PLATFORM_EEXIST, 0x14, 0, \
  351. "File exists" )
  352. /** Bad address */
  353. #define EFAULT __einfo_error ( EINFO_EFAULT )
  354. #define EINFO_EFAULT __einfo ( PLATFORM_EFAULT, 0x15, 0, \
  355. "Bad address" )
  356. /** File too large */
  357. #define EFBIG __einfo_error ( EINFO_EFBIG )
  358. #define EINFO_EFBIG __einfo ( PLATFORM_EFBIG, 0x16, 0, \
  359. "File too large" )
  360. /** Host is unreachable */
  361. #define EHOSTUNREACH __einfo_error ( EINFO_EHOSTUNREACH )
  362. #define EINFO_EHOSTUNREACH __einfo ( PLATFORM_EHOSTUNREACH, 0x17, 0, \
  363. "Host is unreachable" )
  364. /** Identifier removed */
  365. #define EIDRM __einfo_error ( EINFO_EIDRM )
  366. #define EINFO_EIDRM __einfo ( PLATFORM_EIDRM, 0x18, 0, \
  367. "Identifier removed" )
  368. /** Illegal byte sequence */
  369. #define EILSEQ __einfo_error ( EINFO_EILSEQ )
  370. #define EINFO_EILSEQ __einfo ( PLATFORM_EILSEQ, 0x19, 0, \
  371. "Illegal byte sequence" )
  372. /** Operation in progress */
  373. #define EINPROGRESS __einfo_error ( EINFO_EINPROGRESS )
  374. #define EINFO_EINPROGRESS __einfo ( PLATFORM_EINPROGRESS, 0x1a, 0, \
  375. "Operation in progress" )
  376. /** Interrupted function call */
  377. #define EINTR __einfo_error ( EINFO_EINTR )
  378. #define EINFO_EINTR __einfo ( PLATFORM_EINTR, 0x1b, 0, \
  379. "Interrupted function call" )
  380. /** Invalid argument */
  381. #define EINVAL __einfo_error ( EINFO_EINVAL )
  382. #define EINFO_EINVAL __einfo ( PLATFORM_EINVAL, 0x1c, 0, \
  383. "Invalid argument" )
  384. /** Input/output error */
  385. #define EIO __einfo_error ( EINFO_EIO )
  386. #define EINFO_EIO __einfo ( PLATFORM_EIO, 0x1d, 0, \
  387. "Input/output error" )
  388. /** Socket is connected */
  389. #define EISCONN __einfo_error ( EINFO_EISCONN )
  390. #define EINFO_EISCONN __einfo ( PLATFORM_EISCONN, 0x1e, 0, \
  391. "Socket is connected" )
  392. /** Is a directory */
  393. #define EISDIR __einfo_error ( EINFO_EISDIR )
  394. #define EINFO_EISDIR __einfo ( PLATFORM_EISDIR, 0x1f, 0, \
  395. "Is a directory" )
  396. /** Too many levels of symbolic links */
  397. #define ELOOP __einfo_error ( EINFO_ELOOP )
  398. #define EINFO_ELOOP __einfo ( PLATFORM_ELOOP, 0x20, 0, \
  399. "Too many levels of symbolic links" )
  400. /** Too many open files */
  401. #define EMFILE __einfo_error ( EINFO_EMFILE )
  402. #define EINFO_EMFILE __einfo ( PLATFORM_EMFILE, 0x21, 0, \
  403. "Too many open files" )
  404. /** Too many links */
  405. #define EMLINK __einfo_error ( EINFO_EMLINK )
  406. #define EINFO_EMLINK __einfo ( PLATFORM_EMLINK, 0x22, 0, \
  407. "Too many links" )
  408. /** Message too long */
  409. #define EMSGSIZE __einfo_error ( EINFO_EMSGSIZE )
  410. #define EINFO_EMSGSIZE __einfo ( PLATFORM_EMSGSIZE, 0x23, 0, \
  411. "Message too long" )
  412. /** Multihop attempted */
  413. #define EMULTIHOP __einfo_error ( EINFO_EMULTIHOP )
  414. #define EINFO_EMULTIHOP __einfo ( PLATFORM_EMULTIHOP, 0x24, 0, \
  415. "Multihop attempted" )
  416. /** Filename too long */
  417. #define ENAMETOOLONG __einfo_error ( EINFO_ENAMETOOLONG )
  418. #define EINFO_ENAMETOOLONG __einfo ( PLATFORM_ENAMETOOLONG, 0x25, 0, \
  419. "Filename too long" )
  420. /** Network is down */
  421. #define ENETDOWN __einfo_error ( EINFO_ENETDOWN )
  422. #define EINFO_ENETDOWN __einfo ( PLATFORM_ENETDOWN, 0x26, 0, \
  423. "Network is down" )
  424. /** Connection aborted by network */
  425. #define ENETRESET __einfo_error ( EINFO_ENETRESET )
  426. #define EINFO_ENETRESET __einfo ( PLATFORM_ENETRESET, 0x27, 0, \
  427. "Connection aborted by network" )
  428. /** Network unreachable */
  429. #define ENETUNREACH __einfo_error ( EINFO_ENETUNREACH )
  430. #define EINFO_ENETUNREACH __einfo ( PLATFORM_ENETUNREACH, 0x28, 0, \
  431. "Network unreachable" )
  432. /** Too many open files in system */
  433. #define ENFILE __einfo_error ( EINFO_ENFILE )
  434. #define EINFO_ENFILE __einfo ( PLATFORM_ENFILE, 0x29, 0, \
  435. "Too many open files in system" )
  436. /** No buffer space available */
  437. #define ENOBUFS __einfo_error ( EINFO_ENOBUFS )
  438. #define EINFO_ENOBUFS __einfo ( PLATFORM_ENOBUFS, 0x2a, 0, \
  439. "No buffer space available" )
  440. /** No message is available on the STREAM head read queue */
  441. #define ENODATA __einfo_error ( EINFO_ENODATA )
  442. #define EINFO_ENODATA __einfo ( PLATFORM_ENODATA, 0x2b, 0, \
  443. "No message is available on the STREAM " \
  444. "head read queue" )
  445. /** No such device */
  446. #define ENODEV __einfo_error ( EINFO_ENODEV )
  447. #define EINFO_ENODEV __einfo ( PLATFORM_ENODEV, 0x2c, 0, \
  448. "No such device" )
  449. /** No such file or directory */
  450. #define ENOENT __einfo_error ( EINFO_ENOENT )
  451. #define EINFO_ENOENT __einfo ( PLATFORM_ENOENT, 0x2d, 0, \
  452. "No such file or directory" )
  453. /** Exec format error */
  454. #define ENOEXEC __einfo_error ( EINFO_ENOEXEC )
  455. #define EINFO_ENOEXEC __einfo ( PLATFORM_ENOEXEC, 0x2e, 0, \
  456. "Exec format error" )
  457. /** No locks available */
  458. #define ENOLCK __einfo_error ( EINFO_ENOLCK )
  459. #define EINFO_ENOLCK __einfo ( PLATFORM_ENOLCK, 0x2f, 0, \
  460. "No locks available" )
  461. /** Link has been severed */
  462. #define ENOLINK __einfo_error ( EINFO_ENOLINK )
  463. #define EINFO_ENOLINK __einfo ( PLATFORM_ENOLINK, 0x30, 0, \
  464. "Link has been severed" )
  465. /** Not enough space */
  466. #define ENOMEM __einfo_error ( EINFO_ENOMEM )
  467. #define EINFO_ENOMEM __einfo ( PLATFORM_ENOMEM, 0x31, 0, \
  468. "Not enough space" )
  469. /** No message of the desired type */
  470. #define ENOMSG __einfo_error ( EINFO_ENOMSG )
  471. #define EINFO_ENOMSG __einfo ( PLATFORM_ENOMSG, 0x32, 0, \
  472. "No message of the desired type" )
  473. /** Protocol not available */
  474. #define ENOPROTOOPT __einfo_error ( EINFO_ENOPROTOOPT )
  475. #define EINFO_ENOPROTOOPT __einfo ( PLATFORM_ENOPROTOOPT, 0x33, 0, \
  476. "Protocol not available" )
  477. /** No space left on device */
  478. #define ENOSPC __einfo_error ( EINFO_ENOSPC )
  479. #define EINFO_ENOSPC __einfo ( PLATFORM_ENOSPC, 0x34, 0, \
  480. "No space left on device" )
  481. /** No STREAM resources */
  482. #define ENOSR __einfo_error ( EINFO_ENOSR )
  483. #define EINFO_ENOSR __einfo ( PLATFORM_ENOSR, 0x35, 0, \
  484. "No STREAM resources" )
  485. /** Not a STREAM */
  486. #define ENOSTR __einfo_error ( EINFO_ENOSTR )
  487. #define EINFO_ENOSTR __einfo ( PLATFORM_ENOSTR, 0x36, 0, \
  488. "Not a STREAM" )
  489. /** Function not implemented */
  490. #define ENOSYS __einfo_error ( EINFO_ENOSYS )
  491. #define EINFO_ENOSYS __einfo ( PLATFORM_ENOSYS, 0x37, 0, \
  492. "Function not implemented" )
  493. /** The socket is not connected */
  494. #define ENOTCONN __einfo_error ( EINFO_ENOTCONN )
  495. #define EINFO_ENOTCONN __einfo ( PLATFORM_ENOTCONN, 0x38, 0, \
  496. "The socket is not connected" )
  497. /** Not a directory */
  498. #define ENOTDIR __einfo_error ( EINFO_ENOTDIR )
  499. #define EINFO_ENOTDIR __einfo ( PLATFORM_ENOTDIR, 0x39, 0, \
  500. "Not a directory" )
  501. /** Directory not empty */
  502. #define ENOTEMPTY __einfo_error ( EINFO_ENOTEMPTY )
  503. #define EINFO_ENOTEMPTY __einfo ( PLATFORM_ENOTEMPTY, 0x3a, 0, \
  504. "Directory not empty" )
  505. /** Not a socket */
  506. #define ENOTSOCK __einfo_error ( EINFO_ENOTSOCK )
  507. #define EINFO_ENOTSOCK __einfo ( PLATFORM_ENOTSOCK, 0x3b, 0, \
  508. "Not a socket" )
  509. /** Operation not supported */
  510. #define ENOTSUP __einfo_error ( EINFO_ENOTSUP )
  511. #define EINFO_ENOTSUP __einfo ( PLATFORM_ENOTSUP, 0x3c, 0, \
  512. "Operation not supported" )
  513. /** Inappropriate I/O control operation */
  514. #define ENOTTY __einfo_error ( EINFO_ENOTTY )
  515. #define EINFO_ENOTTY __einfo ( PLATFORM_ENOTTY, 0x3d, 0, \
  516. "Inappropriate I/O control operation" )
  517. /** No such device or address */
  518. #define ENXIO __einfo_error ( EINFO_ENXIO )
  519. #define EINFO_ENXIO __einfo ( PLATFORM_ENXIO, 0x3e, 0, \
  520. "No such device or address" )
  521. /** Operation not supported on socket */
  522. #define EOPNOTSUPP __einfo_error ( EINFO_EOPNOTSUPP )
  523. #define EINFO_EOPNOTSUPP __einfo ( PLATFORM_EOPNOTSUPP, 0x3f, 0, \
  524. "Operation not supported on socket" )
  525. /** Value too large to be stored in data type */
  526. #define EOVERFLOW __einfo_error ( EINFO_EOVERFLOW )
  527. #define EINFO_EOVERFLOW __einfo ( PLATFORM_EOVERFLOW, 0x40, 0, \
  528. "Value too large to be stored in data type" )
  529. /** Operation not permitted */
  530. #define EPERM __einfo_error ( EINFO_EPERM )
  531. #define EINFO_EPERM __einfo ( PLATFORM_EPERM, 0x41, 0, \
  532. "Operation not permitted" )
  533. /** Broken pipe */
  534. #define EPIPE __einfo_error ( EINFO_EPIPE )
  535. #define EINFO_EPIPE __einfo ( PLATFORM_EPIPE, 0x42, 0, \
  536. "Broken pipe" )
  537. /** Protocol error */
  538. #define EPROTO __einfo_error ( EINFO_EPROTO )
  539. #define EINFO_EPROTO __einfo ( PLATFORM_EPROTO, 0x43, 0, \
  540. "Protocol error" )
  541. /** Protocol not supported */
  542. #define EPROTONOSUPPORT __einfo_error ( EINFO_EPROTONOSUPPORT )
  543. #define EINFO_EPROTONOSUPPORT __einfo ( PLATFORM_EPROTONOSUPPORT, 0x44, 0, \
  544. "Protocol not supported" )
  545. /** Protocol wrong type for socket */
  546. #define EPROTOTYPE __einfo_error ( EINFO_EPROTOTYPE )
  547. #define EINFO_EPROTOTYPE __einfo ( PLATFORM_EPROTOTYPE, 0x45, 0, \
  548. "Protocol wrong type for socket" )
  549. /** Result too large */
  550. #define ERANGE __einfo_error ( EINFO_ERANGE )
  551. #define EINFO_ERANGE __einfo ( PLATFORM_ERANGE, 0x46, 0, \
  552. "Result too large" )
  553. /** Read-only file system */
  554. #define EROFS __einfo_error ( EINFO_EROFS )
  555. #define EINFO_EROFS __einfo ( PLATFORM_EROFS, 0x47, 0, \
  556. "Read-only file system" )
  557. /** Invalid seek */
  558. #define ESPIPE __einfo_error ( EINFO_ESPIPE )
  559. #define EINFO_ESPIPE __einfo ( PLATFORM_ESPIPE, 0x48, 0, \
  560. "Invalid seek" )
  561. /** No such process */
  562. #define ESRCH __einfo_error ( EINFO_ESRCH )
  563. #define EINFO_ESRCH __einfo ( PLATFORM_ESRCH, 0x49, 0, \
  564. "No such process" )
  565. /** Stale file handle */
  566. #define ESTALE __einfo_error ( EINFO_ESTALE )
  567. #define EINFO_ESTALE __einfo ( PLATFORM_ESTALE, 0x4a, 0, \
  568. "Stale file handle" )
  569. /** Timer expired */
  570. #define ETIME __einfo_error ( EINFO_ETIME )
  571. #define EINFO_ETIME __einfo ( PLATFORM_ETIME, 0x4b, 0, \
  572. "Timer expired" )
  573. /** Connection timed out */
  574. #define ETIMEDOUT __einfo_error ( EINFO_ETIMEDOUT )
  575. #define EINFO_ETIMEDOUT __einfo ( PLATFORM_ETIMEDOUT, 0x4c, 0, \
  576. "Connection timed out" )
  577. /** Text file busy */
  578. #define ETXTBSY __einfo_error ( EINFO_ETXTBSY )
  579. #define EINFO_ETXTBSY __einfo ( PLATFORM_ETXTBSY, 0x4d, 0, \
  580. "Text file busy" )
  581. /** Operation would block */
  582. #define EWOULDBLOCK __einfo_error ( EINFO_EWOULDBLOCK )
  583. #define EINFO_EWOULDBLOCK __einfo ( PLATFORM_EWOULDBLOCK, 0x4e, 0, \
  584. "Operation would block" )
  585. /** Improper link */
  586. #define EXDEV __einfo_error ( EINFO_EXDEV )
  587. #define EINFO_EXDEV __einfo ( PLATFORM_EXDEV, 0x4f, 0, \
  588. "Improper link" )
  589. /** @} */
  590. /** Platform-generated base error */
  591. #define EINFO_EPLATFORM __einfo ( 0, 0x7f, 0, "Platform-generated error" )
  592. extern int errno;
  593. #endif /* ERRNO_H */