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

Maciej W. Rozycki macro@orcam.me.uk
Fri May 30 13:29:02 GMT 2025


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

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

While changing the text clarify the description by mentioning 'ifname'.
---
Changes from v1 (3/5):

- Do not add ENOSYS references.
---
 manual/socket.texi |   15 ++++++++++++++-
 1 file changed, 14 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,20 @@ 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.
+@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