This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Get a network interface address
#include <sys/types.h> #include <sys/socket.h> #include <ifaddrs.h> int getifaddrs( struct ifaddrs ** ifap );
libsocket
Use the -l socket option to qcc to link against this library.
The getifaddrs() function stores a reference to a linked list of the network interfaces on the local machine in the memory referenced by ifap.
The data returned by getifaddrs() is dynamically allocated; you should free it by calling freeifaddrs() when you no longer need it.
The getifaddrs() function may fail and set errno for any of the errors specified by:
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
errno, freeifaddrs(), ifaddrs, ioctl(), malloc(), socket(), sysctl()