aboutsummaryrefslogtreecommitdiff
path: root/src/include/errno.h
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2010-05-30 15:29:05 +0100
committerMichael Brown <mcb30@ipxe.org>2010-05-31 03:11:57 +0100
commit6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac (patch)
treeb04dd064c978bf0525649e9d1b936a9724deadaf /src/include/errno.h
parentd2415be06935a270a45fc62db18c5730f71171cb (diff)
downloadipxe-6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac.zip
ipxe-6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac.tar.gz
ipxe-6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac.tar.bz2
[libc] Enable automated extraction of error usage reports
Add preprocessor magic to the error definitions to enable every error usage to be tracked. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/errno.h')
-rw-r--r--src/include/errno.h567
1 files changed, 409 insertions, 158 deletions
diff --git a/src/include/errno.h b/src/include/errno.h
index 0757fad..45d5382 100644
--- a/src/include/errno.h
+++ b/src/include/errno.h
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
#ifndef ERRNO_H
#define ERRNO_H
@@ -40,19 +58,13 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*
* The convention within the code is that errors are negative and
- * expressed using the POSIX error code and (optionally) a per-file
- * disambiguator, e.g.
+ * expressed using the POSIX error, e.g.
*
* return -EINVAL;
*
- * or
- *
- * #define ETCP_BAD_CHECKSUM EUNIQ_02
- * return -( EINVAL | ETCP_BAD_CHECKSUM )
- *
* By various bits of preprocessor magic, the PXE error code and file
* identifier are already incorporated into the definition of the
- * POSIX error code, which keeps the code relatively clean.
+ * POSIX error macro, which keeps the code relatively clean.
*
*
* Functions that wish to return failures should be declared as
@@ -69,6 +81,21 @@ FILE_LICENCE ( GPL2_OR_LATER );
* As illustrated in the above example, error returns should generally
* be directly propagated upward to the calling function.
*
+ *
+ * Individual files may declare localised errors using
+ * __einfo_uniqify(). For example, iscsi.c declares a localised
+ * version of EACCES for the error of "access denied due to incorrect
+ * target username":
+ *
+ * #define EACCES_INCORRECT_TARGET_USERNAME \
+ * __einfo_error ( EINFO_EACCES_INCORRECT_TARGET_USERNAME )
+ * #define EINFO_EACCES_INCORRECT_TARGET_USERNAME \
+ * __einfo_uniqify ( EINFO_EACCESS, 0x01, "Incorrect target username" )
+ *
+ * which can then be used as:
+ *
+ * return -EACCES_INCORRECT_TARGET_USERNAME;
+ *
*/
/* Get definitions for file identifiers */
@@ -85,8 +112,121 @@ extern char missing_errfile_declaration[] __attribute__ (( deprecated ));
#define ERRFILE ( 0 * ( ( int ) missing_errfile_declaration ) )
#endif
-/** Derive PXENV_STATUS code from iPXE error number */
-#define PXENV_STATUS( rc ) ( (-(rc)) & 0x00ff )
+/**
+ * Declare error information
+ *
+ * @v pxe PXE error number (0x00-0xff)
+ * @v posix POSIX error number (0x00-0x7f)
+ * @v uniq Error disambiguator (0x00-0x1f)
+ * @v desc Error description
+ * @ret einfo Error information
+ */
+#define __einfo( pxe, posix, uniq, desc ) ( pxe, posix, uniq, desc )
+
+/**
+ * Get PXE error number
+ *
+ * @v einfo Error information
+ * @ret pxe PXE error number
+ */
+#define __einfo_pxe( einfo ) __einfo_extract_pxe einfo
+#define __einfo_extract_pxe( pxe, posix, uniq, desc ) pxe
+
+/**
+ * Get POSIX error number
+ *
+ * @v einfo Error information
+ * @ret posix POSIX error number
+ */
+#define __einfo_posix( einfo ) __einfo_extract_posix einfo
+#define __einfo_extract_posix( pxe, posix, uniq, desc ) posix
+
+/**
+ * Get error disambiguator
+ *
+ * @v einfo Error information
+ * @ret uniq Error disambiguator
+ */
+#define __einfo_uniq( einfo ) __einfo_extract_uniq einfo
+#define __einfo_extract_uniq( pxe, posix, uniq, desc ) uniq
+
+/**
+ * Get error description
+ *
+ * @v einfo Error information
+ * @ret desc Error description
+ */
+#define __einfo_desc( einfo ) __einfo_extract_desc einfo
+#define __einfo_extract_desc( pxe, posix, uniq, desc ) desc
+
+/**
+ * Declare disambiguated error
+ *
+ * @v einfo_base Base error information
+ * @v uniq Error disambiguator
+ * @v desc Error description
+ * @ret einfo Error information
+ */
+#define __einfo_uniqify( einfo_base, uniq, desc ) \
+ __einfo ( __einfo_pxe ( einfo_base ), \
+ __einfo_posix ( einfo_base ), \
+ uniq, desc )
+
+/**
+ * Get error number
+ *
+ * @v einfo Error information
+ * @ret errno Error number
+ */
+#define __einfo_errno( einfo ) \
+ ( ( __einfo_posix ( einfo ) << 24 ) | ( ERRFILE ) | \
+ ( __einfo_uniq ( einfo ) << 8 ) | \
+ ( __einfo_pxe ( einfo ) << 0 ) )
+
+/**
+ * Disambiguate a base error based on non-constant information
+ *
+ * @v error_base Base error
+ * @v uniq Error disambiguator
+ * @v ... List of expected possible disambiguated errors
+ * @ret error Error
+ *
+ * EUNIQ() should be used when information from an external source is
+ * being incorporated into an error. For example, the 802.11 stack
+ * uses EUNIQ() to incorporate 802.11 status codes returned by an
+ * access point into an error.
+ *
+ * EUNIQ() should not be used for constant error disambiguators; use
+ * __einfo_uniqify() instead.
+ */
+#define EUNIQ( errno, uniq, ... ) ( { \
+ euniq_discard ( 0, ##__VA_ARGS__); \
+ ( (errno) | ( (uniq) << 8 ) ); } )
+static inline void euniq_discard ( int dummy __unused, ... ) {}
+
+/**
+ * Declare error
+ *
+ * @v einfo Error information
+ * @ret error Error
+ */
+#define __einfo_error( einfo ) ( { \
+ __asm__ ( ".section \".einfo\", \"\", @progbits\n\t" \
+ ".align 8\n\t" \
+ "\n1:\n\t" \
+ ".long ( 4f - 1b )\n\t" \
+ ".long %c0\n\t" \
+ ".long ( 2f - 1b )\n\t" \
+ ".long ( 3f - 1b )\n\t" \
+ ".long %c1\n\t" \
+ "\n2:\t.asciz \"" __einfo_desc ( einfo ) "\"\n\t" \
+ "\n3:\t.asciz \"" __FILE__ "\"\n\t" \
+ ".align 8\n\t" \
+ "\n4:\n\t" \
+ ".previous\n\t" : : \
+ "i" ( __einfo_errno ( einfo) ), \
+ "i" ( __LINE__ ) ); \
+ __einfo_errno ( einfo ); } )
/**
* @defgroup pxeerrors PXE error codes
@@ -199,309 +339,420 @@ extern char missing_errfile_declaration[] __attribute__ (( deprecated ));
/** @} */
+/** Derive PXENV_STATUS code from iPXE error number */
+#define PXENV_STATUS( rc ) ( (-(rc)) & 0x00ff )
+
/**
* @defgroup posixerrors POSIX error codes
*
* The names and meanings (but not the values) of these error codes
- * are defined by POSIX. We choose to assign unique values which
- * incorporate the closest equivalent PXE error code, so that code may
- * simply use ENOMEM, rather than having to use the cumbersome
- * (ENOMEM|PXENV_STATUS_OUT_OF_RESOURCES).
+ * are defined by POSIX.
*
* @{
*/
/** Operation completed successfully */
-#define ENOERR ( ERRFILE | PXENV_STATUS_SUCCESS | 0x00000000 )
+#define ENOERR __einfo_error ( EINFO_ENOERR )
+#define EINFO_ENOERR __einfo ( PXENV_STATUS_SUCCESS, 0x00, 0, \
+ "Operation completed successfully" )
-/** Arg list too long */
-#define E2BIG ( ERRFILE | PXENV_STATUS_BAD_FUNC | 0x01000000 )
+/** Argument list too long */
+#define E2BIG __einfo_error ( EINFO_E2BIG )
+#define EINFO_E2BIG __einfo ( PXENV_STATUS_BAD_FUNC, 0x01, 0, \
+ "Argument list too long" )
/** Permission denied */
-#define EACCES ( ERRFILE | PXENV_STATUS_TFTP_ACCESS_VIOLATION | 0x02000000 )
+#define EACCES __einfo_error ( EINFO_EACCES )
+#define EINFO_EACCES __einfo ( PXENV_STATUS_TFTP_ACCESS_VIOLATION, 0x02, 0, \
+ "Permission denied" )
-/** Address in use */
-#define EADDRINUSE ( ERRFILE | PXENV_STATUS_UDP_OPEN | 0x03000000 )
+/** Address already in use */
+#define EADDRINUSE __einfo_error ( EINFO_EADDRINUSE )
+#define EINFO_EADDRINUSE __einfo ( PXENV_STATUS_UDP_OPEN, 0x03, 0, \
+ "Address already in use" )
/** Address not available */
-#define EADDRNOTAVAIL ( ERRFILE | PXENV_STATUS_UDP_OPEN | 0x04000000 )
+#define EADDRNOTAVAIL __einfo_error ( EINFO_EADDRNOTAVAIL )
+#define EINFO_EADDRNOTAVAIL __einfo ( PXENV_STATUS_UDP_OPEN, 0x04, 0, \
+ "Address not available" )
/** Address family not supported */
-#define EAFNOSUPPORT ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x05000000 )
+#define EAFNOSUPPORT __einfo_error ( EINFO_EAFNOSUPPORT )
+#define EINFO_EAFNOSUPPORT __einfo ( PXENV_STATUS_UNSUPPORTED, 0x05, 0, \
+ "Address family not supported" )
/** Resource temporarily unavailable */
-#define EAGAIN ( ERRFILE | PXENV_STATUS_FAILURE | 0x06000000 )
+#define EAGAIN __einfo_error ( EINFO_EAGAIN )
+#define EINFO_EAGAIN __einfo ( PXENV_STATUS_FAILURE, 0x06, 0, \
+ "Resource temporarily unavailable" )
/** Connection already in progress */
-#define EALREADY ( ERRFILE | PXENV_STATUS_UDP_OPEN | 0x07000000 )
+#define EALREADY __einfo_error ( EINFO_EALREADY )
+#define EINFO_EALREADY __einfo ( PXENV_STATUS_UDP_OPEN, 0x07, 0, \
+ "Connection already in progress" )
/** Bad file descriptor */
-#define EBADF ( ERRFILE | PXENV_STATUS_TFTP_CLOSED | 0x08000000 )
+#define EBADF __einfo_error ( EINFO_EBADF )
+#define EINFO_EBADF __einfo ( PXENV_STATUS_TFTP_CLOSED, 0x08, 0, \
+ "Bad file descriptor" )
/** Bad message */
-#define EBADMSG ( ERRFILE | PXENV_STATUS_FAILURE | 0x09000000 )
+#define EBADMSG __einfo_error ( EINFO_EBADMSG )
+#define EINFO_EBADMSG __einfo ( PXENV_STATUS_FAILURE, 0x09, 0, \
+ "Bad message" )
-/** Resource busy */
-#define EBUSY ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x0a000000 )
+/** Device or resource busy */
+#define EBUSY __einfo_error ( EINFO_EBUSY )
+#define EINFO_EBUSY __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x0a, 0, \
+ "Device or resource busy" )
/** Operation canceled */
-#define ECANCELED \
- ( ERRFILE | PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE | 0x0b000000 )
+#define ECANCELED __einfo_error ( EINFO_ECANCELED )
+#define EINFO_ECANCELED __einfo ( PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE, \
+ 0x0b, 0, "Operation canceled" )
/** No child processes */
-#define ECHILD ( ERRFILE | PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x0c000000 )
+#define ECHILD __einfo_error ( EINFO_ECHILD )
+#define EINFO_ECHILD __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x0c, 0, \
+ "No child processes" )
/** Connection aborted */
-#define ECONNABORTED \
- ( ERRFILE | PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION | 0x0d000000 )
+#define ECONNABORTED __einfo_error ( EINFO_ECONNABORTED )
+#define EINFO_ECONNABORTED \
+ __einfo ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION, 0x0d, 0, \
+ "Connection aborted" )
/** Connection refused */
-#define ECONNREFUSED \
- ( ERRFILE | PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION | 0x0e000000 )
+#define ECONNREFUSED __einfo_error ( EINFO_ECONNREFUSED )
+#define EINFO_ECONNREFUSED __einfo ( PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION, \
+ 0x0e, 0, "Connection refused" )
/** Connection reset */
-#define ECONNRESET \
- ( ERRFILE | PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION | 0x0f000000 )
+#define ECONNRESET __einfo_error ( EINFO_ECONNRESET )
+#define EINFO_ECONNRESET \
+ __einfo ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION, 0x0f, 0, \
+ "Connection reset" )
/** Resource deadlock avoided */
-#define EDEADLK ( ERRFILE | PXENV_STATUS_FAILURE | 0x10000000 )
+#define EDEADLK __einfo_error ( EINFO_EDEADLK )
+#define EINFO_EDEADLK __einfo ( PXENV_STATUS_FAILURE, 0x10, 0, \
+ "Resource deadlock avoided" )
/** Destination address required */
-#define EDESTADDRREQ ( ERRFILE | PXENV_STATUS_BAD_FUNC | 0x11000000 )
+#define EDESTADDRREQ __einfo_error ( EINFO_EDESTADDRREQ )
+#define EINFO_EDESTADDRREQ __einfo ( PXENV_STATUS_BAD_FUNC, 0x11, 0, \
+ "Destination address required" )
-/** Domain error */
-#define EDOM ( ERRFILE | PXENV_STATUS_FAILURE | 0x12000000 )
+/** Mathematics argument out of domain of function */
+#define EDOM __einfo_error ( EINFO_EDOM )
+#define EINFO_EDOM __einfo ( PXENV_STATUS_FAILURE, 0x12, 0, \
+ "Mathematics argument out of domain of function" )
-/** Reserved */
-#define EDQUOT ( ERRFILE | PXENV_STATUS_FAILURE | 0x13000000 )
+/** Disk quota exceeded */
+#define EDQUOT __einfo_error ( EINFO_EDQUOT )
+#define EINFO_EDQUOT __einfo ( PXENV_STATUS_FAILURE, 0x13, 0, \
+ "Disk quote exceeded" )
/** File exists */
-#define EEXIST ( ERRFILE | PXENV_STATUS_FAILURE | 0x14000000 )
+#define EEXIST __einfo_error ( EINFO_EEXIST )
+#define EINFO_EEXIST __einfo ( PXENV_STATUS_FAILURE, 0x14, 0, \
+ "File exists" )
/** Bad address */
-#define EFAULT ( ERRFILE | PXENV_STATUS_MCOPY_PROBLEM | 0x15000000 )
+#define EFAULT __einfo_error ( EINFO_EFAULT )
+#define EINFO_EFAULT __einfo ( PXENV_STATUS_MCOPY_PROBLEM, 0x15, 0, \
+ "Bad address" )
/** File too large */
-#define EFBIG ( ERRFILE | PXENV_STATUS_MCOPY_PROBLEM | 0x16000000 )
+#define EFBIG __einfo_error ( EINFO_EFBIG )
+#define EINFO_EFBIG __einfo ( PXENV_STATUS_MCOPY_PROBLEM, 0x16, 0, \
+ "File too large" )
/** Host is unreachable */
-#define EHOSTUNREACH ( ERRFILE | PXENV_STATUS_ARP_TIMEOUT | 0x17000000 )
+#define EHOSTUNREACH __einfo_error ( EINFO_EHOSTUNREACH )
+#define EINFO_EHOSTUNREACH __einfo ( PXENV_STATUS_ARP_TIMEOUT, 0x17, 0, \
+ "Host is unreachable" )
/** Identifier removed */
-#define EIDRM ( ERRFILE | PXENV_STATUS_FAILURE | 0x18000000 )
+#define EIDRM __einfo_error ( EINFO_EIDRM )
+#define EINFO_EIDRM __einfo ( PXENV_STATUS_FAILURE, 0x18, 0, \
+ "Identifier removed" )
/** Illegal byte sequence */
-#define EILSEQ ( ERRFILE | PXENV_STATUS_FAILURE | 0x19000000 )
+#define EILSEQ __einfo_error ( EINFO_EILSEQ )
+#define EINFO_EILSEQ __einfo ( PXENV_STATUS_FAILURE, 0x19, 0, \
+ "Illegal byte sequence" )
/** Operation in progress */
-#define EINPROGRESS ( ERRFILE | PXENV_STATUS_FAILURE | 0x1a000000 )
+#define EINPROGRESS __einfo_error ( EINFO_EINPROGRESS )
+#define EINFO_EINPROGRESS __einfo ( PXENV_STATUS_FAILURE, 0x1a, 0, \
+ "Operation in progress" )
/** Interrupted function call */
-#define EINTR ( ERRFILE | PXENV_STATUS_FAILURE | 0x1b000000 )
+#define EINTR __einfo_error ( EINFO_EINTR )
+#define EINFO_EINTR __einfo ( PXENV_STATUS_FAILURE, 0x1b, 0, \
+ "Interrupted function call" )
/** Invalid argument */
-#define EINVAL ( ERRFILE | PXENV_STATUS_BAD_FUNC | 0x1c000000 )
+#define EINVAL __einfo_error ( EINFO_EINVAL )
+#define EINFO_EINVAL __einfo ( PXENV_STATUS_BAD_FUNC, 0x1c, 0, \
+ "Invalid argument" )
/** Input/output error */
-#define EIO \
- ( ERRFILE | PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION | 0x1d000000 )
+#define EIO __einfo_error ( EINFO_EIO )
+#define EINFO_EIO __einfo ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION, \
+ 0x1d, 0, "Input/output error" )
/** Socket is connected */
-#define EISCONN ( ERRFILE | PXENV_STATUS_UDP_OPEN | 0x1e000000 )
+#define EISCONN __einfo_error ( EINFO_EISCONN )
+#define EINFO_EISCONN __einfo ( PXENV_STATUS_UDP_OPEN, 0x1e, 0, \
+ "Socket is connected" )
/** Is a directory */
-#define EISDIR ( ERRFILE | PXENV_STATUS_FAILURE | 0x1f000000 )
+#define EISDIR __einfo_error ( EINFO_EISDIR )
+#define EINFO_EISDIR __einfo ( PXENV_STATUS_FAILURE, 0x1f, 0, \
+ "Is a directory" )
/** Too many levels of symbolic links */
-#define ELOOP ( ERRFILE | PXENV_STATUS_FAILURE | 0x20000000 )
+#define ELOOP __einfo_error ( EINFO_ELOOP )
+#define EINFO_ELOOP __einfo ( PXENV_STATUS_FAILURE, 0x20, 0, \
+ "Too many levels of symbolic links" )
/** Too many open files */
-#define EMFILE ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x21000000 )
+#define EMFILE __einfo_error ( EINFO_EMFILE )
+#define EINFO_EMFILE __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x21, 0, \
+ "Too many open files" )
/** Too many links */
-#define EMLINK ( ERRFILE | PXENV_STATUS_FAILURE | 0x22000000 )
+#define EMLINK __einfo_error ( EINFO_EMLINK )
+#define EINFO_EMLINK __einfo ( PXENV_STATUS_FAILURE, 0x22, 0, \
+ "Too many links" )
-/** Inappropriate message buffer length */
-#define EMSGSIZE ( ERRFILE | PXENV_STATUS_BAD_FUNC | 0x23000000 )
+/** Message too long */
+#define EMSGSIZE __einfo_error ( EINFO_EMSGSIZE )
+#define EINFO_EMSGSIZE __einfo ( PXENV_STATUS_BAD_FUNC, 0x23, 0, \
+ "Message too long" )
-/** Reserved */
-#define EMULTIHOP ( ERRFILE | PXENV_STATUS_FAILURE | 0x24000000 )
+/** Multihop attempted */
+#define EMULTIHOP __einfo_error ( EINFO_EMULTIHOP )
+#define EINFO_EMULTIHOP __einfo ( PXENV_STATUS_FAILURE, 0x24, 0, \
+ "Multihop attempted" )
/** Filename too long */
-#define ENAMETOOLONG ( ERRFILE | PXENV_STATUS_FAILURE | 0x25000000 )
+#define ENAMETOOLONG __einfo_error ( EINFO_ENAMETOOLONG )
+#define EINFO_ENAMETOOLONG __einfo ( PXENV_STATUS_FAILURE, 0x25, 0, \
+ "Filename too long" )
/** Network is down */
-#define ENETDOWN ( ERRFILE | PXENV_STATUS_ARP_TIMEOUT | 0x26000000 )
+#define ENETDOWN __einfo_error ( EINFO_ENETDOWN )
+#define EINFO_ENETDOWN __einfo ( PXENV_STATUS_ARP_TIMEOUT, 0x26, 0, \
+ "Network is down" )
/** Connection aborted by network */
-#define ENETRESET ( ERRFILE | PXENV_STATUS_FAILURE | 0x27000000 )
+#define ENETRESET __einfo_error ( EINFO_ENETRESET )
+#define EINFO_ENETRESET __einfo ( PXENV_STATUS_FAILURE, 0x27, 0, \
+ "Connection aborted by network" )
/** Network unreachable */
-#define ENETUNREACH ( ERRFILE | PXENV_STATUS_ARP_TIMEOUT | 0x28000000 )
+#define ENETUNREACH __einfo_error ( EINFO_ENETUNREACH )
+#define EINFO_ENETUNREACH __einfo ( PXENV_STATUS_ARP_TIMEOUT, 0x28, 0, \
+ "Network unreachable" )
/** Too many open files in system */
-#define ENFILE ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x29000000 )
+#define ENFILE __einfo_error ( EINFO_ENFILE )
+#define EINFO_ENFILE __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x29, 0, \
+ "Too many open files in system" )
/** No buffer space available */
-#define ENOBUFS ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x2a000000 )
+#define ENOBUFS __einfo_error ( EINFO_ENOBUFS )
+#define EINFO_ENOBUFS __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x2a, 0, \
+ "No buffer space available" )
/** No message is available on the STREAM head read queue */
-#define ENODATA ( ERRFILE | PXENV_STATUS_FAILURE | 0x2b000000 )
+#define ENODATA __einfo_error ( EINFO_ENODATA )
+#define EINFO_ENODATA \
+ __einfo ( PXENV_STATUS_FAILURE, 0x2b, 0, \
+ "No message is available on the STREAM head read queue" )
/** No such device */
-#define ENODEV ( ERRFILE | PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x2c000000 )
+#define ENODEV __einfo_error ( EINFO_ENODEV )
+#define EINFO_ENODEV __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x2c, 0, \
+ "No such device" )
/** No such file or directory */
-#define ENOENT ( ERRFILE | PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x2d000000 )
+#define ENOENT __einfo_error ( EINFO_ENOENT )
+#define EINFO_ENOENT __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x2d, 0, \
+ "No such file or directory" )
/** Exec format error */
-#define ENOEXEC ( ERRFILE | PXENV_STATUS_FAILURE | 0x2e000000 )
+#define ENOEXEC __einfo_error ( EINFO_ENOEXEC )
+#define EINFO_ENOEXEC __einfo ( PXENV_STATUS_FAILURE, 0x2e, 0, \
+ "Exec format error" )
/** No locks available */
-#define ENOLCK ( ERRFILE | PXENV_STATUS_FAILURE | 0x2f000000 )
+#define ENOLCK __einfo_error ( EINFO_ENOLCK )
+#define EINFO_ENOLCK __einfo ( PXENV_STATUS_FAILURE, 0x2f, 0, \
+ "No locks available" )
-/** Reserved */
-#define ENOLINK ( ERRFILE | PXENV_STATUS_FAILURE | 0x30000000 )
+/** Link has been severed */
+#define ENOLINK __einfo_error ( EINFO_ENOLINK )
+#define EINFO_ENOLINK __einfo ( PXENV_STATUS_FAILURE, 0x30, 0, \
+ "Link has been severed" )
/** Not enough space */
-#define ENOMEM ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x31000000 )
+#define ENOMEM __einfo_error ( EINFO_ENOMEM )
+#define EINFO_ENOMEM __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x31, 0, \
+ "Not enough space" )
/** No message of the desired type */
-#define ENOMSG ( ERRFILE | PXENV_STATUS_FAILURE | 0x32000000 )
+#define ENOMSG __einfo_error ( EINFO_ENOMSG )
+#define EINFO_ENOMSG __einfo ( PXENV_STATUS_FAILURE, 0x32, 0, \
+ "No message of the desired type" )
/** Protocol not available */
-#define ENOPROTOOPT ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x33000000 )
+#define ENOPROTOOPT __einfo_error ( EINFO_ENOPROTOOPT )
+#define EINFO_ENOPROTOOPT __einfo ( PXENV_STATUS_UNSUPPORTED, 0x33, 0, \
+ "Protocol not available" )
/** No space left on device */
-#define ENOSPC ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x34000000 )
+#define ENOSPC __einfo_error ( EINFO_ENOSPC )
+#define EINFO_ENOSPC __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x34, 0, \
+ "No space left on device" )
/** No STREAM resources */
-#define ENOSR ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x35000000 )
+#define ENOSR __einfo_error ( EINFO_ENOSR )
+#define EINFO_ENOSR __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x35, 0, \
+ "No STREAM resources" )
/** Not a STREAM */
-#define ENOSTR ( ERRFILE | PXENV_STATUS_FAILURE | 0x36000000 )
+#define ENOSTR __einfo_error ( EINFO_ENOSTR )
+#define EINFO_ENOSTR __einfo ( PXENV_STATUS_FAILURE, 0x36, 0, \
+ "Not a STREAM" )
/** Function not implemented */
-#define ENOSYS ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x37000000 )
+#define ENOSYS __einfo_error ( EINFO_ENOSYS )
+#define EINFO_ENOSYS __einfo ( PXENV_STATUS_UNSUPPORTED, 0x37, 0, \
+ "Function not implemented" )
/** The socket is not connected */
-#define ENOTCONN ( ERRFILE | PXENV_STATUS_FAILURE | 0x38000000 )
+#define ENOTCONN __einfo_error ( EINFO_ENOTCONN )
+#define EINFO_ENOTCONN __einfo ( PXENV_STATUS_FAILURE, 0x38, 0, \
+ "The socket is not connected" )
/** Not a directory */
-#define ENOTDIR ( ERRFILE | PXENV_STATUS_FAILURE | 0x39000000 )
+#define ENOTDIR __einfo_error ( EINFO_ENOTDIR )
+#define EINFO_ENOTDIR __einfo ( PXENV_STATUS_FAILURE, 0x39, 0, \
+ "Not a directory" )
/** Directory not empty */
-#define ENOTEMPTY ( ERRFILE | PXENV_STATUS_FAILURE | 0x3a000000 )
+#define ENOTEMPTY __einfo_error ( EINFO_ENOTEMPTY )
+#define EINFO_ENOTEMPTY __einfo ( PXENV_STATUS_FAILURE, 0x3a, 0, \
+ "Directory not empty" )
/** Not a socket */
-#define ENOTSOCK ( ERRFILE | PXENV_STATUS_FAILURE | 0x3b000000 )
+#define ENOTSOCK __einfo_error ( EINFO_ENOTSOCK )
+#define EINFO_ENOTSOCK __einfo ( PXENV_STATUS_FAILURE, 0x3b, 0, \
+ "Not a socket" )
-/** Not supported */
-#define ENOTSUP ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x3c000000 )
+/** Operation not supported */
+#define ENOTSUP __einfo_error ( EINFO_ENOTSUP )
+#define EINFO_ENOTSUP __einfo ( PXENV_STATUS_UNSUPPORTED, 0x3c, 0, \
+ "Operation not supported" )
/** Inappropriate I/O control operation */
-#define ENOTTY ( ERRFILE | PXENV_STATUS_FAILURE | 0x3d000000 )
+#define ENOTTY __einfo_error ( EINFO_ENOTTY )
+#define EINFO_ENOTTY __einfo ( PXENV_STATUS_FAILURE, 0x3d, 0, \
+ "Inappropriate I/O control operation" )
/** No such device or address */
-#define ENXIO ( ERRFILE | PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x3e000000 )
+#define ENXIO __einfo_error ( EINFO_ENXIO )
+#define EINFO_ENXIO __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x3e, 0, \
+ "No such device or address" )
/** Operation not supported on socket */
-#define EOPNOTSUPP ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x3f000000 )
+#define EOPNOTSUPP __einfo_error ( EINFO_EOPNOTSUPP )
+#define EINFO_EOPNOTSUPP __einfo ( PXENV_STATUS_UNSUPPORTED, 0x3f, 0, \
+ "Operation not supported on socket" )
/** Value too large to be stored in data type */
-#define EOVERFLOW ( ERRFILE | PXENV_STATUS_FAILURE | 0x40000000 )
+#define EOVERFLOW __einfo_error ( EINFO_EOVERFLOW )
+#define EINFO_EOVERFLOW __einfo ( PXENV_STATUS_FAILURE, 0x40, 0, \
+ "Value too large to be stored in data type" )
/** Operation not permitted */
-#define EPERM ( ERRFILE | PXENV_STATUS_TFTP_ACCESS_VIOLATION | 0x41000000 )
+#define EPERM __einfo_error ( EINFO_EPERM )
+#define EINFO_EPERM __einfo ( PXENV_STATUS_TFTP_ACCESS_VIOLATION, 0x41, 0, \
+ "Operation not permitted" )
/** Broken pipe */
-#define EPIPE ( ERRFILE | PXENV_STATUS_FAILURE | 0x42000000 )
+#define EPIPE __einfo_error ( EINFO_EPIPE )
+#define EINFO_EPIPE __einfo ( PXENV_STATUS_FAILURE, 0x42, 0, \
+ "Broken pipe" )
/** Protocol error */
-#define EPROTO ( ERRFILE | PXENV_STATUS_FAILURE | 0x43000000 )
+#define EPROTO __einfo_error ( EINFO_EPROTO )
+#define EINFO_EPROTO __einfo ( PXENV_STATUS_FAILURE, 0x43, 0, \
+ "Protocol error" )
/** Protocol not supported */
-#define EPROTONOSUPPORT ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x44000000 )
+#define EPROTONOSUPPORT __einfo_error ( EINFO_EPROTONOSUPPORT )
+#define EINFO_EPROTONOSUPPORT __einfo ( PXENV_STATUS_UNSUPPORTED, 0x44, 0, \
+ "Protocol not supported" )
/** Protocol wrong type for socket */
-#define EPROTOTYPE ( ERRFILE | PXENV_STATUS_FAILURE | 0x45000000 )
+#define EPROTOTYPE __einfo_error ( EINFO_EPROTOTYPE )
+#define EINFO_EPROTOTYPE __einfo ( PXENV_STATUS_FAILURE, 0x45, 0, \
+ "Protocol wrong type for socket" )
/** Result too large */
-#define ERANGE ( ERRFILE | PXENV_STATUS_FAILURE | 0x46000000 )
+#define ERANGE __einfo_error ( EINFO_ERANGE )
+#define EINFO_ERANGE __einfo ( PXENV_STATUS_FAILURE, 0x46, 0, \
+ "Result too large" )
/** Read-only file system */
-#define EROFS ( ERRFILE | PXENV_STATUS_FAILURE | 0x47000000 )
+#define EROFS __einfo_error ( EINFO_EROFS )
+#define EINFO_EROFS __einfo ( PXENV_STATUS_FAILURE, 0x47, 0, \
+ "Read-only file system" )
/** Invalid seek */
-#define ESPIPE ( ERRFILE | PXENV_STATUS_FAILURE | 0x48000000 )
+#define ESPIPE __einfo_error ( EINFO_ESPIPE )
+#define EINFO_ESPIPE __einfo ( PXENV_STATUS_FAILURE, 0x48, 0, \
+ "Invalid seek" )
/** No such process */
-#define ESRCH ( ERRFILE | PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x49000000 )
+#define ESRCH __einfo_error ( EINFO_ESRCH )
+#define EINFO_ESRCH __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x49, 0, \
+ "No such process" )
/** Stale file handle */
-#define ESTALE ( ERRFILE | PXENV_STATUS_FAILURE | 0x4a000000 )
+#define ESTALE __einfo_error ( EINFO_ESTALE )
+#define EINFO_ESTALE __einfo ( PXENV_STATUS_FAILURE, 0x4a, 0, \
+ "Stale file handle" )
-/** STREAM ioctl() timeout */
-#define ETIME ( ERRFILE | PXENV_STATUS_FAILURE | 0x4b000000 )
+/** Timer expired */
+#define ETIME __einfo_error ( EINFO_ETIME )
+#define EINFO_ETIME __einfo ( PXENV_STATUS_FAILURE, 0x4b, 0, \
+ "Timer expired" )
-/** Operation timed out */
-#define ETIMEDOUT ( ERRFILE | PXENV_STATUS_TFTP_READ_TIMEOUT | 0x4c000000 )
+/** Connection timed out */
+#define ETIMEDOUT __einfo_error ( EINFO_ETIMEDOUT )
+#define EINFO_ETIMEDOUT __einfo ( PXENV_STATUS_TFTP_READ_TIMEOUT, 0x4c, 0, \
+ "Connection timed out" )
/** Text file busy */
-#define ETXTBSY ( ERRFILE | PXENV_STATUS_FAILURE | 0x4d000000 )
+#define ETXTBSY __einfo_error ( EINFO_ETXTBSY )
+#define EINFO_ETXTBSY __einfo ( PXENV_STATUS_FAILURE, 0x4d, 0, \
+ "Text file busy" )
-/** Operation would block (different from EAGAIN!) */
-#define EWOULDBLOCK ( ERRFILE | PXENV_STATUS_TFTP_OPEN | 0x4e000000 )
+/** Operation would block */
+#define EWOULDBLOCK __einfo_error ( EINFO_EWOULDBLOCK )
+#define EINFO_EWOULDBLOCK __einfo ( PXENV_STATUS_TFTP_OPEN, 0x4e, 0, \
+ "Operation would block" )
/** Improper link */
-#define EXDEV ( ERRFILE | PXENV_STATUS_FAILURE | 0x4f000000 )
-
-/** @} */
-
-/**
- * @defgroup euniq Per-file error disambiguators
- *
- * Files which use the same error number multiple times should
- * probably define their own error subspace using these
- * disambiguators. For example:
- *
- * #define ETCP_HEADER_TOO_SHORT EUNIQ_01
- * #define ETCP_BAD_CHECKSUM EUNIQ_02
- *
- * @{
- */
-
-#define EUNIQ_01 0x00000100
-#define EUNIQ_02 0x00000200
-#define EUNIQ_03 0x00000300
-#define EUNIQ_04 0x00000400
-#define EUNIQ_05 0x00000500
-#define EUNIQ_06 0x00000600
-#define EUNIQ_07 0x00000700
-#define EUNIQ_08 0x00000800
-#define EUNIQ_09 0x00000900
-#define EUNIQ_0A 0x00000a00
-#define EUNIQ_0B 0x00000b00
-#define EUNIQ_0C 0x00000c00
-#define EUNIQ_0D 0x00000d00
-#define EUNIQ_0E 0x00000e00
-#define EUNIQ_0F 0x00000f00
-#define EUNIQ_10 0x00001000
-#define EUNIQ_11 0x00001100
-#define EUNIQ_12 0x00001200
-#define EUNIQ_13 0x00001300
-#define EUNIQ_14 0x00001400
-#define EUNIQ_15 0x00001500
-#define EUNIQ_16 0x00001600
-#define EUNIQ_17 0x00001700
-#define EUNIQ_18 0x00001800
-#define EUNIQ_19 0x00001900
-#define EUNIQ_1A 0x00001a00
-#define EUNIQ_1B 0x00001b00
-#define EUNIQ_1C 0x00001c00
-#define EUNIQ_1D 0x00001d00
-#define EUNIQ_1E 0x00001e00
-#define EUNIQ_1F 0x00001f00
+#define EXDEV __einfo_error ( EINFO_EXDEV )
+#define EINFO_EXDEV __einfo ( PXENV_STATUS_FAILURE, 0x4f, 0, \
+ "Improper link" )
/** @} */