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