From: Maciej W. Rozycki Date: Wed, 4 Jun 2025 15:27:20 +0000 (+0100) Subject: manual: Document error codes missing for 'if_indextoname' X-Git-Tag: glibc-2.42~168 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=46acdf46cc1948187d6540cdf4abee5053cd8bcc;p=thirdparty%2Fglibc.git manual: Document error codes missing for 'if_indextoname' Add documentation for ENXIO 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' and replace @code tags with @var ones where referring to a function parameter. Reviewed-by: Florian Weimer --- diff --git a/manual/socket.texi b/manual/socket.texi index 2f0e7509e9..a6fb6b1b7e 100644 --- a/manual/socket.texi +++ b/manual/socket.texi @@ -505,11 +505,22 @@ name. If no interface exists with the name given, it returns 0. @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}} @c It opens a socket with opensock to use ioctl on the fd to get the @c name from the index. -This function maps an interface index to its corresponding name. The -returned name is placed in the buffer pointed to by @code{ifname}, which -must be at least @code{IFNAMSIZ} bytes in length. If the index was -invalid, the function's return value is a null pointer, otherwise it is -@code{ifname}. +This function maps an interface index @var{ifindex} to its corresponding +name. The returned name is placed in the buffer pointed to by @var{ifname}, +which must be at least @code{IFNAMSIZ} bytes in length. + +The return value is @var{ifname} on success. On failure, the function's +return value is a null pointer and @code{errno} is set accordingly. The +following @code{errno} values are specific to this function: + +@table @code +@item ENXIO +There is no interface at the index requested. +@end table + +Additionally, since @code{if_indextoname} 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 @deftp {Data Type} {struct if_nameindex}