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