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