[PATCH 3/5] manual: Document error codes missing for 'if_nametoindex'

Maciej W. Rozycki macro@orcam.me.uk
Thu May 22 17:22:52 GMT 2025


From: Maciej W. Rozycki <macro@redhat.com>

Add documentation for ENODEV and ENOSYS error codes returned and refer 
to 'socket' for further possible codes from the underlying function 
call.

While changing the text clarify the description by mentioning 'ifname'.
---
 manual/socket.texi |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

glibc-doc-if_nametoindex-err.diff
Index: glibc/manual/socket.texi
===================================================================
--- glibc.orig/manual/socket.texi
+++ glibc/manual/socket.texi
@@ -497,7 +497,23 @@ interface name, including its terminatin
 @c takes a lock, which makes all callers AS- and AC-Unsafe.
 @c  opensock @asulock @aculock @acsfd
 This function yields the interface index corresponding to a particular
-name.  If no interface exists with the name given, it returns 0.
+name specified with @var{ifname}.
+
+The return value is the interface index on success.  On failure, the
+function's return value is zero and @code{errno} is set accordingly.
+The following @code{errno} values are specific to this function:
+
+@table @code
+@item ENODEV
+There is no interface by the name requested.
+
+@item ENOSYS
+This function is not implemented.
+@end table
+
+Additionally, since @code{if_nametoindex} invokes @code{socket}
+internally, @code{errno} may also be set to a value listed for the
+@code{socket} function (@pxref{Creating a Socket}).
 @end deftypefun
 
 @deftypefun {char *} if_indextoname (unsigned int @var{ifindex}, char *@var{ifname})


More information about the Libc-alpha mailing list