if_indextoname()

Updated: April 19, 2023

Map an interface index to its name

Synopsis:

#include <net/if.h>

char * if_indextoname( unsigned int ifindex,
                       char * ifname );

Arguments:

ifindex
The interface index.
ifname
A pointer to a buffer in which if_indextoname() copies the interface name. The buffer must be a minimum of IFNAMSIZ bytes long.

Library:

libsocket

Use the -l socket option to qcc to link against this library.

Description:

The if_indextoname() function maps the interface index specified by ifindex to its corresponding name. The name is copied into the buffer pointed to by ifname.

Returns:

A pointer to the name, or NULL if There isn't an interface corresponding to the specified index.

Classification:

POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes