diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-11 21:44:59 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-11 21:44:59 +0200 |
| commit | 49635f99dfa20f1cf17a53b24328871e05cc0757 (patch) | |
| tree | e2a4a405248e8fe1d625c9daa12355b56ac6391b /libs | |
| parent | 8f2b785f5e19f0c856edea46ad0b4c625365f177 (diff) | |
| download | kernel-49635f99dfa20f1cf17a53b24328871e05cc0757.tar.xz kernel-49635f99dfa20f1cf17a53b24328871e05cc0757.zip | |
kstd: only support official POSIX error codes
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/kstd/kstd/system_error.hpp | 497 |
1 files changed, 178 insertions, 319 deletions
diff --git a/libs/kstd/kstd/system_error.hpp b/libs/kstd/kstd/system_error.hpp index df378b5d..5cc16e74 100644 --- a/libs/kstd/kstd/system_error.hpp +++ b/libs/kstd/kstd/system_error.hpp @@ -214,129 +214,82 @@ namespace kstd enum struct errc : std::uint32_t { - success = 0, - operation_not_permitted, - no_such_file_or_directory, - no_such_process, - interrupted, - io_error, - no_such_device_or_address, + success, + address_family_not_supported, + address_in_use, + address_not_available, + already_connected, argument_list_too_long, - executable_format_error, - bad_file_descriptor, - no_child_process, - resource_unavailable_try_again, - not_enough_memory, - permission_denied, + argument_out_of_domain, bad_address, - not_a_block_device, + bad_file_descriptor, + bad_message, + broken_pipe, + connection_aborted, + connection_already_in_progress, + connection_refused, + connection_reset, + cross_device_link, + destination_address_required, device_or_resource_busy, + directory_not_empty, + executable_format_error, file_exists, - cross_device_link, - no_such_device, - not_a_directory, - is_a_directory, - invalid_argument, - too_many_files_open_in_system, - too_many_files_open, - inappropriate_io_control_operation, - text_file_busy, file_too_large, - no_space_on_device, - invalid_seek, - read_only_file_system, - too_many_links, - broken_pipe, - argument_out_of_range, - result_out_of_range, - resource_deadlock_would_occur, - file_name_too_long, - no_lock_available, + filename_too_long, function_not_supported, - directory_not_empty, - too_many_symbolic_link_levels, - no_message = 42, + host_unreachable, identifier_removed, - channel_number_out_of_range, - level_2_not_synchronized, - level_3_halted, - level_3_reset, - link_number_out_of_range, - protocol_driver_not_attached, - no_csi_structure_available, - level_2_halted, - invalid_exchange, - invalid_request_descriptor, - exchange_full, - no_anode, - invalid_request_code, - invalid_slot, - bad_font_file_format = 59, - machine_is_not_on_the_network = 64, - package_not_installed, - object_is_remote, - no_link, - advertise_error, - srmount_error, - communication_error_on_send, - protocol_error, - multihop_attempt, - bad_message = 74, - value_too_large, - name_not_unique_on_network, - file_descriptor_in_bad_state, - remote_address_changed, - shared_library_inaccessible, - shared_library_corrupted, - too_many_shared_libraries, - cannot_execute_shared_library = 83, illegal_byte_sequence, - interrupted_try_again, - too_many_users = 87, - not_a_socket, - destination_address_required, + inappropriate_io_control_operation, + interrupted, + invalid_argument, + invalid_seek, + io_error, + is_a_directory, message_size, - wrong_protocol_type, - no_protocol_option, - protocol_not_supported, - socket_type_not_supported, - operation_not_supported, - protocol_family_not_supported, - address_family_not_supported, - address_in_use, - address_not_available, network_down, - network_unreachable, network_reset, - connection_aborted, - connection_reset, + network_unreachable, no_buffer_space, - already_connected, + no_child_process, + no_link, + no_lock_available, + no_message, + no_protocol_option, + no_space_on_device, + no_such_device, + no_such_device_or_address, + no_such_file_or_directory, + no_such_process, + not_a_directory, + not_a_socket, not_connected, - connection_shut_down, - too_many_references, - timed_out, - connection_refused, - host_is_down, - host_unreachable, - connection_already_in_progress, - operation_in_progress, - stale_file_handle, - structure_needs_cleaning, - remote_io_error = 121, - disk_quota_exceeded, - no_medium_found, - wrong_medium_type, + not_enough_memory, + not_supported, operation_canceled, - required_key_not_available, - key_expired, - key_revoked, - key_rejected, + operation_in_progress, + operation_not_permitted, + operation_not_supported, + operation_would_block, owner_dead, + permission_denied, + protocol_error, + protocol_not_supported, + read_only_file_system, + resource_deadlock_would_occur, + resource_unavailable_try_again, + result_out_of_range, + socket_type_not_supported, state_not_recoverable, - rf_kill, - memory_page_hardware_error, - not_supported, + text_file_busy, + timed_out, + too_many_files_open, + too_many_files_open_in_system, + too_many_links, + too_many_symbolic_link_levels, + value_too_large, + wrong_protocol_type, }; template<> @@ -359,128 +312,81 @@ namespace kstd { // clang-format off case errc::success: return "success"; - case errc::operation_not_permitted: return "operation not permitted"; - case errc::no_such_file_or_directory: return "no such file or directory"; - case errc::no_such_process: return "no such process"; - case errc::interrupted: return "system call interrupted"; - case errc::io_error: return "input/output error"; - case errc::no_such_device_or_address: return "no such device or address"; + case errc::address_family_not_supported: return "address family not supported"; + case errc::address_in_use: return "address in use"; + case errc::address_not_available: return "address not available"; + case errc::already_connected: return "already connected"; case errc::argument_list_too_long: return "argument list too long"; - case errc::executable_format_error: return "invalid executable format"; - case errc::bad_file_descriptor: return "bad file descriptor"; - case errc::no_child_process: return "no child process"; - case errc::resource_unavailable_try_again: return "resource unavailable, try again"; - case errc::not_enough_memory: return "not enough memory"; - case errc::permission_denied: return "permission denied"; + case errc::argument_out_of_domain: return "argument out of domain"; case errc::bad_address: return "bad address"; - case errc::not_a_block_device: return "not a block device"; + case errc::bad_file_descriptor: return "bad file descriptor"; + case errc::bad_message: return "bad message"; + case errc::broken_pipe: return "broken pipe"; + case errc::connection_aborted: return "connection aborted"; + case errc::connection_already_in_progress: return "connection already in progress"; + case errc::connection_refused: return "connection refused"; + case errc::connection_reset: return "connection reset"; + case errc::cross_device_link: return "cross device link"; + case errc::destination_address_required: return "destination address required"; case errc::device_or_resource_busy: return "device or resource busy"; + case errc::directory_not_empty: return "directory not empty"; + case errc::executable_format_error: return "invalid executable format"; case errc::file_exists: return "file exists"; - case errc::cross_device_link: return "cross device link"; - case errc::no_such_device: return "no such device"; - case errc::not_a_directory: return "not a directory"; - case errc::is_a_directory: return "is a directory"; - case errc::invalid_argument: return "invalid argument"; - case errc::too_many_files_open_in_system: return "too many files open in system"; - case errc::too_many_files_open: return "too many files open"; - case errc::inappropriate_io_control_operation: return "inappropriate io control operation"; - case errc::text_file_busy: return "text file busy"; case errc::file_too_large: return "file too large"; - case errc::no_space_on_device: return "no space on device"; - case errc::invalid_seek: return "invalid seek"; - case errc::read_only_file_system: return "read only file system"; - case errc::too_many_links: return "too many links"; - case errc::broken_pipe: return "broken pipe"; - case errc::argument_out_of_range: return "argument out of range"; - case errc::result_out_of_range: return "result out of range"; - case errc::resource_deadlock_would_occur: return "resource deadlock would occur"; - case errc::file_name_too_long: return "file name too long"; - case errc::no_lock_available: return "no lock available"; + case errc::filename_too_long: return "filename too long"; case errc::function_not_supported: return "function not supported"; - case errc::directory_not_empty: return "directory not empty"; - case errc::too_many_symbolic_link_levels: return "too many symbolic link levels"; - case errc::no_message: return "no message"; + case errc::host_unreachable: return "host unreachable"; case errc::identifier_removed: return "identifier removed"; - case errc::channel_number_out_of_range: return "channel number out of range"; - case errc::level_2_not_synchronized: return "level 2 not synchronized"; - case errc::level_3_halted: return "level 3 halted"; - case errc::level_3_reset: return "level 3 reset"; - case errc::link_number_out_of_range: return "link number out of range"; - case errc::protocol_driver_not_attached: return "protocol driver not attached"; - case errc::no_csi_structure_available: return "no csi structure available"; - case errc::level_2_halted: return "level 2 halted"; - case errc::invalid_exchange: return "invalid exchange"; - case errc::invalid_request_descriptor: return "invalid request descriptor"; - case errc::exchange_full: return "exchange full"; - case errc::no_anode: return "no anode"; - case errc::invalid_request_code: return "invalid request code"; - case errc::invalid_slot: return "invalid slot"; - case errc::bad_font_file_format: return "bad font file format"; - case errc::machine_is_not_on_the_network: return "machine is not on the network"; - case errc::package_not_installed: return "package not installed"; - case errc::object_is_remote: return "object is remote"; - case errc::no_link: return "no link"; - case errc::advertise_error: return "advertisement error"; - case errc::srmount_error: return "srmount error"; - case errc::communication_error_on_send: return "communication error on send"; - case errc::protocol_error: return "protocol error"; - case errc::multihop_attempt: return "multihop attempt"; - case errc::bad_message: return "bad message"; - case errc::value_too_large: return "value too large"; - case errc::name_not_unique_on_network: return "name not unique on network"; - case errc::file_descriptor_in_bad_state: return "file descriptor in bad state"; - case errc::remote_address_changed: return "remote address changed"; - case errc::shared_library_inaccessible: return "failed to access shared library"; - case errc::shared_library_corrupted: return "shared library corrupted"; - case errc::too_many_shared_libraries: return "attempted to load too many shared libraries"; - case errc::cannot_execute_shared_library: return "cannot execute shared library"; case errc::illegal_byte_sequence: return "illegal byte sequence"; - case errc::interrupted_try_again: return "system call interrupted, try again"; - case errc::too_many_users: return "too many logged in users"; - case errc::not_a_socket: return "not a socket"; - case errc::destination_address_required: return "destination address required"; + case errc::inappropriate_io_control_operation: return "inappropriate io control operation"; + case errc::interrupted: return "system call interrupted"; + case errc::invalid_argument: return "invalid argument"; + case errc::invalid_seek: return "invalid seek"; + case errc::io_error: return "input/output error"; + case errc::is_a_directory: return "is a directory"; case errc::message_size: return "message size"; - case errc::wrong_protocol_type: return "wrong protocol type"; - case errc::no_protocol_option: return "no protocol option"; - case errc::protocol_not_supported: return "protocol not supported"; - case errc::socket_type_not_supported: return "socket type not supported"; - case errc::operation_not_supported: return "operation not supported"; - case errc::protocol_family_not_supported: return "protocol family not supported"; - case errc::address_family_not_supported: return "address family not supported"; - case errc::address_in_use: return "address in use"; - case errc::address_not_available: return "address not available"; case errc::network_down: return "network down"; - case errc::network_unreachable: return "network unreachable"; case errc::network_reset: return "network reset"; - case errc::connection_aborted: return "connection aborted"; - case errc::connection_reset: return "connection reset"; + case errc::network_unreachable: return "network unreachable"; case errc::no_buffer_space: return "no buffer space"; - case errc::already_connected: return "already connected"; + case errc::no_child_process: return "no child process"; + case errc::no_link: return "no link"; + case errc::no_lock_available: return "no lock available"; + case errc::no_message: return "no message"; + case errc::no_protocol_option: return "no protocol option"; + case errc::no_space_on_device: return "no space on device"; + case errc::no_such_device: return "no such device"; + case errc::no_such_device_or_address: return "no such device or address"; + case errc::no_such_file_or_directory: return "no such file or directory"; + case errc::no_such_process: return "no such process"; + case errc::not_a_directory: return "not a directory"; + case errc::not_a_socket: return "not a socket"; case errc::not_connected: return "not connected"; - case errc::connection_shut_down: return "connection shut down"; - case errc::too_many_references: return "too many references"; - case errc::timed_out: return "timed out"; - case errc::connection_refused: return "connection refused"; - case errc::host_is_down: return "host is down"; - case errc::host_unreachable: return "host unreachable"; - case errc::connection_already_in_progress: return "connection already in progress"; - case errc::operation_in_progress: return "operation in progress"; - case errc::stale_file_handle: return "stale file handle"; - case errc::structure_needs_cleaning: return "structure needs cleaning"; - case errc::remote_io_error: return "remote input/output error"; - case errc::disk_quota_exceeded: return "disk quota exceeded"; - case errc::no_medium_found: return "no medium found"; - case errc::wrong_medium_type: return "wrong medium type"; + case errc::not_enough_memory: return "not enough memory"; + case errc::not_supported: return "not supported"; case errc::operation_canceled: return "operation canceled"; - case errc::required_key_not_available: return "required key not available"; - case errc::key_expired: return "key expired"; - case errc::key_revoked: return "key revoked"; - case errc::key_rejected: return "key rejected"; + case errc::operation_in_progress: return "operation in progress"; + case errc::operation_not_permitted: return "operation not permitted"; + case errc::operation_not_supported: return "operation not supported"; + case errc::operation_would_block: return "operation would block"; case errc::owner_dead: return "owner dead"; + case errc::permission_denied: return "permission denied"; + case errc::protocol_error: return "protocol error"; + case errc::protocol_not_supported: return "protocol not supported"; + case errc::read_only_file_system: return "read only file system"; + case errc::resource_deadlock_would_occur: return "resource deadlock would occur"; + case errc::resource_unavailable_try_again: return "resource unavailable, try again"; + case errc::result_out_of_range: return "result out of range"; + case errc::socket_type_not_supported: return "socket type not supported"; case errc::state_not_recoverable: return "state not recoverable"; - case errc::rf_kill: return "operation not possible due to RFkill"; - case errc::memory_page_hardware_error: return "memory page hardware error"; - case errc::not_supported: return "not supported"; + case errc::text_file_busy: return "text file busy"; + case errc::timed_out: return "timed out"; + case errc::too_many_files_open: return "too many files open"; + case errc::too_many_files_open_in_system: return "too many files open in system"; + case errc::too_many_links: return "too many links"; + case errc::too_many_symbolic_link_levels: return "too many symbolic link levels"; + case errc::value_too_large: return "value too large"; + case errc::wrong_protocol_type: return "wrong protocol type"; default: return "unknown system error"; // clang-format on } @@ -500,128 +406,81 @@ namespace kstd { // clang-format off case errc::success: return "success"; - case errc::operation_not_permitted: return "operation not permitted"; - case errc::no_such_file_or_directory: return "no such file or directory"; - case errc::no_such_process: return "no such process"; - case errc::interrupted: return "system call interrupted"; - case errc::io_error: return "input/output error"; - case errc::no_such_device_or_address: return "no such device or address"; + case errc::address_family_not_supported: return "address family not supported"; + case errc::address_in_use: return "address in use"; + case errc::address_not_available: return "address not available"; + case errc::already_connected: return "already connected"; case errc::argument_list_too_long: return "argument list too long"; - case errc::executable_format_error: return "invalid executable format"; - case errc::bad_file_descriptor: return "bad file descriptor"; - case errc::no_child_process: return "no child process"; - case errc::resource_unavailable_try_again: return "resource unavailable, try again"; - case errc::not_enough_memory: return "not enough memory"; - case errc::permission_denied: return "permission denied"; + case errc::argument_out_of_domain: return "argument out of domain"; case errc::bad_address: return "bad address"; - case errc::not_a_block_device: return "not a block device"; + case errc::bad_file_descriptor: return "bad file descriptor"; + case errc::bad_message: return "bad message"; + case errc::broken_pipe: return "broken pipe"; + case errc::connection_aborted: return "connection aborted"; + case errc::connection_already_in_progress: return "connection already in progress"; + case errc::connection_refused: return "connection refused"; + case errc::connection_reset: return "connection reset"; + case errc::cross_device_link: return "cross device link"; + case errc::destination_address_required: return "destination address required"; case errc::device_or_resource_busy: return "device or resource busy"; + case errc::directory_not_empty: return "directory not empty"; + case errc::executable_format_error: return "invalid executable format"; case errc::file_exists: return "file exists"; - case errc::cross_device_link: return "cross device link"; - case errc::no_such_device: return "no such device"; - case errc::not_a_directory: return "not a directory"; - case errc::is_a_directory: return "is a directory"; - case errc::invalid_argument: return "invalid argument"; - case errc::too_many_files_open_in_system: return "too many files open in system"; - case errc::too_many_files_open: return "too many files open"; - case errc::inappropriate_io_control_operation: return "inappropriate io control operation"; - case errc::text_file_busy: return "text file busy"; case errc::file_too_large: return "file too large"; - case errc::no_space_on_device: return "no space on device"; - case errc::invalid_seek: return "invalid seek"; - case errc::read_only_file_system: return "read only file system"; - case errc::too_many_links: return "too many links"; - case errc::broken_pipe: return "broken pipe"; - case errc::argument_out_of_range: return "argument out of range"; - case errc::result_out_of_range: return "result out of range"; - case errc::resource_deadlock_would_occur: return "resource deadlock would occur"; - case errc::file_name_too_long: return "file name too long"; - case errc::no_lock_available: return "no lock available"; + case errc::filename_too_long: return "filename too long"; case errc::function_not_supported: return "function not supported"; - case errc::directory_not_empty: return "directory not empty"; - case errc::too_many_symbolic_link_levels: return "too many symbolic link levels"; - case errc::no_message: return "no message"; + case errc::host_unreachable: return "host unreachable"; case errc::identifier_removed: return "identifier removed"; - case errc::channel_number_out_of_range: return "channel number out of range"; - case errc::level_2_not_synchronized: return "level 2 not synchronized"; - case errc::level_3_halted: return "level 3 halted"; - case errc::level_3_reset: return "level 3 reset"; - case errc::link_number_out_of_range: return "link number out of range"; - case errc::protocol_driver_not_attached: return "protocol driver not attached"; - case errc::no_csi_structure_available: return "no csi structure available"; - case errc::level_2_halted: return "level 2 halted"; - case errc::invalid_exchange: return "invalid exchange"; - case errc::invalid_request_descriptor: return "invalid request descriptor"; - case errc::exchange_full: return "exchange full"; - case errc::no_anode: return "no anode"; - case errc::invalid_request_code: return "invalid request code"; - case errc::invalid_slot: return "invalid slot"; - case errc::bad_font_file_format: return "bad font file format"; - case errc::machine_is_not_on_the_network: return "machine is not on the network"; - case errc::package_not_installed: return "package not installed"; - case errc::object_is_remote: return "object is remote"; - case errc::no_link: return "no link"; - case errc::advertise_error: return "advertisement error"; - case errc::srmount_error: return "srmount error"; - case errc::communication_error_on_send: return "communication error on send"; - case errc::protocol_error: return "protocol error"; - case errc::multihop_attempt: return "multihop attempt"; - case errc::bad_message: return "bad message"; - case errc::value_too_large: return "value too large"; - case errc::name_not_unique_on_network: return "name not unique on network"; - case errc::file_descriptor_in_bad_state: return "file descriptor in bad state"; - case errc::remote_address_changed: return "remote address changed"; - case errc::shared_library_inaccessible: return "failed to access shared library"; - case errc::shared_library_corrupted: return "shared library corrupted"; - case errc::too_many_shared_libraries: return "attempted to load too many shared libraries"; - case errc::cannot_execute_shared_library: return "cannot execute shared library"; case errc::illegal_byte_sequence: return "illegal byte sequence"; - case errc::interrupted_try_again: return "system call interrupted, try again"; - case errc::too_many_users: return "too many logged in users"; - case errc::not_a_socket: return "not a socket"; - case errc::destination_address_required: return "destination address required"; + case errc::inappropriate_io_control_operation: return "inappropriate io control operation"; + case errc::interrupted: return "system call interrupted"; + case errc::invalid_argument: return "invalid argument"; + case errc::invalid_seek: return "invalid seek"; + case errc::io_error: return "input/output error"; + case errc::is_a_directory: return "is a directory"; case errc::message_size: return "message size"; - case errc::wrong_protocol_type: return "wrong protocol type"; - case errc::no_protocol_option: return "no protocol option"; - case errc::protocol_not_supported: return "protocol not supported"; - case errc::socket_type_not_supported: return "socket type not supported"; - case errc::operation_not_supported: return "operation not supported"; - case errc::protocol_family_not_supported: return "protocol family not supported"; - case errc::address_family_not_supported: return "address family not supported"; - case errc::address_in_use: return "address in use"; - case errc::address_not_available: return "address not available"; case errc::network_down: return "network down"; - case errc::network_unreachable: return "network unreachable"; case errc::network_reset: return "network reset"; - case errc::connection_aborted: return "connection aborted"; - case errc::connection_reset: return "connection reset"; + case errc::network_unreachable: return "network unreachable"; case errc::no_buffer_space: return "no buffer space"; - case errc::already_connected: return "already connected"; + case errc::no_child_process: return "no child process"; + case errc::no_link: return "no link"; + case errc::no_lock_available: return "no lock available"; + case errc::no_message: return "no message"; + case errc::no_protocol_option: return "no protocol option"; + case errc::no_space_on_device: return "no space on device"; + case errc::no_such_device: return "no such device"; + case errc::no_such_device_or_address: return "no such device or address"; + case errc::no_such_file_or_directory: return "no such file or directory"; + case errc::no_such_process: return "no such process"; + case errc::not_a_directory: return "not a directory"; + case errc::not_a_socket: return "not a socket"; case errc::not_connected: return "not connected"; - case errc::connection_shut_down: return "connection shut down"; - case errc::too_many_references: return "too many references"; - case errc::timed_out: return "timed out"; - case errc::connection_refused: return "connection refused"; - case errc::host_is_down: return "host is down"; - case errc::host_unreachable: return "host unreachable"; - case errc::connection_already_in_progress: return "connection already in progress"; - case errc::operation_in_progress: return "operation in progress"; - case errc::stale_file_handle: return "stale file handle"; - case errc::structure_needs_cleaning: return "structure needs cleaning"; - case errc::remote_io_error: return "remote input/output error"; - case errc::disk_quota_exceeded: return "disk quota exceeded"; - case errc::no_medium_found: return "no medium found"; - case errc::wrong_medium_type: return "wrong medium type"; + case errc::not_enough_memory: return "not enough memory"; + case errc::not_supported: return "not supported"; case errc::operation_canceled: return "operation canceled"; - case errc::required_key_not_available: return "required key not available"; - case errc::key_expired: return "key expired"; - case errc::key_revoked: return "key revoked"; - case errc::key_rejected: return "key rejected"; + case errc::operation_in_progress: return "operation in progress"; + case errc::operation_not_permitted: return "operation not permitted"; + case errc::operation_not_supported: return "operation not supported"; + case errc::operation_would_block: return "operation would block"; case errc::owner_dead: return "owner dead"; + case errc::permission_denied: return "permission denied"; + case errc::protocol_error: return "protocol error"; + case errc::protocol_not_supported: return "protocol not supported"; + case errc::read_only_file_system: return "read only file system"; + case errc::resource_deadlock_would_occur: return "resource deadlock would occur"; + case errc::resource_unavailable_try_again: return "resource unavailable, try again"; + case errc::result_out_of_range: return "result out of range"; + case errc::socket_type_not_supported: return "socket type not supported"; case errc::state_not_recoverable: return "state not recoverable"; - case errc::rf_kill: return "operation not possible due to RFkill"; - case errc::memory_page_hardware_error: return "memory page hardware error"; - case errc::not_supported: return "not supported"; + case errc::text_file_busy: return "text file busy"; + case errc::timed_out: return "timed out"; + case errc::too_many_files_open: return "too many files open"; + case errc::too_many_files_open_in_system: return "too many files open in system"; + case errc::too_many_links: return "too many links"; + case errc::too_many_symbolic_link_levels: return "too many symbolic link levels"; + case errc::value_too_large: return "value too large"; + case errc::wrong_protocol_type: return "wrong protocol type"; default: return "unknown system error"; // clang-format on } |
