[PATCH v2 1/3] manual: Document error codes missing for 'if_indextoname'
Florian Weimer
fweimer@redhat.com
Mon Jun 2 12:10:50 GMT 2025
* Maciej W. Rozycki:
> Index: glibc/manual/socket.texi
> ===================================================================
> --- glibc.orig/manual/socket.texi
> +++ glibc/manual/socket.texi
> @@ -505,11 +505,22 @@ name. If no interface exists with the n
> @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}
This looks okay to me.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
More information about the Libc-alpha
mailing list