iPXE
Defines | Functions | Variables
strerror.c File Reference

Error descriptions. More...

#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <ipxe/errortab.h>
#include <config/branding.h>

Go to the source code of this file.

Defines

#define ERRFILE   0

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static struct errortabfind_error (int errno)
 Find error description.
static struct errortabfind_closest_error (int errno)
 Find closest error description.
char * strerror (int errno)
 Retrieve string representation of error number.

Variables

struct errortab common_errors[] __errortab
 The most common errors.

Detailed Description

Error descriptions.

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 Documentation

#define ERRFILE   0

Definition at line 105 of file strerror.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static struct errortab* find_error ( int  errno) [static, read]

Find error description.

Parameters:
errnoError number
Return values:
errortabError description, or NULL

Definition at line 30 of file strerror.c.

References errortab::errno, ERRORTAB, for_each_table_entry, and NULL.

Referenced by find_closest_error().

                                                  {
        struct errortab *errortab;

        for_each_table_entry ( errortab, ERRORTAB ) {
                if ( errortab->errno == errno )
                        return errortab;
        }

        return NULL;
}
static struct errortab* find_closest_error ( int  errno) [static, read]

Find closest error description.

Parameters:
errnoError number
Return values:
errortabError description, or NULL

Definition at line 49 of file strerror.c.

References find_error(), and NULL.

Referenced by strerror().

                                                          {
        struct errortab *errortab;

        /* First, look for an exact match */
        if ( ( errortab = find_error ( errno ) ) != NULL )
                return errortab;

        /* Second, try masking off the iPXE-specific bit and seeing if
         * we have an entry for the generic POSIX error message.
         */
        if ( ( errortab = find_error ( errno & 0x7f0000ff ) ) != NULL )
                return errortab;

        return NULL;
}
char* strerror ( int  errno)

Retrieve string representation of error number.

Parameters:
errno/rcError number or return status code
Return values:
strerrorPointer to error text

If the error is not found in the linked-in error tables, generates a generic "Error 0x<errno>" message.

The pointer returned by strerror() is valid only until the next call to strerror().

Definition at line 78 of file strerror.c.

References errno, find_closest_error(), PRODUCT_ERROR_URI, snprintf(), and errortab::text.

