#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <gpxe/errortab.h>
Go to the source code of this file.
Defines | |
| #define | ERRFILE 0 |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static struct errortab * | find_error (int errno) |
| Find error description. | |
| static struct errortab * | find_closest_error (int errno) |
| Find closest error description. | |
| const char * | strerror (int errno) |
| Retrieve string representation of error number. | |
Variables | |
| struct errortab common_errors[] | __errortab |
| The most common errors. | |
The error numbers used by Etherboot are a superset of those defined by the PXE specification version 2.1. See errno.h for a listing of the error values.
To save space in ROM images, error string tables are optional. Use the ERRORMSG_XXX options in config.h to select which error string tables you want to include. If an error string table is omitted, strerror() will simply return the text "Error 0x<errno>".
Definition in file strerror.c.
| #define ERRFILE 0 |
Definition at line 101 of file strerror.c.
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| static struct errortab* find_error | ( | int | errno | ) | [static, read] |
Find error description.
| errno | Error number |
| errortab | Error description, or NULL |
Definition at line 29 of file strerror.c.
References errortab::errno, ERRORTAB, for_each_table_entry, and NULL.
Referenced by find_closest_error().
00029 { 00030 struct errortab *errortab; 00031 00032 for_each_table_entry ( errortab, ERRORTAB ) { 00033 if ( errortab->errno == errno ) 00034 return errortab; 00035 } 00036 00037 return NULL; 00038 }
| static struct errortab* find_closest_error | ( | int | errno | ) | [static, read] |
Find closest error description.
| errno | Error number |
| errortab | Error description, or NULL |
Definition at line 48 of file strerror.c.
References find_error(), and NULL.
Referenced by strerror().
00048 { 00049 struct errortab *errortab; 00050 00051 /* First, look for an exact match */ 00052 if ( ( errortab = find_error ( errno ) ) != NULL ) 00053 return errortab; 00054 00055 /* Second, try masking off the gPXE-specific bit and seeing if 00056 * we have an entry for the generic POSIX error message. 00057 */ 00058 if ( ( errortab = find_error ( errno & 0x7f0000ff ) ) != NULL ) 00059 return errortab; 00060 00061 return NULL; 00062 }
| const char* strerror | ( | int | errno | ) |
Retrieve string representation of error number.
| errno/rc | Error number or return status code |
| strerror | Pointer to error text |
The pointer returned by strerror() is valid only until the next call to strerror().
Definition at line 77 of file strerror.c.
References find_closest_error(), snprintf(), and errortab::text.
Referenced by aoeboot(), apply_settings(), arbel_alloc_icm(), arbel_close(), arbel_create_cq(), arbel_create_eq(), arbel_create_qp(), arbel_destroy_cq(), arbel_destroy_eq(), arbel_destroy_qp(), arbel_get_limits(), arbel_mad(), arbel_mcast_attach(), arbel_mcast_detach(), arbel_modify_qp(), arbel_open(), arbel_poll_cq(), arbel_probe(), arbel_setup_mpt(), arbel_start_firmware(), arbel_stop_firmware(), ata_command(), ath5k_handle_rx(), ath5k_hw_channel(), ath5k_reset(), ath5k_tx_processq(), bzimage_load(), clear_exec(), comboot_fetch_kernel(), comboot_load_image(), comboot_prepare_bounce_buffer(), comboot_prepare_segment(), config_exec(), create_fakedhcpack(), create_fakedhcpdiscover(), create_fakepxebsack(), dhcp_create_request(), dhcp_exec(), dhcp_proxy_rx(), dhcp_pxebs_rx(), dhcp_request_rx(), dhcp_tx(), dns_resolv(), eapol_key_rx(), efab_init_mac(), efi_snp_initialize(), efi_snp_mcast_ip_to_mac(), efi_snp_receive(), efi_snp_reset(), efi_snp_transmit(), elf_load_segment(), elfboot_load(), eltorito_exec(), eltorito_load_disk(), embedded_init(), ftp_control_close(), ftp_data_closed(), ftp_data_deliver_iob(), ftp_done(), ftp_open(), ftp_xfer_closed(), get_cached_dhcpack(), hermon_alloc_icm(), hermon_close(), hermon_configure_special_qps(), hermon_create_cq(), hermon_create_eq(), hermon_create_qp(), hermon_destroy_cq(), hermon_destroy_eq(), hermon_destroy_qp(), hermon_dump_qpctx(), hermon_get_cap(), hermon_mad(), hermon_map_vpm(), hermon_mcast_attach(), hermon_mcast_detach(), hermon_modify_qp(), hermon_open(), hermon_poll_cq(), hermon_probe(), hermon_sense_port_type(), hermon_setup_mpt(), hermon_start_firmware(), hermon_stop_firmware(), http_open_filter(), http_rx_location(), http_socket_close(), http_socket_deliver_iob(), http_xfer_close(), ib_cm_path_complete(), ib_cm_req_complete(), ib_cm_send_rtu(), ib_cmrc_changed(), ib_cmrc_complete_recv(), ib_cmrc_complete_send(), ib_cmrc_open(), ib_cmrc_xfer_close(), ib_cmrc_xfer_deliver_iob(), ib_create_cq(), ib_create_mi(), ib_create_qp(), ib_mcast_complete(), ib_mcast_join(), ib_mcast_leave(), ib_mi_complete_recv(), ib_mi_send(), ib_modify_qp(), ib_open(), ib_path_complete(), ib_post_recv(), ib_post_send(), ib_refill_recv(), ib_set_pkey_table(), ib_set_port_info(), ib_sma_guid_info(), ib_sma_node_desc(), ib_sma_node_info(), ib_sma_pkey_table(), ib_sma_port_info(), ib_sma_set_pkey_table(), ib_sma_set_port_info(), ib_smc_get_guid_info(), ib_smc_get_pkey_table(), ib_smc_get_port_info(), ib_srp_connect(), ib_srp_parse_root_path(), ib_srpboot(), ibft_fill_nic(), icmp_rx(), iflinkwait(), ifopen(), ifstat(), ifstat_errors(), image_exec(), image_load_type(), imgexec_exec(), imgfetch_core_exec(), imgload_exec(), init_i2c_bit_basher(), init_scsidev(), int13_boot(), int13_extended_rw(), int13_rw_sectors(), ipoib_join_broadcast_group(), ipoib_link_state_changed(), ipoib_open(), ipv4_rx(), ipv4_tx(), iscsi_handle_chap_i_value(), iscsi_handle_chap_r_value(), iscsi_handle_string(), iscsi_open_connection(), iscsi_rx_login_response(), iscsi_socket_close(), iscsi_socket_deliver_raw(), iscsi_tx_step(), iscsiboot(), iwlist(), linda_complete_recv(), linda_init_i2c(), linda_probe(), linda_program_uc_ram(), linda_read_eeprom(), linda_verify_uc_ram(), linebuf_test(), login_exec(), main_loop(), monojob_wait(), multiboot_load_elf(), multiboot_load_raw(), myri10ge_net_open(), myri10ge_pci_probe(), nbi_prepare_segment(), net80211_probe_step(), net80211_step_associate(), netboot(), netdev_rx_err(), netdev_tx_complete_err(), nvo_store(), phantom_create_rx_ctx(), phantom_create_tx_ctx(), phantom_destroy_rx_ctx(), phantom_destroy_tx_ctx(), phantom_fetch_setting(), phantom_issue_cmd(), phantom_probe(), phantom_store_setting(), pxe_deactivate(), pxe_load(), pxe_menu_parse(), pxe_tftp_open(), pxebs_exec(), pxenv_undi_get_mcast_address(), pxenv_undi_open(), pxenv_undi_reset_adapter(), pxenv_undi_transmit(), pxeparent_call(), register_ibdev(), register_netdev(), resolv_mux_try(), rootdev_probe(), sanboot_exec(), script_exec(), scsi_command(), set_exec(), show_exec(), slam_finished(), slam_mc_socket_close(), slam_open(), slam_pull_header(), slam_socket_close(), slam_xfer_close(), smbios_init(), srp_attach(), srp_cmd(), srp_login(), srp_xfer_close(), store_cached_dhcpack(), tcp_rx_data(), tcp_xmit(), tcp_xmit_reset(), test_parse_unparse(), test_resolve(), tftp_core_open(), tftp_done(), tftp_presize(), tftp_reopen(), tftp_reopen_mc(), tftp_rx_data(), tftp_xfer_close(), threewire_detect_address_len(), threewire_read(), threewire_write(), tls_generate_keys(), tls_new_certificate(), tls_new_change_cipher(), tls_send_plaintext(), tls_step(), udp_tx(), undi_load(), uri_test(), wpa_handle_1_of_2(), wpa_handle_3_of_4(), xfer_deliver_iob_meta(), xfer_deliver_raw(), and xfer_vredirect().
00077 { 00078 static char errbuf[64]; 00079 struct errortab *errortab; 00080 00081 /* Allow for strerror(rc) as well as strerror(errno) */ 00082 if ( errno < 0 ) 00083 errno = -errno; 00084 00085 /* Find the error description, if one exists */ 00086 errortab = find_closest_error ( errno ); 00087 00088 /* Construct the error message */ 00089 if ( errortab ) { 00090 snprintf ( errbuf, sizeof ( errbuf ), "%s (%#08x)", 00091 errortab->text, errno ); 00092 } else { 00093 snprintf ( errbuf, sizeof ( errbuf ), "Error %#08x", errno ); 00094 } 00095 00096 return errbuf; 00097 }
| struct errortab common_errors [] __errortab |
Initial value:
{
{ 0, "No error" },
{ EACCES, "Permission denied" },
{ ECANCELED, "Operation cancelled" },
{ ECONNRESET, "Connection reset" },
{ EINVAL, "Invalid argument" },
{ EIO, "Input/output error" },
{ ENETUNREACH, "Network unreachable" },
{ ENODEV, "No such device" },
{ ENOENT, "File not found" },
{ ENOEXEC, "Not an executable image" },
{ ENOMEM, "Out of memory" },
{ ENOSPC, "No space left on device" },
{ ENOTCONN, "Not connected" },
{ ENOTSUP, "Not supported" },
{ EPERM, "Operation not permitted" },
{ ERANGE, "Out of range" },
{ ETIMEDOUT, "Connection timed out" },
}
Definition at line 104 of file strerror.c.
1.5.7.1