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

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