4 #include <gpxe/errortab.h>
10 * The error numbers used by Etherboot are a superset of those defined
11 * by the PXE specification version 2.1. See errno.h for a listing of
14 * To save space in ROM images, error string tables are optional. Use
15 * the ERRORMSG_XXX options in config.h to select which error string
16 * tables you want to include. If an error string table is omitted,
17 * strerror() will simply return the text "Error 0x<errno>".
21 static struct errortab errortab_start[0] __table_start(errortab);
22 static struct errortab errortab_end[0] __table_end(errortab);
25 * Retrieve string representation of error number.
27 * @v errno Error number
28 * @ret strerror Pointer to error text
30 * If the error is not found in the linked-in error tables, generates
31 * a generic "Error 0x<errno>" message.
33 * The pointer returned by strerror() is valid only until the next
37 const char * strerror ( int errno ) {
38 static char *generic_message = "Error 0x0000";
39 struct errortab *errortab;
41 for ( errortab = errortab_start ; errortab < errortab_end ;
43 if ( errortab->errno == errno )
44 return errortab->text;
47 sprintf ( generic_message + 8, "%hx", errno );
48 return generic_message;