Porting to OS/2: Case #23 if_nameindex() family
if_nameindex() is used to retrive all network interface names and indexes. if_freenameindex() is used to free internal storages allocated by if_nameindex(). And there is a family which maps a network inteface name to its corresponding index, and vice versa. They are if_nametoindex() and if_indextoname() . OS/2 has no them. Fortunately, however, OS/2 provides socket calls to implement them. First, you can use os2_ioctl( SIOSTATIF42 ) . This call provides interface statistics for all interfaces up to 42 via struct ifmib which includes a index and a description of a network interface. A index is 0-based. However, if_nameindex() family accepts 0-index as the last entry of network interfaces or an invalid index. So it's needed to increase the index by 1. A description is a long description not a short description. For example, Ethernet-Csmacd not lan0. So you should generate a canonical name from a description and an index. For details, see the following ODIN source. htt...