errno.3am - Man Page

gawk extension to convert errno values to strings and vice versa


@load "errno"

string = strerror(11)
string = errno2name(11)
integer = name2errno("EAGAIN")


This extension is useful for working with the gawk PROCINFO["errno"] value. The errno extension adds three functions named strerror(), errno2name(), and name2errno(), as follows:


This function takes an integer argument and returns the result from calling the strerror(3) C library function.  If the argument is not numeric, it will return an empty string.


This function takes an integer argument and returns the symbolic name for the associated errno value.  For example, the returned value might be "EACCES" or "EAGAIN".  An empty string is returned for an unrecognized argument.


This function takes a string argument and returns the integer value associated with that symbolic errno value.  For example, if the argument is "EAGAIN", the returned value might be 11.  For unrecognized arguments, a value of -1 is returned.


@load "errno"
printf "The numeric value of 'EAGAIN' is %d\n", name2errno("EAGAIN")
printf "The string value of 11 is %s\n", errno2name(11)
printf "The description of errno 11 is '%s'\n", strerror(11)

See Also



Andrew Schorr

Copying Permissions

Copyright © 2012, 2013, Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of this manual page provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual page under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.

Referenced By

ares_set_socket_functions(3), blkio(3), cap_iab(3), cap_launch(3), efi_get_variable(3), errno(1), error(3), ERR_put_error.3ossl(3), form.3x(3), form_cursor.3x(3), form_driver.3x(3), form_field.3x(3), form_field_attributes.3x(3), form_field_buffer.3x(3), form_field_info.3x(3), form_field_just.3x(3), form_field_opts.3x(3), form_fieldtype.3x(3), form_field_validation.3x(3), form_hook.3x(3), form_opts.3x(3), form_page.3x(3), form_post.3x(3), form_win.3x(3), gawk(1), intro(2), intro(3), ldap_dup(3), ldap_get_dn(3), ldap_init(3), libnbd(3), libnbd-release-notes-1.2(1), libpsx(3), math_error(7), memcached_last_error(3), memcached_last_error_errno(3), memcached_last_error_message(3), menu.3x(3), menu_attributes.3x(3), menu_cursor.3x(3), menu_driver.3x(3), menu_format.3x(3), menu_hook.3x(3), menu_items.3x(3), menu_mark.3x(3), menu_new.3x(3), menu_opts.3x(3), menu_pattern.3x(3), menu_post.3x(3), menu_win.3x(3), mitem_current.3x(3), mitem_new.3x(3), mitem_opts.3x(3), mitem_value.3x(3), notcurses_input(3), perror(3), pmem2_config_new(3), pmem2_source_alignment(3), pmem2_source_device_id(3), pmem2_source_device_usc(3), pmem2_source_from_anon(3), pmem2_source_from_fd(3), pmem2_source_numa_node(3), pmem2_source_size(3), rc_service(3), sd_bus_error(3), sd_bus_error_add_map(3), sd-bus-errors(3), sd_bus_message_new_method_error(3), sd_journal_print(3), s-nail(1), strerror(3), _syscall(2), syscall(2), syscalls(2), systemd.exec(5), systemd.journal-fields(7), zip_error_init(3), zshparam(1), zzip_fopen(3), zzip_open(3), zzip_opendir(3), zzip_read(3), __zzip_try_open(3).

Jan 15 2013 Free Software Foundation GNU Awk Extension Modules