Referenced by _hunt_mcdi(), abft_install(), acm_control_receive(), acm_control_transmit(), acm_in_complete(), acm_intr_complete(), acm_probe(), acpi_poweroff(), acpi_settings_init(), aoecmd_tx(), aoedev_open(), apply_netdev_settings(), apply_settings(), apply_syslog_settings(), apply_syslogs_settings(), arbel_alloc_icm(), arbel_configure_special_qps(), arbel_create_cq(), arbel_create_eq(), arbel_create_qp(), arbel_destroy_cq(), arbel_destroy_eq(), arbel_destroy_qp(), arbel_dump_cqctx(), arbel_dump_qpctx(), arbel_get_limits(), arbel_ib_close(), arbel_ib_open(), arbel_mad(), arbel_map_vpm(), arbel_mcast_attach(), arbel_mcast_detach(), arbel_modify_qp(), arbel_poll_cq(), arbel_probe(), arbel_setup_mpt(), arbel_start(), arbel_start_firmware(), arbel_stop_firmware(), arp_rx(), arp_tx_request(), atacmd_close(), atadev_command(), ath5k_handle_rx(), ath5k_hw_channel(), ath5k_reset(), ath5k_tx_processq(), axge_check_link(), axge_in_complete(), axge_intr_complete(), axge_open(), axge_probe(), bios_poweroff(), blktrans_deliver(), bofm_en(), bofm_probe(), bofm_test_init(), builtin_init(), bzimage_check_initrds(), bzimage_exec(), cachedhcp_probe(), cert_exec(), certstore_apply_settings(), certstore_init(), chained_locate(), choose_exec(), cmdline_init(), cms_parse_certificates(), cms_parse_digest_algorithm(), cms_parse_signature_algorithm(), cms_parse_signer_identifier(), cms_verify_digest(), cms_verify_signer_info(), colour_exec(), com32_load_image(), com32_prepare_bounce_buffer(), comboot_fetch_kernel(), comboot_prepare_segment(), config_exec(), console_exec(), cpair_exec(), cpuid_settings_fetch(), cpuid_settings_init(), create_fakedhcpack(), create_fakedhcpdiscover(), create_fakepxebsack(), create_pinger(), dbg_efi_openers(), dbg_efi_protocols(), der_probe(), dhcp_create_request(), dhcp_proxy_rx(), dhcp_pxebs_rx(), dhcp_request_rx(), dhcp_tx(), dhcpv6_rx(), dhcpv6_tx(), dm96xx_check_link(), dm96xx_in_complete(), dm96xx_intr_complete(), dm96xx_open(), dm96xx_probe(), dm96xx_read_mac(), dm96xx_reset(), dm96xx_rx_mode(), dm96xx_write_mac(), dns_resolv(), dns_xfer_deliver(), downloader_finished(), drbg_generate(), drbg_instantiate(), drbg_reseed(), dummy_san_hook(), eapol_key_rx(), ecm_fetch_mac(), ecm_in_complete(), ecm_intr_complete(), ecm_open(), ecm_probe(), efab_init_mac(), efi_block_boot(), efi_block_boot_image(), efi_block_connect(), efi_block_describe(), efi_block_hook(), efi_block_install(), efi_block_rw(), efi_bofm_start(), efi_bofm_supported(), efi_child_add(), efi_download_install(), efi_driver_connect(), efi_driver_handles(), efi_driver_install(), efi_driver_start(), efi_entropy_enable(), efi_entropy_tick(), efi_file_install(), efi_file_uninstall(), efi_get_noise_rng(), efi_get_time(), efi_getchar(), efi_image_exec(), efi_image_probe(), efi_init(), efi_local_check_volume_name(), efi_local_len(), efi_local_open_resolved(), efi_local_open_root(), efi_local_open_volume(), efi_local_step(), efi_locate_device(), efi_pci_info(), efi_pxe_dhcp(), efi_pxe_fake(), efi_pxe_install(), efi_pxe_mtftp(), efi_pxe_tftp_open(), efi_pxe_udp_open(), efi_pxe_udp_write(), efi_snp_hii_fetch(), efi_snp_hii_install(), efi_snp_hii_store(), efi_snp_initialize(), efi_snp_mcast_ip_to_mac(), efi_snp_probe(), efi_snp_receive(), efi_snp_reset(), efi_snp_transmit(), efi_tick_shutdown(), efi_tick_startup(), efi_udelay(), efi_urealloc(), efi_usb_async_start(), efi_usb_control_transfer(), efi_usb_get_string_descriptor(), efi_usb_install(), efi_usb_open(), efi_usb_probe(), efi_usb_sync_transfer(), efi_watchdog_expired(), efi_wrap(), efifb_glyphs(), efifb_init(), efifb_restore(), efifb_select_mode(), efipci_open(), efipci_read(), efipci_root(), efipci_start(), efipci_write(), ehci_device_address(), ehci_endpoint_close(), ehci_endpoint_poll(), elf_load_segment(), elfboot_exec(), embedded_init(), eoib_duplicate(), eoib_join_broadcast_group(), eoib_link_state_changed(), eoib_open(), exanic_fetch_mac(), exanic_poll_rx(), fc_els_close(), fc_els_flogi_rx(), fc_els_plogi_rx(), fc_els_prli_rx(), fc_els_rx(), fc_els_step(), fc_els_tx(), fc_ns_query_step(), fc_peer_close(), fc_peer_examine(), fc_peer_logout(), fc_peer_plogi(), fc_port_examine(), fc_port_login(), fc_port_logout(), fc_port_ns_plogi_done(), fc_ulp_close(), fc_ulp_examine(), fc_ulp_logout(), fc_xchg_close(), fc_xchg_respond(), fc_xchg_rx(), fc_xchg_tx(), fcels(), fcoe_deliver(), fcoe_expired(), fcoe_fip_rx_els_response(), fcoe_fip_rx_vlan(), fcoe_fip_tx_keepalive(), fcoe_fip_tx_solicitation(), fcoe_fip_tx_vlan(), fcoe_rx(), fcpcmd_close(), fcpcmd_send_cmnd(), fcpcmd_send_wrdata(), fcpdev_close(), fcpdev_examine(), fcpdev_open(), fcpdev_scsi_command(), fcpeerstat(), fcportstat(), flexboot_nodnic_eth_close(), flexboot_nodnic_eth_transmit(), flexboot_nodnic_poll_cq(), flexboot_nodnic_register_netdev(), ftp_data_closed(), ftp_done(), ftp_open(), goto_exec(), guestinfo_fetch_type(), guestinfo_init(), guestinfo_net_probe(), hermon_bofm_harvest(), hermon_bofm_probe(), hermon_bofm_update(), hermon_configure_special_qps(), hermon_create_cq(), hermon_create_eq(), hermon_create_qp(), hermon_destroy_cq(), hermon_destroy_eq(), hermon_destroy_qp(), hermon_dump_cqctx(), hermon_dump_qpctx(), hermon_eth_close(), hermon_eth_open(), hermon_eth_transmit(), hermon_get_cap(), hermon_ib_close(), hermon_ib_open(), hermon_mad(), hermon_map_icm(), hermon_map_vpm(), hermon_mcast_attach(), hermon_mcast_detach(), hermon_modify_qp(), hermon_poll_cq(), hermon_register_ibdev(), hermon_register_netdev(), hermon_sense_port_type(), hermon_set_port_type(), hermon_setup_mpt(), hermon_start(), hermon_start_firmware(), hermon_stop_firmware(), http_block_read(), http_block_read_capacity(), http_conn_close(), http_connect(), http_open(), http_parse_ntlm_auth(), http_parse_www_authenticate(), http_redirect(), http_reopen(), http_rx_headers(), http_rx_linebuf(), http_transfer_complete(), http_tx_request(), hub_clear_changes(), hub_clear_tt(), hub_complete(), hub_disable(), hub_enable(), hub_open(), hub_probe(), hub_refill(), hub_speed(), hunt_open(), hv_post_message(), hv_signal_event(), hv_unquiesce(), hvm_ioremap(), hvm_iounmap(), hvm_map_grant(), hvm_map_hypercall(), hvm_map_xenstore(), hvm_probe(), ib_cm_path_complete(), ib_cm_req_complete(), ib_cm_send_drep(), ib_cm_send_rtu(), ib_cmrc_changed(), ib_cmrc_complete_recv(), ib_cmrc_complete_send(), ib_cmrc_open(), ib_cmrc_xfer_deliver(), 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_sbft_install(), 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_node_info(), ib_smc_get_pkey_table(), ib_smc_get_port_info(), ib_srp_open(), ib_srp_parse_root_path(), ibft_fill_nic(), ibft_install(), icmpv6_rx(), icplus_init_phy(), icplus_probe(), ifconf(), ifopen(), ifstat(), ifstat_errors(), image_asn1(), image_exec(), image_pixbuf(), image_probe(), image_replace(), imgdownload(), imgsingle_exec(), imgtrust_exec(), imgverify(), imgverify_exec(), inc_exec(), init_i2c_bit_basher(), initrd_init(), int13_boot(), int13_cdrom_read_boot_catalog(), int13_describe(), int13_device_path_info(), int13_extended_rw(), int13_get_extended_parameters(), int13_guess_geometry_hdd(), int13_hook(), int13_parse_eltorito(), int13_rw_sectors(), int13con_find(), intel_fetch_mac_eeprom(), intelvf_mbox_reset(), intelvf_mbox_set_mac(), intelvf_mbox_set_mtu(), intelxvf_mbox_queues(), intelxvf_mbox_version(), intelxvf_open(), intelxvf_probe(), intf_close(), intf_shutdown(), ipoib_join_broadcast_group(), ipoib_link_state_changed(), ipoib_open(), ipoib_translate_rx_arp(), ipoib_transmit(), ipv4_gratuitous_arp(), ipv4_rx(), ipv4_tx(), ipv6_create_routes(), ipv6_rx(), ipv6_tx(), ipv6conf_rx_router_advertisement(), iscsi_close(), iscsi_handle_chap_c_value(), iscsi_handle_chap_i_value(), iscsi_handle_chap_r_value(), iscsi_handle_string(), iscsi_open(), iscsi_open_connection(), iscsi_rx_login_response(), iscsi_rx_scsi_response(), iscsi_socket_deliver(), iscsi_tx_step(), iwlist(), lan78xx_open(), lan78xx_probe(), linda_complete_recv(), linda_init_i2c(), linda_probe(), linda_program_uc_ram(), linda_read_eeprom(), linda_verify_uc_ram(), linebuf_consume_okx(), login_exec(), loopback_test(), lotest_exec(), main_loop(), memmap_settings_init(), mii_reset(), mii_restart(), monojob_wait(), multiboot_add_modules(), multiboot_load_elf(), multiboot_load_raw(), myri10ge_net_open(), myri10ge_pci_probe(), named_resolv_done(), natsemi_hwaddr(), nbi_prepare_segment(), ncm_in_complete(), ncm_intr_complete(), ncm_open(), ncm_probe(), ndp_rx_neighbour_advertisement_ll_target(), ndp_rx_neighbour_solicitation_ll_source(), ndp_rx_router_advertisement_ll_source(), ndp_tx_ll_addr(), neighbour_destroy(), neighbour_discovered(), neighbour_expired(), net80211_probe_step(), net80211_step_associate(), netboot(), netdev_config_close(), netdev_configure(), netdev_link_err(), netdev_redirect_settings_init(), netdev_rx_err(), netdev_tx_err(), netfront_close(), netfront_create_event(), netfront_create_ring(), netfront_open(), netfront_poll_rx(), netfront_poll_tx(), netfront_probe(), netfront_push(), netfront_read_mac(), netfront_reset(), netfront_rm(), netfront_send_event(), netfront_write_num(), netvsc_control(), netvsc_create_buffer(), netvsc_destroy_buffer(), netvsc_establish_buffer(), netvsc_initialise(), netvsc_ndis_version(), netvsc_open(), netvsc_probe(), netvsc_recv_data(), netvsc_reset(), netvsc_revoke_buffer(), netvsc_transmit(), nfs_done(), nii_get_init_info(), nii_get_station_address(), nii_initialise_flags(), nii_io(), nii_map(), nii_open(), nii_pci_open(), nii_poll(), nii_poll_rx(), nii_set_rx_filters(), nii_set_station_address(), nii_shutdown(), nii_start(), nii_start_undi(), nii_stop_undi(), nii_transmit(), nslookup(), ntp_exec(), ntp_request(), nvo_load(), nvo_realloc_dhcpopt(), nvo_save(), nvo_store(), nvs_vpd_init(), nvs_vpd_read(), nvs_vpd_resize(), nvs_vpd_write(), ocsp_check_signature(), ocsp_parse_basic_response(), ocsp_parse_certs(), ocsp_parse_response_status(), ocsp_parse_responses(), ocsp_request(), ocsp_validate(), pci_probe(), pci_settings_init(), pciscan_exec(), peerblk_decrypt(), peerblk_deliver(), peerblk_done(), peerblk_parse_header(), peerblk_raw_open(), peerblk_retrieval_open(), peerblk_retrieval_rx(), peerdisc_socket_open(), peerdisc_socket_rx(), peerdisc_socket_tx(), peerdist_info(), peerdist_info_v1(), peerdist_info_v1_block(), peerdist_info_v1_block_offset(), peerdist_info_v1_segment(), peerdist_info_v2(), peerdist_info_v2_segment(), peerdist_info_v2_segments(), peermux_info_close(), peermux_step(), pem_asn1(), pem_image_asn1(), pem_image_probe(), 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(), ping(), ping_callback(), ping_deliver(), ping_open(), pinger_expired(), png_image_data(), poweroff_exec(), pxe_deactivate(), pxe_exec(), pxe_fake_cached_info(), pxe_menu_parse(), pxe_tftp_open(), pxebs_exec(), pxenv_udp_open(), pxenv_udp_write(), pxenv_undi_get_mcast_address(), pxenv_undi_open(), pxenv_undi_reset_adapter(), pxenv_undi_transmit(), qib7322_ahb_request(), qib7322_complete_recv(), qib7322_init_i2c(), qib7322_probe(), qib7322_read_eeprom(), rbg_startup(), rdtsc_probe(), realtek_init_eeprom(), realtek_phy_reset(), realtek_phy_speed(), realtek_probe(), register_ibdev(), register_netdev(), register_rndis(), register_usb(), register_usb_hub(), resmux_try(), rhine_probe(), rndis_filter(), rndis_open(), rndis_tx_message(), rootdev_probe(), rsa_encrypt(), sandev_command_read_capacity(), sandev_command_rw(), sandev_describe(), sandev_parse_iso9660(), sandev_reopen(), sanpath_block_close(), sanpath_open(), scsicmd_close(), scsicmd_command(), scsidev_ready(), serial_init(), set_core_exec(), show_exec(), slam_finished(), slam_open(), slam_pull_header(), smbios_init(), smsc75xx_dump_statistics(), smsc75xx_in_complete(), smsc75xx_open(), smsc75xx_probe(), smsc95xx_dump_statistics(), smsc95xx_in_complete(), smsc95xx_open(), smsc95xx_probe(), smsc95xx_reset(), smsc95xx_vm3_fetch_mac(), smscusb_get_statistics(), smscusb_intr_complete(), smscusb_mii_check_link(), smscusb_mii_open(), smscusb_raw_readl(), smscusb_raw_writel(), snpnet_close(), snpnet_open(), snpnet_poll_rx(), snpnet_poll_tx(), snpnet_rx_filters(), snpnet_start(), snpnet_stop(), snpnet_transmit(), srp_cmd(), srp_login(), srp_open(), srpcmd_close(), srpdev_close(), srpdev_deliver(), start_dhcpv6(), start_ntp(), sync_exec(), syslog_putchar(), syslogs_close(), syslogs_putchar(), tcp_open(), tcp_rx_data(), tcp_xmit_reset(), tcp_xmit_sack(), test_init(), tftp_core_open(), tftp_done(), tftp_presize(), tftp_reopen(), tftp_reopen_mc(), tftp_rx_data(), tg3_get_invariants(), tg3_open(), threewire_detect_address_len(), threewire_read(), threewire_write(), timer_probe(), tls_generate_keys(), tls_generate_random(), tls_new_change_cipher(), tls_new_record(), tls_new_server_hello_done(), tls_parse_chain(), tls_send_certificate_verify(), tls_send_client_key_exchange(), tls_send_plaintext(), tls_tx_step(), tls_validator_done(), txnic_bgx_mac(), udp_open_common(), udp_tx(), uhci_device_address(), undi_load(), undinet_call(), undinet_transmit(), unhide_etherboot(), uriboot(), usb_autoconfigure(), usb_complete_err(), usb_config_descriptor(), usb_control(), usb_endpoint_clear_tt(), usb_endpoint_mtu(), usb_endpoint_open(), usb_endpoint_reset(), usb_get_default_language(), usb_hotplugged(), usb_message(), usb_probe(), usb_stream(), usbhid_describe(), usbhid_open(), usbio_bulk_in_poll(), usbio_bulk_out_poll(), usbio_config(), usbio_control_poll(), usbio_interfaces(), usbio_interrupt_open(), usbio_open(), usbio_path(), usbio_start(), usbio_supported(), usbkbd_complete(), usbkbd_probe(), usbkbd_set_leds(), usbnet_open(), validator_append(), validator_ocsp_validate(), validator_start_download(), validator_start_ocsp(), validator_xfer_close(), validator_xfer_deliver(), vcreate_exec(), vdestroy_exec(), velocity_probe(), vesafb_mode_info(), vesafb_mode_list(), vesafb_set_mode(), vlan_create(), vlan_rx(), vlan_transmit(), vmbus_close(), vmbus_poll(), vmbus_post_message(), vmbus_probe_channels(), vmbus_reset_channels(), vmbus_signal_event(), vmbus_wait_for_any_message(), vmbus_xfer_page_iobufs(), vmconsole_init(), vmconsole_putchar(), vmxnet3_probe(), wpa_handle_1_of_2(), wpa_handle_3_of_4(), x509_check_ipaddress(), x509_check_signature(), x509_parse(), x509_parse_basic_constraints(), x509_parse_extension(), x509_parse_issuer(), x509_parse_key_usage(), x509_parse_public_key(), x509_parse_serial(), x509_parse_subject_alt_name(), x509_parse_tbscertificate(), x509_parse_validity(), x509_parse_version(), xcm_close(), xcm_list(), xcm_reopen(), xcm_step(), xenbus_backend_state(), xenbus_backend_wait(), xenbus_probe(), xenbus_probe_device(), xenbus_probe_type(), xenbus_set_state(), xengrant_init(), xenstore_request(), xfer_deliver(), xfer_open_uri(), xfer_vredirect(), xferbuf_ensure_size(), xhci_command(), xhci_complete(), xhci_disable_slot(), xhci_enable_slot(), xhci_host_controller(), xhci_reset_endpoint(), xhci_set_tr_dequeue_pointer(), xhci_stop_endpoint(), xhci_transfer(), xsigo_ib_open(), xsigo_xcm_complete(), xsigo_xds_complete(), xsmp_tx_session(), xsmp_tx_xve(), xve_create(), and xve_open().

                              {
        static char errbuf[64];
        struct errortab *errortab;

        /* Allow for strerror(rc) as well as strerror(errno) */
        if ( errno < 0 )
                errno = -errno;

        /* Find the error description, if one exists */
        errortab = find_closest_error ( errno );

        /* Construct the error message */
        if ( errortab ) {
                snprintf ( errbuf, sizeof ( errbuf ),
                           "%s (" PRODUCT_ERROR_URI ")",
                           errortab->text, errno );
        } else {
                snprintf ( errbuf, sizeof ( errbuf ),
                           "Error %#08x (" PRODUCT_ERROR_URI ")",
                           errno, errno );
        }

        return errbuf;
}

Variable Documentation

struct errortab common_errors [] __errortab