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 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  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. #ifndef ERRNO_H
  20. #define ERRNO_H
  21. FILE_LICENCE ( GPL2_OR_LATER );
  22. /** @file
  23. *
  24. * Error codes
  25. *
  26. * Return status codes as used within iPXE are designed to allow for
  27. * maximum visibility into the source of an error even in an end-user
  28. * build with no debugging. They are constructed as follows:
  29. *
  30. * Bits 7-0 : PXE error code
  31. *
  32. * This is the closest equivalent PXE error code
  33. * (e.g. PXENV_STATUS_OUT_OF_RESOURCES), and is the only part of the
  34. * error that will be returned via the PXE API, since PXE has
  35. * predefined error codes.
  36. *
  37. * Bits 12-8 : Per-file disambiguator
  38. *
  39. * When the same error number can be generated from multiple points
  40. * within a file, this field can be used to identify the unique
  41. * instance.
  42. *
  43. * Bits 23-13 : File identifier
  44. *
  45. * This is a unique identifier for the file generating the error
  46. * (e.g. ERRFILE_tcp for tcp.c).
  47. *
  48. * Bits 30-24 : POSIX error code
  49. *
  50. * This is the closest equivalent POSIX error code (e.g. ENOMEM).
  51. *
  52. * Bit 31 : Reserved
  53. *
  54. * Errors are usually return as negative error numbers (e.g. -EINVAL);
  55. * bit 31 is therefore unusable.
  56. *
  57. *
  58. * The convention within the code is that errors are negative and
  59. * expressed using the POSIX error, e.g.
  60. *
  61. * return -EINVAL;
  62. *
  63. * By various bits of preprocessor magic, the PXE error code and file
  64. * identifier are already incorporated into the definition of the
  65. * POSIX error macro, which keeps the code relatively clean.
  66. *
  67. *
  68. * Functions that wish to return failures should be declared as
  69. * returning an integer @c rc "Return status code". A return value of
  70. * zero indicates success, a non-zero value indicates failure. The
  71. * return value can be passed directly to strerror() in order to
  72. * generate a human-readable error message, e.g.
  73. *
  74. * if ( ( rc = some_function ( ... ) ) != 0 ) {
  75. * DBG ( "Whatever I was trying to do failed: %s\n", strerror ( rc ) );
  76. * return rc;
  77. * }
  78. *
  79. * As illustrated in the above example, error returns should generally
  80. * be directly propagated upward to the calling function.
  81. *
  82. *
  83. * Individual files may declare localised errors using
  84. * __einfo_uniqify(). For example, iscsi.c declares a localised
  85. * version of EACCES for the error of "access denied due to incorrect
  86. * target username":
  87. *
  88. * #define EACCES_INCORRECT_TARGET_USERNAME \
  89. * __einfo_error ( EINFO_EACCES_INCORRECT_TARGET_USERNAME )
  90. * #define EINFO_EACCES_INCORRECT_TARGET_USERNAME \
  91. * __einfo_uniqify ( EINFO_EACCESS, 0x01, "Incorrect target username" )
  92. *
  93. * which can then be used as:
  94. *
  95. * return -EACCES_INCORRECT_TARGET_USERNAME;
  96. *
  97. */
  98. /* Get definitions for file identifiers */
  99. #include <ipxe/errfile.h>
  100. /* If we do not have a valid file identifier, generate a compiler
  101. * warning upon usage of any error codes. (Don't just use a #warning,
  102. * because some files include errno.h but don't ever actually use any
  103. * error codes.)
  104. */
  105. #if ! ERRFILE
  106. extern char missing_errfile_declaration[] __attribute__ (( deprecated ));
  107. #undef ERRFILE
  108. #define ERRFILE ( 0 * ( ( int ) missing_errfile_declaration ) )
  109. #endif
  110. /**
  111. * Declare error information
  112. *
  113. * @v pxe PXE error number (0x00-0xff)
  114. * @v posix POSIX error number (0x00-0x7f)
  115. * @v uniq Error disambiguator (0x00-0x1f)
  116. * @v desc Error description
  117. * @ret einfo Error information
  118. */
  119. #define __einfo( pxe, posix, uniq, desc ) ( pxe, posix, uniq, desc )
  120. /**
  121. * Get PXE error number
  122. *
  123. * @v einfo Error information
  124. * @ret pxe PXE error number
  125. */
  126. #define __einfo_pxe( einfo ) __einfo_extract_pxe einfo
  127. #define __einfo_extract_pxe( pxe, posix, uniq, desc ) pxe
  128. /**
  129. * Get POSIX error number
  130. *
  131. * @v einfo Error information
  132. * @ret posix POSIX error number
  133. */
  134. #define __einfo_posix( einfo ) __einfo_extract_posix einfo
  135. #define __einfo_extract_posix( pxe, posix, uniq, desc ) posix
  136. /**
  137. * Get error disambiguator
  138. *
  139. * @v einfo Error information
  140. * @ret uniq Error disambiguator
  141. */
  142. #define __einfo_uniq( einfo ) __einfo_extract_uniq einfo
  143. #define __einfo_extract_uniq( pxe, posix, uniq, desc ) uniq
  144. /**
  145. * Get error description
  146. *
  147. * @v einfo Error information
  148. * @ret desc Error description
  149. */
  150. #define __einfo_desc( einfo ) __einfo_extract_desc einfo
  151. #define __einfo_extract_desc( pxe, posix, uniq, desc ) desc
  152. /**
  153. * Declare disambiguated error
  154. *
  155. * @v einfo_base Base error information
  156. * @v uniq Error disambiguator
  157. * @v desc Error description
  158. * @ret einfo Error information
  159. */
  160. #define __einfo_uniqify( einfo_base, uniq, desc ) \
  161. __einfo ( __einfo_pxe ( einfo_base ), \
  162. __einfo_posix ( einfo_base ), \
  163. uniq, desc )
  164. /**
  165. * Get error number
  166. *
  167. * @v einfo Error information
  168. * @ret errno Error number
  169. */
  170. #define __einfo_errno( einfo ) \
  171. ( ( __einfo_posix ( einfo ) << 24 ) | ( ERRFILE ) | \
  172. ( __einfo_uniq ( einfo ) << 8 ) | \
  173. ( __einfo_pxe ( einfo ) << 0 ) )
  174. /**
  175. * Disambiguate a base error based on non-constant information
  176. *
  177. * @v einfo_base Base error information
  178. * @v uniq Error disambiguator (0x00-0x1f)
  179. * @v ... List of expected possible disambiguated errors
  180. * @ret error Error
  181. *
  182. * EUNIQ() should be used when information from an external source is
  183. * being incorporated into an error. For example, the 802.11 stack
  184. * uses EUNIQ() to incorporate 802.11 status codes returned by an
  185. * access point into an error.
  186. *
  187. * EUNIQ() should not be used for constant error disambiguators; use
  188. * __einfo_uniqify() instead.
  189. */
  190. #define EUNIQ( einfo_base, uniq, ... ) ( { \
  191. euniq_discard ( 0, ##__VA_ARGS__ ); \
  192. ( ( int ) ( __einfo_error ( einfo_base ) | \
  193. ( (uniq) << 8 ) ) ); } )
  194. static inline void euniq_discard ( int dummy __unused, ... ) {}
  195. /**
  196. * Declare error
  197. *
  198. * @v einfo Error information
  199. * @ret error Error
  200. */
  201. #define __einfo_error( einfo ) ( { \
  202. __asm__ ( ".section \".einfo\", \"\", @progbits\n\t" \
  203. ".align 8\n\t" \
  204. "\n1:\n\t" \
  205. ".long ( 4f - 1b )\n\t" \
  206. ".long %c0\n\t" \
  207. ".long ( 2f - 1b )\n\t" \
  208. ".long ( 3f - 1b )\n\t" \
  209. ".long %c1\n\t" \
  210. "\n2:\t.asciz \"" __einfo_desc ( einfo ) "\"\n\t" \
  211. "\n3:\t.asciz \"" __FILE__ "\"\n\t" \
  212. ".align 8\n\t" \
  213. "\n4:\n\t" \
  214. ".previous\n\t" : : \
  215. "i" ( __einfo_errno ( einfo) ), \
  216. "i" ( __LINE__ ) ); \
  217. __einfo_errno ( einfo ); } )
  218. /**
  219. * @defgroup pxeerrors PXE error codes
  220. *
  221. * The names, meanings and values of these error codes are defined by
  222. * the PXE specification.
  223. *
  224. * @{
  225. */
  226. /* Generic errors */
  227. #define PXENV_STATUS_SUCCESS 0x0000
  228. #define PXENV_STATUS_FAILURE 0x0001
  229. #define PXENV_STATUS_BAD_FUNC 0x0002
  230. #define PXENV_STATUS_UNSUPPORTED 0x0003
  231. #define PXENV_STATUS_KEEP_UNDI 0x0004
  232. #define PXENV_STATUS_KEEP_ALL 0x0005
  233. #define PXENV_STATUS_OUT_OF_RESOURCES 0x0006
  234. /* ARP errors (0x0010 to 0x001f) */
  235. #define PXENV_STATUS_ARP_TIMEOUT 0x0011
  236. /* Base-Code state errors */
  237. #define PXENV_STATUS_UDP_CLOSED 0x0018
  238. #define PXENV_STATUS_UDP_OPEN 0x0019
  239. #define PXENV_STATUS_TFTP_CLOSED 0x001a
  240. #define PXENV_STATUS_TFTP_OPEN 0x001b
  241. /* BIOS/system errors (0x0020 to 0x002f) */
  242. #define PXENV_STATUS_MCOPY_PROBLEM 0x0020
  243. #define PXENV_STATUS_BIS_INTEGRITY_FAILURE 0x0021
  244. #define PXENV_STATUS_BIS_VALIDATE_FAILURE 0x0022
  245. #define PXENV_STATUS_BIS_INIT_FAILURE 0x0023
  246. #define PXENV_STATUS_BIS_SHUTDOWN_FAILURE 0x0024
  247. #define PXENV_STATUS_BIS_GBOA_FAILURE 0x0025
  248. #define PXENV_STATUS_BIS_FREE_FAILURE 0x0026
  249. #define PXENV_STATUS_BIS_GSI_FAILURE 0x0027
  250. #define PXENV_STATUS_BIS_BAD_CKSUM 0x0028
  251. /* TFTP/MTFTP errors (0x0030 to 0x003f) */
  252. #define PXENV_STATUS_TFTP_CANNOT_ARP_ADDRESS 0x0030
  253. #define PXENV_STATUS_TFTP_OPEN_TIMEOUT 0x0032
  254. #define PXENV_STATUS_TFTP_UNKNOWN_OPCODE 0x0033
  255. #define PXENV_STATUS_TFTP_READ_TIMEOUT 0x0035
  256. #define PXENV_STATUS_TFTP_ERROR_OPCODE 0x0036
  257. #define PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION 0x0038
  258. #define PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION 0x0039
  259. #define PXENV_STATUS_TFTP_TOO_MANY_PACKAGES 0x003a
  260. #define PXENV_STATUS_TFTP_FILE_NOT_FOUND 0x003b
  261. #define PXENV_STATUS_TFTP_ACCESS_VIOLATION 0x003c
  262. #define PXENV_STATUS_TFTP_NO_MCAST_ADDRESS 0x003d
  263. #define PXENV_STATUS_TFTP_NO_FILESIZE 0x003e
  264. #define PXENV_STATUS_TFTP_INVALID_PACKET_SIZE 0x003f
  265. /* Reserved errors 0x0040 to 0x004f) */
  266. /* DHCP/BOOTP errors (0x0050 to 0x005f) */
  267. #define PXENV_STATUS_DHCP_TIMEOUT 0x0051
  268. #define PXENV_STATUS_DHCP_NO_IP_ADDRESS 0x0052
  269. #define PXENV_STATUS_DHCP_NO_BOOTFILE_NAME 0x0053
  270. #define PXENV_STATUS_DHCP_BAD_IP_ADDRESS 0x0054
  271. /* Driver errors (0x0060 to 0x006f) */
  272. #define PXENV_STATUS_UNDI_INVALID_FUNCTION 0x0060
  273. #define PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x0061
  274. #define PXENV_STATUS_UNDI_CANNOT_INIT_NIC_FOR_MCAST 0x0062
  275. #define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC 0x0063
  276. #define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_PHY 0x0064
  277. #define PXENV_STATUS_UNDI_CANNOT_READ_CONFIG_DATA 0x0065
  278. #define PXENV_STATUS_UNDI_CANNOT_READ_INIT_DATA 0x0066
  279. #define PXENV_STATUS_UNDI_BAD_MAC_ADDRESS 0x0067
  280. #define PXENV_STATUS_UNDI_BAD_EEPROM_CHECKSUM 0x0068
  281. #define PXENV_STATUS_UNDI_ERROR_SETTING_ISR 0x0069
  282. #define PXENV_STATUS_UNDI_INVALID_STATE 0x006a
  283. #define PXENV_STATUS_UNDI_TRANSMIT_ERROR 0x006b
  284. #define PXENV_STATUS_UNDI_INVALID_PARAMETER 0x006c
  285. /* ROM and NBP bootstrap errors (0x0070 to 0x007f) */
  286. #define PXENV_STATUS_BSTRAP_PROMPT_MENU 0x0074
  287. #define PXENV_STATUS_BSTRAP_MCAST_ADDR 0x0076
  288. #define PXENV_STATUS_BSTRAP_MISSING_LIST 0x0077
  289. #define PXENV_STATUS_BSTRAP_NO_RESPONSE 0x0078
  290. #define PXENV_STATUS_BSTRAP_FILE_TOO_BIG 0x0079
  291. /* Environment NBP errors (0x0080 to 0x008f) */
  292. /* Reserved errors (0x0090 to 0x009f) */
  293. /* Miscellaneous errors (0x00a0 to 0x00af) */
  294. #define PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE 0x00a0
  295. #define PXENV_STATUS_BINL_NO_PXE_SERVER 0x00a1
  296. #define PXENV_STATUS_NOT_AVAILABLE_IN_PMODE 0x00a2
  297. #define PXENV_STATUS_NOT_AVAILABLE_IN_RMODE 0x00a3
  298. /* BUSD errors (0x00b0 to 0x00bf) */
  299. #define PXENV_STATUS_BUSD_DEVICE_NOT_SUPPORTED 0x00b0
  300. /* Loader errors (0x00c0 to 0x00cf) */
  301. #define PXENV_STATUS_LOADER_NO_FREE_BASE_MEMORY 0x00c0
  302. #define PXENV_STATUS_LOADER_NO_BC_ROMID 0x00c1
  303. #define PXENV_STATUS_LOADER_BAD_BC_ROMID 0x00c2
  304. #define PXENV_STATUS_LOADER_BAD_BC_RUNTIME_IMAGE 0x00c3
  305. #define PXENV_STATUS_LOADER_NO_UNDI_ROMID 0x00c4
  306. #define PXENV_STATUS_LOADER_BAD_UNDI_ROMID 0x00c5
  307. #define PXENV_STATUS_LOADER_BAD_UNDI_DRIVER_IMAGE 0x00c6
  308. #define PXENV_STATUS_LOADER_NO_PXE_STRUCT 0x00c8
  309. #define PXENV_STATUS_LOADER_NO_PXENV_STRUCT 0x00c9
  310. #define PXENV_STATUS_LOADER_UNDI_START 0x00ca
  311. #define PXENV_STATUS_LOADER_BC_START 0x00cb
  312. /** @} */
  313. /** Derive PXENV_STATUS code from iPXE error number */
  314. #define PXENV_STATUS( rc ) ( (-(rc)) & 0x00ff )
  315. /**
  316. * @defgroup posixerrors POSIX error codes
  317. *
  318. * The names and meanings (but not the values) of these error codes
  319. * are defined by POSIX.
  320. *
  321. * @{
  322. */
  323. /** Operation completed successfully */
  324. #define ENOERR __einfo_error ( EINFO_ENOERR )
  325. #define EINFO_ENOERR __einfo ( PXENV_STATUS_SUCCESS, 0x00, 0, \
  326. "Operation completed successfully" )
  327. /** Argument list too long */
  328. #define E2BIG __einfo_error ( EINFO_E2BIG )
  329. #define EINFO_E2BIG __einfo ( PXENV_STATUS_BAD_FUNC, 0x01, 0, \
  330. "Argument list too long" )
  331. /** Permission denied */
  332. #define EACCES __einfo_error ( EINFO_EACCES )
  333. #define EINFO_EACCES __einfo ( PXENV_STATUS_TFTP_ACCESS_VIOLATION, 0x02, 0, \
  334. "Permission denied" )
  335. /** Address already in use */
  336. #define EADDRINUSE __einfo_error ( EINFO_EADDRINUSE )
  337. #define EINFO_EADDRINUSE __einfo ( PXENV_STATUS_UDP_OPEN, 0x03, 0, \
  338. "Address already in use" )
  339. /** Address not available */
  340. #define EADDRNOTAVAIL __einfo_error ( EINFO_EADDRNOTAVAIL )
  341. #define EINFO_EADDRNOTAVAIL __einfo ( PXENV_STATUS_UDP_OPEN, 0x04, 0, \
  342. "Address not available" )
  343. /** Address family not supported */
  344. #define EAFNOSUPPORT __einfo_error ( EINFO_EAFNOSUPPORT )
  345. #define EINFO_EAFNOSUPPORT __einfo ( PXENV_STATUS_UNSUPPORTED, 0x05, 0, \
  346. "Address family not supported" )
  347. /** Resource temporarily unavailable */
  348. #define EAGAIN __einfo_error ( EINFO_EAGAIN )
  349. #define EINFO_EAGAIN __einfo ( PXENV_STATUS_FAILURE, 0x06, 0, \
  350. "Resource temporarily unavailable" )
  351. /** Connection already in progress */
  352. #define EALREADY __einfo_error ( EINFO_EALREADY )
  353. #define EINFO_EALREADY __einfo ( PXENV_STATUS_UDP_OPEN, 0x07, 0, \
  354. "Connection already in progress" )
  355. /** Bad file descriptor */
  356. #define EBADF __einfo_error ( EINFO_EBADF )
  357. #define EINFO_EBADF __einfo ( PXENV_STATUS_TFTP_CLOSED, 0x08, 0, \
  358. "Bad file descriptor" )
  359. /** Bad message */
  360. #define EBADMSG __einfo_error ( EINFO_EBADMSG )
  361. #define EINFO_EBADMSG __einfo ( PXENV_STATUS_FAILURE, 0x09, 0, \
  362. "Bad message" )
  363. /** Device or resource busy */
  364. #define EBUSY __einfo_error ( EINFO_EBUSY )
  365. #define EINFO_EBUSY __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x0a, 0, \
  366. "Device or resource busy" )
  367. /** Operation canceled */
  368. #define ECANCELED __einfo_error ( EINFO_ECANCELED )
  369. #define EINFO_ECANCELED __einfo ( PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE, \
  370. 0x0b, 0, "Operation canceled" )
  371. /** No child processes */
  372. #define ECHILD __einfo_error ( EINFO_ECHILD )
  373. #define EINFO_ECHILD __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x0c, 0, \
  374. "No child processes" )
  375. /** Connection aborted */
  376. #define ECONNABORTED __einfo_error ( EINFO_ECONNABORTED )
  377. #define EINFO_ECONNABORTED \
  378. __einfo ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION, 0x0d, 0, \
  379. "Connection aborted" )
  380. /** Connection refused */
  381. #define ECONNREFUSED __einfo_error ( EINFO_ECONNREFUSED )
  382. #define EINFO_ECONNREFUSED __einfo ( PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION, \
  383. 0x0e, 0, "Connection refused" )
  384. /** Connection reset */
  385. #define ECONNRESET __einfo_error ( EINFO_ECONNRESET )
  386. #define EINFO_ECONNRESET \
  387. __einfo ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION, 0x0f, 0, \
  388. "Connection reset" )
  389. /** Resource deadlock avoided */
  390. #define EDEADLK __einfo_error ( EINFO_EDEADLK )
  391. #define EINFO_EDEADLK __einfo ( PXENV_STATUS_FAILURE, 0x10, 0, \
  392. "Resource deadlock avoided" )
  393. /** Destination address required */
  394. #define EDESTADDRREQ __einfo_error ( EINFO_EDESTADDRREQ )
  395. #define EINFO_EDESTADDRREQ __einfo ( PXENV_STATUS_BAD_FUNC, 0x11, 0, \
  396. "Destination address required" )
  397. /** Mathematics argument out of domain of function */
  398. #define EDOM __einfo_error ( EINFO_EDOM )
  399. #define EINFO_EDOM __einfo ( PXENV_STATUS_FAILURE, 0x12, 0, \
  400. "Mathematics argument out of domain of function" )
  401. /** Disk quota exceeded */
  402. #define EDQUOT __einfo_error ( EINFO_EDQUOT )
  403. #define EINFO_EDQUOT __einfo ( PXENV_STATUS_FAILURE, 0x13, 0, \
  404. "Disk quote exceeded" )
  405. /** File exists */
  406. #define EEXIST __einfo_error ( EINFO_EEXIST )
  407. #define EINFO_EEXIST __einfo ( PXENV_STATUS_FAILURE, 0x14, 0, \
  408. "File exists" )
  409. /** Bad address */
  410. #define EFAULT __einfo_error ( EINFO_EFAULT )
  411. #define EINFO_EFAULT __einfo ( PXENV_STATUS_MCOPY_PROBLEM, 0x15, 0, \
  412. "Bad address" )
  413. /** File too large */
  414. #define EFBIG __einfo_error ( EINFO_EFBIG )
  415. #define EINFO_EFBIG __einfo ( PXENV_STATUS_MCOPY_PROBLEM, 0x16, 0, \
  416. "File too large" )
  417. /** Host is unreachable */
  418. #define EHOSTUNREACH __einfo_error ( EINFO_EHOSTUNREACH )
  419. #define EINFO_EHOSTUNREACH __einfo ( PXENV_STATUS_ARP_TIMEOUT, 0x17, 0, \
  420. "Host is unreachable" )
  421. /** Identifier removed */
  422. #define EIDRM __einfo_error ( EINFO_EIDRM )
  423. #define EINFO_EIDRM __einfo ( PXENV_STATUS_FAILURE, 0x18, 0, \
  424. "Identifier removed" )
  425. /** Illegal byte sequence */
  426. #define EILSEQ __einfo_error ( EINFO_EILSEQ )
  427. #define EINFO_EILSEQ __einfo ( PXENV_STATUS_FAILURE, 0x19, 0, \
  428. "Illegal byte sequence" )
  429. /** Operation in progress */
  430. #define EINPROGRESS __einfo_error ( EINFO_EINPROGRESS )
  431. #define EINFO_EINPROGRESS __einfo ( PXENV_STATUS_FAILURE, 0x1a, 0, \
  432. "Operation in progress" )
  433. /** Interrupted function call */
  434. #define EINTR __einfo_error ( EINFO_EINTR )
  435. #define EINFO_EINTR __einfo ( PXENV_STATUS_FAILURE, 0x1b, 0, \
  436. "Interrupted function call" )
  437. /** Invalid argument */
  438. #define EINVAL __einfo_error ( EINFO_EINVAL )
  439. #define EINFO_EINVAL __einfo ( PXENV_STATUS_BAD_FUNC, 0x1c, 0, \
  440. "Invalid argument" )
  441. /** Input/output error */
  442. #define EIO __einfo_error ( EINFO_EIO )
  443. #define EINFO_EIO __einfo ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION, \
  444. 0x1d, 0, "Input/output error" )
  445. /** Socket is connected */
  446. #define EISCONN __einfo_error ( EINFO_EISCONN )
  447. #define EINFO_EISCONN __einfo ( PXENV_STATUS_UDP_OPEN, 0x1e, 0, \
  448. "Socket is connected" )
  449. /** Is a directory */
  450. #define EISDIR __einfo_error ( EINFO_EISDIR )
  451. #define EINFO_EISDIR __einfo ( PXENV_STATUS_FAILURE, 0x1f, 0, \
  452. "Is a directory" )
  453. /** Too many levels of symbolic links */
  454. #define ELOOP __einfo_error ( EINFO_ELOOP )
  455. #define EINFO_ELOOP __einfo ( PXENV_STATUS_FAILURE, 0x20, 0, \
  456. "Too many levels of symbolic links" )
  457. /** Too many open files */
  458. #define EMFILE __einfo_error ( EINFO_EMFILE )
  459. #define EINFO_EMFILE __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x21, 0, \
  460. "Too many open files" )
  461. /** Too many links */
  462. #define EMLINK __einfo_error ( EINFO_EMLINK )
  463. #define EINFO_EMLINK __einfo ( PXENV_STATUS_FAILURE, 0x22, 0, \
  464. "Too many links" )
  465. /** Message too long */
  466. #define EMSGSIZE __einfo_error ( EINFO_EMSGSIZE )
  467. #define EINFO_EMSGSIZE __einfo ( PXENV_STATUS_BAD_FUNC, 0x23, 0, \
  468. "Message too long" )
  469. /** Multihop attempted */
  470. #define EMULTIHOP __einfo_error ( EINFO_EMULTIHOP )
  471. #define EINFO_EMULTIHOP __einfo ( PXENV_STATUS_FAILURE, 0x24, 0, \
  472. "Multihop attempted" )
  473. /** Filename too long */
  474. #define ENAMETOOLONG __einfo_error ( EINFO_ENAMETOOLONG )
  475. #define EINFO_ENAMETOOLONG __einfo ( PXENV_STATUS_FAILURE, 0x25, 0, \
  476. "Filename too long" )
  477. /** Network is down */
  478. #define ENETDOWN __einfo_error ( EINFO_ENETDOWN )
  479. #define EINFO_ENETDOWN __einfo ( PXENV_STATUS_ARP_TIMEOUT, 0x26, 0, \
  480. "Network is down" )
  481. /** Connection aborted by network */
  482. #define ENETRESET __einfo_error ( EINFO_ENETRESET )
  483. #define EINFO_ENETRESET __einfo ( PXENV_STATUS_FAILURE, 0x27, 0, \
  484. "Connection aborted by network" )
  485. /** Network unreachable */
  486. #define ENETUNREACH __einfo_error ( EINFO_ENETUNREACH )
  487. #define EINFO_ENETUNREACH __einfo ( PXENV_STATUS_ARP_TIMEOUT, 0x28, 0, \
  488. "Network unreachable" )
  489. /** Too many open files in system */
  490. #define ENFILE __einfo_error ( EINFO_ENFILE )
  491. #define EINFO_ENFILE __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x29, 0, \
  492. "Too many open files in system" )
  493. /** No buffer space available */
  494. #define ENOBUFS __einfo_error ( EINFO_ENOBUFS )
  495. #define EINFO_ENOBUFS __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x2a, 0, \
  496. "No buffer space available" )
  497. /** No message is available on the STREAM head read queue */
  498. #define ENODATA __einfo_error ( EINFO_ENODATA )
  499. #define EINFO_ENODATA \
  500. __einfo ( PXENV_STATUS_FAILURE, 0x2b, 0, \
  501. "No message is available on the STREAM head read queue" )
  502. /** No such device */
  503. #define ENODEV __einfo_error ( EINFO_ENODEV )
  504. #define EINFO_ENODEV __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x2c, 0, \
  505. "No such device" )
  506. /** No such file or directory */
  507. #define ENOENT __einfo_error ( EINFO_ENOENT )
  508. #define EINFO_ENOENT __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x2d, 0, \
  509. "No such file or directory" )
  510. /** Exec format error */
  511. #define ENOEXEC __einfo_error ( EINFO_ENOEXEC )
  512. #define EINFO_ENOEXEC __einfo ( PXENV_STATUS_FAILURE, 0x2e, 0, \
  513. "Exec format error" )
  514. /** No locks available */
  515. #define ENOLCK __einfo_error ( EINFO_ENOLCK )
  516. #define EINFO_ENOLCK __einfo ( PXENV_STATUS_FAILURE, 0x2f, 0, \
  517. "No locks available" )
  518. /** Link has been severed */
  519. #define ENOLINK __einfo_error ( EINFO_ENOLINK )
  520. #define EINFO_ENOLINK __einfo ( PXENV_STATUS_FAILURE, 0x30, 0, \
  521. "Link has been severed" )
  522. /** Not enough space */
  523. #define ENOMEM __einfo_error ( EINFO_ENOMEM )
  524. #define EINFO_ENOMEM __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x31, 0, \
  525. "Not enough space" )
  526. /** No message of the desired type */
  527. #define ENOMSG __einfo_error ( EINFO_ENOMSG )
  528. #define EINFO_ENOMSG __einfo ( PXENV_STATUS_FAILURE, 0x32, 0, \
  529. "No message of the desired type" )
  530. /** Protocol not available */
  531. #define ENOPROTOOPT __einfo_error ( EINFO_ENOPROTOOPT )
  532. #define EINFO_ENOPROTOOPT __einfo ( PXENV_STATUS_UNSUPPORTED, 0x33, 0, \
  533. "Protocol not available" )
  534. /** No space left on device */
  535. #define ENOSPC __einfo_error ( EINFO_ENOSPC )
  536. #define EINFO_ENOSPC __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x34, 0, \
  537. "No space left on device" )
  538. /** No STREAM resources */
  539. #define ENOSR __einfo_error ( EINFO_ENOSR )
  540. #define EINFO_ENOSR __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x35, 0, \
  541. "No STREAM resources" )
  542. /** Not a STREAM */
  543. #define ENOSTR __einfo_error ( EINFO_ENOSTR )
  544. #define EINFO_ENOSTR __einfo ( PXENV_STATUS_FAILURE, 0x36, 0, \
  545. "Not a STREAM" )
  546. /** Function not implemented */
  547. #define ENOSYS __einfo_error ( EINFO_ENOSYS )
  548. #define EINFO_ENOSYS __einfo ( PXENV_STATUS_UNSUPPORTED, 0x37, 0, \
  549. "Function not implemented" )
  550. /** The socket is not connected */
  551. #define ENOTCONN __einfo_error ( EINFO_ENOTCONN )
  552. #define EINFO_ENOTCONN __einfo ( PXENV_STATUS_FAILURE, 0x38, 0, \
  553. "The socket is not connected" )
  554. /** Not a directory */
  555. #define ENOTDIR __einfo_error ( EINFO_ENOTDIR )
  556. #define EINFO_ENOTDIR __einfo ( PXENV_STATUS_FAILURE, 0x39, 0, \
  557. "Not a directory" )
  558. /** Directory not empty */
  559. #define ENOTEMPTY __einfo_error ( EINFO_ENOTEMPTY )
  560. #define EINFO_ENOTEMPTY __einfo ( PXENV_STATUS_FAILURE, 0x3a, 0, \
  561. "Directory not empty" )
  562. /** Not a socket */
  563. #define ENOTSOCK __einfo_error ( EINFO_ENOTSOCK )
  564. #define EINFO_ENOTSOCK __einfo ( PXENV_STATUS_FAILURE, 0x3b, 0, \
  565. "Not a socket" )
  566. /** Operation not supported */
  567. #define ENOTSUP __einfo_error ( EINFO_ENOTSUP )
  568. #define EINFO_ENOTSUP __einfo ( PXENV_STATUS_UNSUPPORTED, 0x3c, 0, \
  569. "Operation not supported" )
  570. /** Inappropriate I/O control operation */
  571. #define ENOTTY __einfo_error ( EINFO_ENOTTY )
  572. #define EINFO_ENOTTY __einfo ( PXENV_STATUS_FAILURE, 0x3d, 0, \
  573. "Inappropriate I/O control operation" )
  574. /** No such device or address */
  575. #define ENXIO __einfo_error ( EINFO_ENXIO )
  576. #define EINFO_ENXIO __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x3e, 0, \
  577. "No such device or address" )
  578. /** Operation not supported on socket */
  579. #define EOPNOTSUPP __einfo_error ( EINFO_EOPNOTSUPP )
  580. #define EINFO_EOPNOTSUPP __einfo ( PXENV_STATUS_UNSUPPORTED, 0x3f, 0, \
  581. "Operation not supported on socket" )
  582. /** Value too large to be stored in data type */
  583. #define EOVERFLOW __einfo_error ( EINFO_EOVERFLOW )
  584. #define EINFO_EOVERFLOW __einfo ( PXENV_STATUS_FAILURE, 0x40, 0, \
  585. "Value too large to be stored in data type" )
  586. /** Operation not permitted */
  587. #define EPERM __einfo_error ( EINFO_EPERM )
  588. #define EINFO_EPERM __einfo ( PXENV_STATUS_TFTP_ACCESS_VIOLATION, 0x41, 0, \
  589. "Operation not permitted" )
  590. /** Broken pipe */
  591. #define EPIPE __einfo_error ( EINFO_EPIPE )
  592. #define EINFO_EPIPE __einfo ( PXENV_STATUS_FAILURE, 0x42, 0, \
  593. "Broken pipe" )
  594. /** Protocol error */
  595. #define EPROTO __einfo_error ( EINFO_EPROTO )
  596. #define EINFO_EPROTO __einfo ( PXENV_STATUS_FAILURE, 0x43, 0, \
  597. "Protocol error" )
  598. /** Protocol not supported */
  599. #define EPROTONOSUPPORT __einfo_error ( EINFO_EPROTONOSUPPORT )
  600. #define EINFO_EPROTONOSUPPORT __einfo ( PXENV_STATUS_UNSUPPORTED, 0x44, 0, \
  601. "Protocol not supported" )
  602. /** Protocol wrong type for socket */
  603. #define EPROTOTYPE __einfo_error ( EINFO_EPROTOTYPE )
  604. #define EINFO_EPROTOTYPE __einfo ( PXENV_STATUS_FAILURE, 0x45, 0, \
  605. "Protocol wrong type for socket" )
  606. /** Result too large */
  607. #define ERANGE __einfo_error ( EINFO_ERANGE )
  608. #define EINFO_ERANGE __einfo ( PXENV_STATUS_FAILURE, 0x46, 0, \
  609. "Result too large" )
  610. /** Read-only file system */
  611. #define EROFS __einfo_error ( EINFO_EROFS )
  612. #define EINFO_EROFS __einfo ( PXENV_STATUS_FAILURE, 0x47, 0, \
  613. "Read-only file system" )
  614. /** Invalid seek */
  615. #define ESPIPE __einfo_error ( EINFO_ESPIPE )
  616. #define EINFO_ESPIPE __einfo ( PXENV_STATUS_FAILURE, 0x48, 0, \
  617. "Invalid seek" )
  618. /** No such process */
  619. #define ESRCH __einfo_error ( EINFO_ESRCH )
  620. #define EINFO_ESRCH __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x49, 0, \
  621. "No such process" )
  622. /** Stale file handle */
  623. #define ESTALE __einfo_error ( EINFO_ESTALE )
  624. #define EINFO_ESTALE __einfo ( PXENV_STATUS_FAILURE, 0x4a, 0, \
  625. "Stale file handle" )
  626. /** Timer expired */
  627. #define ETIME __einfo_error ( EINFO_ETIME )
  628. #define EINFO_ETIME __einfo ( PXENV_STATUS_FAILURE, 0x4b, 0, \
  629. "Timer expired" )
  630. /** Connection timed out */
  631. #define ETIMEDOUT __einfo_error ( EINFO_ETIMEDOUT )
  632. #define EINFO_ETIMEDOUT __einfo ( PXENV_STATUS_TFTP_READ_TIMEOUT, 0x4c, 0, \
  633. "Connection timed out" )
  634. /** Text file busy */
  635. #define ETXTBSY __einfo_error ( EINFO_ETXTBSY )
  636. #define EINFO_ETXTBSY __einfo ( PXENV_STATUS_FAILURE, 0x4d, 0, \
  637. "Text file busy" )
  638. /** Operation would block */
  639. #define EWOULDBLOCK __einfo_error ( EINFO_EWOULDBLOCK )
  640. #define EINFO_EWOULDBLOCK __einfo ( PXENV_STATUS_TFTP_OPEN, 0x4e, 0, \
  641. "Operation would block" )
  642. /** Improper link */
  643. #define EXDEV __einfo_error ( EINFO_EXDEV )
  644. #define EINFO_EXDEV __einfo ( PXENV_STATUS_FAILURE, 0x4f, 0, \
  645. "Improper link" )
  646. /** @} */
  647. extern int errno;
  648. #endif /* ERRNO_H */