The getifaddrs function is not part of the POSIX standard. It is a common extension used to retrieve a linked list of network interface addresses on the local system.
POSIX Status and Portability
Non-Standard: As of the latest POSIX versions (such as POSIX.1-2001 and 2008), getifaddrs remains an extension rather than a standardized interface.
Origin: The function first appeared in BSDi and has since been adopted by most BSD-derived systems (FreeBSD, macOS, OpenBSD) and Linux (via glibc 2.3 and later).
Implementation Differences: Because it is not standardized, behavior can vary across platforms. For example:
BSD: Often returns one entry per interface.
Linux: Typically returns one entry per address assigned to an interface (e.g., separate entries for IPv4 and IPv6).
POSIX Alternative: For strictly POSIX-compliant code, developers often use the ioctl system call with the SIOCGIFCONF request to enumerate interfaces, though this method is more cumbersome and has limitations regarding IPv6 support.
In reply to Re^3: Getting list of network interfaces
by Marshall
in thread Getting list of network interfaces
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |