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