iPXE
errno.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301, USA.
00018  *
00019  * You can also choose to distribute this program under the terms of
00020  * the Unmodified Binary Distribution Licence (as given in the file
00021  * COPYING.UBDL), provided that you have satisfied its requirements.
00022  */
00023 
00024 #ifndef ERRNO_H
00025 #define ERRNO_H
00026 
00027 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00028 
00029 /** @file
00030  *
00031  * Error codes
00032  *
00033  * Return status codes as used within iPXE are designed to allow for
00034  * maximum visibility into the source of an error even in an end-user
00035  * build with no debugging.  They are constructed as follows:
00036  *
00037  * Bits 7-0 : Platform-specific error code
00038  *
00039  * This is a losslessly compressed representation of the closest
00040  * equivalent error code defined by the platform (e.g. BIOS/PXE or
00041  * EFI).  It is used to generate errors to be returned to external
00042  * code.
00043  *
00044  * Bits 12-8 : Per-file disambiguator
00045  *
00046  * When the same error code can be generated from multiple points
00047  * within a file, this field can be used to identify the unique
00048  * instance.
00049  *
00050  * Bits 23-13 : File identifier
00051  *
00052  * This is a unique identifier for the file generating the error
00053  * (e.g. ERRFILE_tcp for tcp.c).
00054  *
00055  * Bits 30-24 : POSIX error code
00056  *
00057  * This is the closest equivalent POSIX error code (e.g. ENOMEM).
00058  *
00059  * Bit 31 : Reserved
00060  *
00061  * Errors are usually return as negative error codes (e.g. -EINVAL);
00062  * bit 31 is therefore unusable.
00063  *
00064  *
00065  * The convention within the code is that errors are negative and
00066  * expressed using the POSIX error, e.g.
00067  *
00068  *     return -EINVAL;
00069  *
00070  * By various bits of preprocessor magic, the platform-specific error
00071  * code and file identifier are already incorporated into the
00072  * definition of the POSIX error macro, which keeps the code
00073  * relatively clean.
00074  *
00075  *
00076  * Functions that wish to return failures should be declared as
00077  * returning an integer @c rc "Return status code".  A return value of
00078  * zero indicates success, a non-zero value indicates failure.  The
00079  * return value can be passed directly to strerror() in order to
00080  * generate a human-readable error message, e.g.
00081  *
00082  *     if ( ( rc = some_function ( ... ) ) != 0 ) {
00083  *         DBG ( "Whatever I was trying to do failed: %s\n", strerror ( rc ) );
00084  *         return rc;
00085  *     }
00086  *
00087  * As illustrated in the above example, error returns should generally
00088  * be directly propagated upward to the calling function.
00089  *
00090  *
00091  * Individual files may declare localised errors using
00092  * __einfo_uniqify().  For example, iscsi.c declares a localised
00093  * version of EACCES for the error of "access denied due to incorrect
00094  * target username":
00095  *
00096  *     #define EACCES_INCORRECT_TARGET_USERNAME \
00097  *         __einfo_error ( EINFO_EACCES_INCORRECT_TARGET_USERNAME )
00098  *     #define EINFO_EACCES_INCORRECT_TARGET_USERNAME \
00099  *         __einfo_uniqify ( EINFO_EACCESS, 0x01, "Incorrect target username" )
00100  *
00101  * which can then be used as:
00102  *
00103  *     return -EACCES_INCORRECT_TARGET_USERNAME;
00104  *
00105  */
00106 
00107 /* Get definitions for platform-specific error codes */
00108 #define PLATFORM_ERRNO(_platform) <ipxe/errno/_platform.h>
00109 #include PLATFORM_ERRNO(PLATFORM)
00110 
00111 /* Get definitions for file identifiers */
00112 #include <ipxe/errfile.h>
00113 
00114 /* If we do not have a valid file identifier, generate a compiler
00115  * warning upon usage of any error codes.  (Don't just use a #warning,
00116  * because some files include errno.h but don't ever actually use any
00117  * error codes.)
00118  */
00119 #if ! ERRFILE
00120 extern char missing_errfile_declaration[] __attribute__ (( deprecated ));
00121 #undef ERRFILE
00122 #define ERRFILE ( ( int ) ( 0 * ( ( intptr_t ) missing_errfile_declaration ) ) )
00123 #endif
00124 
00125 /**
00126  * Declare error information
00127  *
00128  * @v platform          Platform error code (uncompressed)
00129  * @v posix             POSIX error code (0x00-0x7f)
00130  * @v uniq              Error disambiguator (0x00-0x1f)
00131  * @v desc              Error description
00132  * @ret einfo           Error information
00133  */
00134 #define __einfo( platform, posix, uniq, desc ) ( platform, posix, uniq, desc )
00135 
00136 /**
00137  * Get platform error code
00138  *
00139  * @v einfo             Error information
00140  * @ret platform        Platform error code (uncompressed)
00141  */
00142 #define __einfo_platform( einfo ) __einfo_extract_platform einfo
00143 #define __einfo_extract_platform( platform, posix, uniq, desc ) platform
00144 
00145 /**
00146  * Get POSIX error code
00147  *
00148  * @v einfo             Error information
00149  * @ret posix           POSIX error code
00150  */
00151 #define __einfo_posix( einfo ) __einfo_extract_posix einfo
00152 #define __einfo_extract_posix( platform, posix, uniq, desc ) posix
00153 
00154 /**
00155  * Get error disambiguator
00156  *
00157  * @v einfo             Error information
00158  * @ret uniq            Error disambiguator
00159  */
00160 #define __einfo_uniq( einfo ) __einfo_extract_uniq einfo
00161 #define __einfo_extract_uniq( platform, posix, uniq, desc ) uniq
00162 
00163 /**
00164  * Get error description
00165  *
00166  * @v einfo             Error information
00167  * @ret desc            Error description
00168  */
00169 #define __einfo_desc( einfo ) __einfo_extract_desc einfo
00170 #define __einfo_extract_desc( platform, posix, uniq, desc ) desc
00171 
00172 /**
00173  * Declare disambiguated error
00174  *
00175  * @v einfo_base        Base error information
00176  * @v uniq              Error disambiguator (0x00-0x1f)
00177  * @v desc              Error description
00178  * @ret einfo           Error information
00179  */
00180 #define __einfo_uniqify( einfo_base, uniq, desc )                       \
00181         __einfo ( __einfo_platform ( einfo_base ),                      \
00182                   __einfo_posix ( einfo_base ),                         \
00183                   uniq, desc )
00184 
00185 /**
00186  * Declare platform-generated error
00187  *
00188  * @v einfo_base        Base error information
00189  * @v platform          Platform error code (uncompressed)
00190  * @v desc              Error description
00191  * @ret einfo           Error information
00192  */
00193 #define __einfo_platformify( einfo_base, platform, desc )               \
00194         __einfo ( platform, __einfo_posix ( einfo_base ),               \
00195                   __einfo_uniq ( einfo_base ), desc )
00196 
00197 /**
00198  * Get error code
00199  *
00200  * @v einfo             Error information
00201  * @ret errno           Error code
00202  */
00203 #define __einfo_errno( einfo )                                          \
00204         ( ( int )                                                       \
00205           ( ( __einfo_posix ( einfo ) << 24 ) | ( ERRFILE ) |           \
00206             ( __einfo_uniq ( einfo ) << 8 ) |                           \
00207             ( PLATFORM_TO_ERRNO ( __einfo_platform ( einfo ) ) << 0 ) ) )
00208 
00209 /**
00210  * Disambiguate a base error based on non-constant information
00211  *
00212  * @v einfo_base        Base error information
00213  * @v uniq              Error disambiguator (0x00-0x1f)
00214  * @v ...               List of expected possible disambiguated errors
00215  * @ret error           Error
00216  *
00217  * EUNIQ() should be used when information from an external source is
00218  * being incorporated into an error.  For example, the 802.11 stack
00219  * uses EUNIQ() to incorporate 802.11 status codes returned by an
00220  * access point into an error.
00221  *
00222  * EUNIQ() should not be used for constant error disambiguators; use
00223  * __einfo_uniqify() instead.
00224  */
00225 #define EUNIQ( einfo_base, uniq, ... ) ( {                              \
00226         euniq_discard ( 0, ##__VA_ARGS__ );                             \
00227         ( ( int ) ( __einfo_error ( einfo_base ) |                      \
00228                     ( (uniq) << 8 ) ) ); } )
00229 static inline void euniq_discard ( int dummy __unused, ... ) {}
00230 
00231 /**
00232  * Generate an error based on an external platform error code
00233  *
00234  * @v einfo_base        Base error information
00235  * @v platform          Platform error code (uncompressed)
00236  * @v ...               List of expected possible platform-generated errors
00237  * @ret error           Error
00238  *
00239  * EPLATFORM() should be used when a platform error code resulting
00240  * from an external platform API call is being incorporated into an
00241  * error.  For example, EFI code uses EPLATFORM() to generate errors
00242  * resulting from calls to EFI APIs such as
00243  * InstallMultipleProtocolInterfaces().
00244  *
00245  * EPLATFORM() should not be used for constant platform-generated
00246  * errors; use __einfo_platformify() instead.
00247  */
00248 #define EPLATFORM( einfo_base, platform, ... ) ( {                      \
00249         eplatform_discard ( 0, ##__VA_ARGS__ );                         \
00250         ( ( int ) ( __einfo_error ( einfo_base ) |                      \
00251                     PLATFORM_TO_ERRNO ( platform ) ) ); } )
00252 static inline void eplatform_discard ( int dummy __unused, ... ) {}
00253 
00254 /**
00255  * Declare error
00256  *
00257  * @v einfo             Error information
00258  * @ret error           Error
00259  */
00260 #define __einfo_error( einfo ) ( {                                      \
00261         __asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t"     \
00262                   ".align 8\n\t"                                        \
00263                   "\n1:\n\t"                                            \
00264                   ".long ( 4f - 1b )\n\t"                               \
00265                   ".long %a0\n\t"                                       \
00266                   ".long ( 2f - 1b )\n\t"                               \
00267                   ".long ( 3f - 1b )\n\t"                               \
00268                   ".long %a1\n\t"                                       \
00269                   "\n2:\t.asciz \"" __einfo_desc ( einfo ) "\"\n\t"     \
00270                   "\n3:\t.asciz \"" __FILE__ "\"\n\t"                   \
00271                   ".align 8\n\t"                                        \
00272                   "\n4:\n\t"                                            \
00273                   ".previous\n\t" : :                                   \
00274                   "i" ( __einfo_errno ( einfo ) ),                      \
00275                   "i" ( __LINE__ ) );                                   \
00276         __einfo_errno ( einfo ); } )
00277 
00278 /**
00279  * @defgroup posixerrors POSIX error codes
00280  *
00281  * The names and meanings (but not the values) of these error codes
00282  * are defined by POSIX.
00283  *
00284  * @{
00285  */
00286 
00287 /** Operation completed successfully */
00288 #define ENOERR __einfo_error ( EINFO_ENOERR )
00289 #define EINFO_ENOERR __einfo ( PLATFORM_ENOERR, 0x00, 0, \
00290                                "Operation completed successfully" )
00291 
00292 /** Argument list too long */
00293 #define E2BIG __einfo_error ( EINFO_E2BIG )
00294 #define EINFO_E2BIG __einfo ( PLATFORM_E2BIG, 0x01, 0, \
00295                               "Argument list too long" )
00296 
00297 /** Permission denied */
00298 #define EACCES __einfo_error ( EINFO_EACCES )
00299 #define EINFO_EACCES __einfo ( PLATFORM_EACCES, 0x02, 0, \
00300                                "Permission denied" )
00301 
00302 /** Address already in use */
00303 #define EADDRINUSE __einfo_error ( EINFO_EADDRINUSE )
00304 #define EINFO_EADDRINUSE __einfo ( PLATFORM_EADDRINUSE, 0x03, 0, \
00305                                    "Address already in use" )
00306 
00307 /** Address not available */
00308 #define EADDRNOTAVAIL __einfo_error ( EINFO_EADDRNOTAVAIL )
00309 #define EINFO_EADDRNOTAVAIL __einfo ( PLATFORM_EADDRNOTAVAIL, 0x04, 0, \
00310                                       "Address not available" )
00311 
00312 /** Address family not supported */
00313 #define EAFNOSUPPORT __einfo_error ( EINFO_EAFNOSUPPORT )
00314 #define EINFO_EAFNOSUPPORT __einfo ( PLATFORM_EAFNOSUPPORT, 0x05, 0, \
00315                                      "Address family not supported" )
00316 
00317 /** Resource temporarily unavailable */
00318 #define EAGAIN __einfo_error ( EINFO_EAGAIN )
00319 #define EINFO_EAGAIN __einfo ( PLATFORM_EAGAIN, 0x06, 0, \
00320                                "Resource temporarily unavailable" )
00321 
00322 /** Connection already in progress */
00323 #define EALREADY __einfo_error ( EINFO_EALREADY )
00324 #define EINFO_EALREADY __einfo ( PLATFORM_EALREADY, 0x07, 0, \
00325                                  "Connection already in progress" )
00326 
00327 /** Bad file descriptor */
00328 #define EBADF __einfo_error ( EINFO_EBADF )
00329 #define EINFO_EBADF __einfo ( PLATFORM_EBADF, 0x08, 0, \
00330                               "Bad file descriptor" )
00331 
00332 /** Bad message */
00333 #define EBADMSG __einfo_error ( EINFO_EBADMSG )
00334 #define EINFO_EBADMSG __einfo ( PLATFORM_EBADMSG, 0x09, 0, \
00335                                 "Bad message" )
00336 
00337 /** Device or resource busy */
00338 #define EBUSY __einfo_error ( EINFO_EBUSY )
00339 #define EINFO_EBUSY __einfo ( PLATFORM_EBUSY, 0x0a, 0, \
00340                               "Device or resource busy" )
00341 
00342 /** Operation canceled */
00343 #define ECANCELED __einfo_error ( EINFO_ECANCELED )
00344 #define EINFO_ECANCELED __einfo ( PLATFORM_ECANCELED, 0x0b, 0, \
00345                                   "Operation canceled" )
00346 
00347 /** No child processes */
00348 #define ECHILD __einfo_error ( EINFO_ECHILD )
00349 #define EINFO_ECHILD __einfo ( PLATFORM_ECHILD, 0x0c, 0, \
00350                                "No child processes" )
00351 
00352 /** Connection aborted */
00353 #define ECONNABORTED __einfo_error ( EINFO_ECONNABORTED )
00354 #define EINFO_ECONNABORTED __einfo ( PLATFORM_ECONNABORTED, 0x0d, 0, \
00355                                      "Connection aborted" )
00356 
00357 /** Connection refused */
00358 #define ECONNREFUSED __einfo_error ( EINFO_ECONNREFUSED )
00359 #define EINFO_ECONNREFUSED __einfo ( PLATFORM_ECONNREFUSED, 0x0e, 0, \
00360                                      "Connection refused" )
00361 
00362 /** Connection reset */
00363 #define ECONNRESET __einfo_error ( EINFO_ECONNRESET )
00364 #define EINFO_ECONNRESET __einfo ( PLATFORM_ECONNRESET, 0x0f, 0, \
00365                                    "Connection reset" )
00366 
00367 /** Resource deadlock avoided */
00368 #define EDEADLK __einfo_error ( EINFO_EDEADLK )
00369 #define EINFO_EDEADLK __einfo ( PLATFORM_EDEADLK, 0x10, 0, \
00370                                 "Resource deadlock avoided" )
00371 
00372 /** Destination address required */
00373 #define EDESTADDRREQ __einfo_error ( EINFO_EDESTADDRREQ )
00374 #define EINFO_EDESTADDRREQ __einfo ( PLATFORM_EDESTADDRREQ, 0x11, 0, \
00375                                      "Destination address required" )
00376 
00377 /** Mathematics argument out of domain of function */
00378 #define EDOM __einfo_error ( EINFO_EDOM )
00379 #define EINFO_EDOM __einfo ( PLATFORM_EDOM, 0x12, 0, \
00380                              "Mathematics argument out of domain of function" )
00381 
00382 /** Disk quota exceeded */
00383 #define EDQUOT __einfo_error ( EINFO_EDQUOT )
00384 #define EINFO_EDQUOT __einfo ( PLATFORM_EDQUOT, 0x13, 0, \
00385                                "Disk quote exceeded" )
00386 
00387 /** File exists */
00388 #define EEXIST __einfo_error ( EINFO_EEXIST )
00389 #define EINFO_EEXIST __einfo ( PLATFORM_EEXIST, 0x14, 0, \
00390                                "File exists" )
00391 
00392 /** Bad address */
00393 #define EFAULT __einfo_error ( EINFO_EFAULT )
00394 #define EINFO_EFAULT __einfo ( PLATFORM_EFAULT, 0x15, 0, \
00395                                "Bad address" )
00396 
00397 /** File too large */
00398 #define EFBIG __einfo_error ( EINFO_EFBIG )
00399 #define EINFO_EFBIG __einfo ( PLATFORM_EFBIG, 0x16, 0, \
00400                               "File too large" )
00401 
00402 /** Host is unreachable */
00403 #define EHOSTUNREACH __einfo_error ( EINFO_EHOSTUNREACH )
00404 #define EINFO_EHOSTUNREACH __einfo ( PLATFORM_EHOSTUNREACH, 0x17, 0, \
00405                                      "Host is unreachable" )
00406 
00407 /** Identifier removed */
00408 #define EIDRM __einfo_error ( EINFO_EIDRM )
00409 #define EINFO_EIDRM __einfo ( PLATFORM_EIDRM, 0x18, 0, \
00410                               "Identifier removed" )
00411 
00412 /** Illegal byte sequence */
00413 #define EILSEQ __einfo_error ( EINFO_EILSEQ )
00414 #define EINFO_EILSEQ __einfo ( PLATFORM_EILSEQ, 0x19, 0, \
00415                                "Illegal byte sequence" )
00416 
00417 /** Operation in progress */
00418 #define EINPROGRESS __einfo_error ( EINFO_EINPROGRESS )
00419 #define EINFO_EINPROGRESS __einfo ( PLATFORM_EINPROGRESS, 0x1a, 0, \
00420                                     "Operation in progress" )
00421 
00422 /** Interrupted function call */
00423 #define EINTR __einfo_error ( EINFO_EINTR )
00424 #define EINFO_EINTR __einfo ( PLATFORM_EINTR, 0x1b, 0, \
00425                               "Interrupted function call" )
00426 
00427 /** Invalid argument */
00428 #define EINVAL __einfo_error ( EINFO_EINVAL )
00429 #define EINFO_EINVAL __einfo ( PLATFORM_EINVAL, 0x1c, 0, \
00430                                "Invalid argument" )
00431 
00432 /** Input/output error */
00433 #define EIO __einfo_error ( EINFO_EIO )
00434 #define EINFO_EIO __einfo ( PLATFORM_EIO, 0x1d, 0, \
00435                             "Input/output error" )
00436 
00437 /** Socket is connected */
00438 #define EISCONN __einfo_error ( EINFO_EISCONN )
00439 #define EINFO_EISCONN __einfo ( PLATFORM_EISCONN, 0x1e, 0, \
00440                                 "Socket is connected" )
00441 
00442 /** Is a directory */
00443 #define EISDIR __einfo_error ( EINFO_EISDIR )
00444 #define EINFO_EISDIR __einfo ( PLATFORM_EISDIR, 0x1f, 0, \
00445                                "Is a directory" )
00446 
00447 /** Too many levels of symbolic links */
00448 #define ELOOP __einfo_error ( EINFO_ELOOP )
00449 #define EINFO_ELOOP __einfo ( PLATFORM_ELOOP, 0x20, 0, \
00450                               "Too many levels of symbolic links" )
00451 
00452 /** Too many open files */
00453 #define EMFILE __einfo_error ( EINFO_EMFILE )
00454 #define EINFO_EMFILE __einfo ( PLATFORM_EMFILE, 0x21, 0, \
00455                                "Too many open files" )
00456 
00457 /** Too many links */
00458 #define EMLINK __einfo_error ( EINFO_EMLINK )
00459 #define EINFO_EMLINK __einfo ( PLATFORM_EMLINK, 0x22, 0, \
00460                                "Too many links" )
00461 
00462 /** Message too long */
00463 #define EMSGSIZE __einfo_error ( EINFO_EMSGSIZE )
00464 #define EINFO_EMSGSIZE __einfo ( PLATFORM_EMSGSIZE, 0x23, 0, \
00465                                  "Message too long" )
00466 
00467 /** Multihop attempted */
00468 #define EMULTIHOP __einfo_error ( EINFO_EMULTIHOP )
00469 #define EINFO_EMULTIHOP __einfo ( PLATFORM_EMULTIHOP, 0x24, 0, \
00470                                   "Multihop attempted" )
00471 
00472 /** Filename too long */
00473 #define ENAMETOOLONG __einfo_error ( EINFO_ENAMETOOLONG )
00474 #define EINFO_ENAMETOOLONG __einfo ( PLATFORM_ENAMETOOLONG, 0x25, 0, \
00475                                      "Filename too long" )
00476 
00477 /** Network is down */
00478 #define ENETDOWN __einfo_error ( EINFO_ENETDOWN )
00479 #define EINFO_ENETDOWN __einfo ( PLATFORM_ENETDOWN, 0x26, 0, \
00480                                  "Network is down" )
00481 
00482 /** Connection aborted by network */
00483 #define ENETRESET __einfo_error ( EINFO_ENETRESET )
00484 #define EINFO_ENETRESET __einfo ( PLATFORM_ENETRESET, 0x27, 0, \
00485                                   "Connection aborted by network" )
00486 
00487 /** Network unreachable */
00488 #define ENETUNREACH __einfo_error ( EINFO_ENETUNREACH )
00489 #define EINFO_ENETUNREACH __einfo ( PLATFORM_ENETUNREACH, 0x28, 0, \
00490                                     "Network unreachable" )
00491 
00492 /** Too many open files in system */
00493 #define ENFILE __einfo_error ( EINFO_ENFILE )
00494 #define EINFO_ENFILE __einfo ( PLATFORM_ENFILE, 0x29, 0, \
00495                                "Too many open files in system" )
00496 
00497 /** No buffer space available */
00498 #define ENOBUFS __einfo_error ( EINFO_ENOBUFS )
00499 #define EINFO_ENOBUFS __einfo ( PLATFORM_ENOBUFS, 0x2a, 0, \
00500                                 "No buffer space available" )
00501 
00502 /** No message is available on the STREAM head read queue */
00503 #define ENODATA __einfo_error ( EINFO_ENODATA )
00504 #define EINFO_ENODATA __einfo ( PLATFORM_ENODATA, 0x2b, 0, \
00505                                 "No message is available on the STREAM " \
00506                                 "head read queue" )
00507 
00508 /** No such device */
00509 #define ENODEV __einfo_error ( EINFO_ENODEV )
00510 #define EINFO_ENODEV __einfo ( PLATFORM_ENODEV, 0x2c, 0, \
00511                                "No such device" )
00512 
00513 /** No such file or directory */
00514 #define ENOENT __einfo_error ( EINFO_ENOENT )
00515 #define EINFO_ENOENT __einfo ( PLATFORM_ENOENT, 0x2d, 0, \
00516                                "No such file or directory" )
00517 
00518 /** Exec format error */
00519 #define ENOEXEC __einfo_error ( EINFO_ENOEXEC )
00520 #define EINFO_ENOEXEC __einfo ( PLATFORM_ENOEXEC, 0x2e, 0, \
00521                                 "Exec format error" )
00522 
00523 /** No locks available */
00524 #define ENOLCK __einfo_error ( EINFO_ENOLCK )
00525 #define EINFO_ENOLCK __einfo ( PLATFORM_ENOLCK, 0x2f, 0, \
00526                                "No locks available" )
00527 
00528 /** Link has been severed */
00529 #define ENOLINK __einfo_error ( EINFO_ENOLINK )
00530 #define EINFO_ENOLINK __einfo ( PLATFORM_ENOLINK, 0x30, 0, \
00531                                 "Link has been severed" )
00532 
00533 /** Not enough space */
00534 #define ENOMEM __einfo_error ( EINFO_ENOMEM )
00535 #define EINFO_ENOMEM __einfo ( PLATFORM_ENOMEM, 0x31, 0, \
00536                                "Not enough space" )
00537 
00538 /** No message of the desired type */
00539 #define ENOMSG __einfo_error ( EINFO_ENOMSG )
00540 #define EINFO_ENOMSG __einfo ( PLATFORM_ENOMSG, 0x32, 0, \
00541                                "No message of the desired type" )
00542 
00543 /** Protocol not available */
00544 #define ENOPROTOOPT __einfo_error ( EINFO_ENOPROTOOPT )
00545 #define EINFO_ENOPROTOOPT __einfo ( PLATFORM_ENOPROTOOPT, 0x33, 0, \
00546                                     "Protocol not available" )
00547 
00548 /** No space left on device */
00549 #define ENOSPC __einfo_error ( EINFO_ENOSPC )
00550 #define EINFO_ENOSPC __einfo ( PLATFORM_ENOSPC, 0x34, 0, \
00551                                "No space left on device" )
00552 
00553 /** No STREAM resources */
00554 #define ENOSR __einfo_error ( EINFO_ENOSR )
00555 #define EINFO_ENOSR __einfo ( PLATFORM_ENOSR, 0x35, 0, \
00556                               "No STREAM resources" )
00557 
00558 /** Not a STREAM */
00559 #define ENOSTR __einfo_error ( EINFO_ENOSTR )
00560 #define EINFO_ENOSTR __einfo ( PLATFORM_ENOSTR, 0x36, 0, \
00561                                "Not a STREAM" )
00562 
00563 /** Function not implemented */
00564 #define ENOSYS __einfo_error ( EINFO_ENOSYS )
00565 #define EINFO_ENOSYS __einfo ( PLATFORM_ENOSYS, 0x37, 0, \
00566                                "Function not implemented" )
00567 
00568 /** The socket is not connected */
00569 #define ENOTCONN __einfo_error ( EINFO_ENOTCONN )
00570 #define EINFO_ENOTCONN __einfo ( PLATFORM_ENOTCONN, 0x38, 0, \
00571                                  "The socket is not connected" )
00572 
00573 /** Not a directory */
00574 #define ENOTDIR __einfo_error ( EINFO_ENOTDIR )
00575 #define EINFO_ENOTDIR __einfo ( PLATFORM_ENOTDIR, 0x39, 0, \
00576                                 "Not a directory" )
00577 
00578 /** Directory not empty */
00579 #define ENOTEMPTY __einfo_error ( EINFO_ENOTEMPTY )
00580 #define EINFO_ENOTEMPTY __einfo ( PLATFORM_ENOTEMPTY, 0x3a, 0, \
00581                                   "Directory not empty" )
00582 
00583 /** Not a socket */
00584 #define ENOTSOCK __einfo_error ( EINFO_ENOTSOCK )
00585 #define EINFO_ENOTSOCK __einfo ( PLATFORM_ENOTSOCK, 0x3b, 0, \
00586                                  "Not a socket" )
00587 
00588 /** Operation not supported */
00589 #define ENOTSUP __einfo_error ( EINFO_ENOTSUP )
00590 #define EINFO_ENOTSUP __einfo ( PLATFORM_ENOTSUP, 0x3c, 0, \
00591                                 "Operation not supported" )
00592 
00593 /** Inappropriate I/O control operation */
00594 #define ENOTTY __einfo_error ( EINFO_ENOTTY )
00595 #define EINFO_ENOTTY __einfo ( PLATFORM_ENOTTY, 0x3d, 0, \
00596                                "Inappropriate I/O control operation" )
00597 
00598 /** No such device or address */
00599 #define ENXIO __einfo_error ( EINFO_ENXIO )
00600 #define EINFO_ENXIO __einfo ( PLATFORM_ENXIO, 0x3e, 0, \
00601                               "No such device or address" )
00602 
00603 /** Operation not supported on socket */
00604 #define EOPNOTSUPP __einfo_error ( EINFO_EOPNOTSUPP )
00605 #define EINFO_EOPNOTSUPP __einfo ( PLATFORM_EOPNOTSUPP, 0x3f, 0, \
00606                                    "Operation not supported on socket" )
00607 
00608 /** Value too large to be stored in data type */
00609 #define EOVERFLOW __einfo_error ( EINFO_EOVERFLOW )
00610 #define EINFO_EOVERFLOW __einfo ( PLATFORM_EOVERFLOW, 0x40, 0, \
00611                                   "Value too large to be stored in data type" )
00612 
00613 /** Operation not permitted */
00614 #define EPERM __einfo_error ( EINFO_EPERM )
00615 #define EINFO_EPERM __einfo ( PLATFORM_EPERM, 0x41, 0, \
00616                               "Operation not permitted" )
00617 
00618 /** Broken pipe */
00619 #define EPIPE __einfo_error ( EINFO_EPIPE )
00620 #define EINFO_EPIPE __einfo ( PLATFORM_EPIPE, 0x42, 0, \
00621                               "Broken pipe" )
00622 
00623 /** Protocol error */
00624 #define EPROTO __einfo_error ( EINFO_EPROTO )
00625 #define EINFO_EPROTO __einfo ( PLATFORM_EPROTO, 0x43, 0, \
00626                                "Protocol error" )
00627 
00628 /** Protocol not supported */
00629 #define EPROTONOSUPPORT __einfo_error ( EINFO_EPROTONOSUPPORT )
00630 #define EINFO_EPROTONOSUPPORT __einfo ( PLATFORM_EPROTONOSUPPORT, 0x44, 0, \
00631                                         "Protocol not supported" )
00632 
00633 /** Protocol wrong type for socket */
00634 #define EPROTOTYPE __einfo_error ( EINFO_EPROTOTYPE )
00635 #define EINFO_EPROTOTYPE __einfo ( PLATFORM_EPROTOTYPE, 0x45, 0, \
00636                                    "Protocol wrong type for socket" )
00637 
00638 /** Result too large */
00639 #define ERANGE __einfo_error ( EINFO_ERANGE )
00640 #define EINFO_ERANGE __einfo ( PLATFORM_ERANGE, 0x46, 0, \
00641                                "Result too large" )
00642 
00643 /** Read-only file system */
00644 #define EROFS __einfo_error ( EINFO_EROFS )
00645 #define EINFO_EROFS __einfo ( PLATFORM_EROFS, 0x47, 0, \
00646                               "Read-only file system" )
00647 
00648 /** Invalid seek */
00649 #define ESPIPE __einfo_error ( EINFO_ESPIPE )
00650 #define EINFO_ESPIPE __einfo ( PLATFORM_ESPIPE, 0x48, 0, \
00651                                "Invalid seek" )
00652 
00653 /** No such process */
00654 #define ESRCH __einfo_error ( EINFO_ESRCH )
00655 #define EINFO_ESRCH __einfo ( PLATFORM_ESRCH, 0x49, 0, \
00656                               "No such process" )
00657 
00658 /** Stale file handle */
00659 #define ESTALE __einfo_error ( EINFO_ESTALE )
00660 #define EINFO_ESTALE __einfo ( PLATFORM_ESTALE, 0x4a, 0, \
00661                                "Stale file handle" )
00662 
00663 /** Timer expired */
00664 #define ETIME __einfo_error ( EINFO_ETIME )
00665 #define EINFO_ETIME __einfo ( PLATFORM_ETIME, 0x4b, 0, \
00666                               "Timer expired" )
00667 
00668 /** Connection timed out */
00669 #define ETIMEDOUT __einfo_error ( EINFO_ETIMEDOUT )
00670 #define EINFO_ETIMEDOUT __einfo ( PLATFORM_ETIMEDOUT, 0x4c, 0, \
00671                                   "Connection timed out" )
00672 
00673 /** Text file busy */
00674 #define ETXTBSY __einfo_error ( EINFO_ETXTBSY )
00675 #define EINFO_ETXTBSY __einfo ( PLATFORM_ETXTBSY, 0x4d, 0, \
00676                                 "Text file busy" )
00677 
00678 /** Operation would block */
00679 #define EWOULDBLOCK __einfo_error ( EINFO_EWOULDBLOCK )
00680 #define EINFO_EWOULDBLOCK __einfo ( PLATFORM_EWOULDBLOCK, 0x4e, 0, \
00681                                     "Operation would block" )
00682 
00683 /** Improper link */
00684 #define EXDEV __einfo_error ( EINFO_EXDEV )
00685 #define EINFO_EXDEV __einfo ( PLATFORM_EXDEV, 0x4f, 0, \
00686                               "Improper link" )
00687 
00688 /** @} */
00689 
00690 /** Platform-generated base error */
00691 #define EINFO_EPLATFORM __einfo ( 0, 0x7f, 0, "Platform-generated error" )
00692 
00693 extern int errno;
00694 
00695 #endif /* ERRNO_H */