net_interface_config.mtu for AIX, HPUX and Solaris

This commit is contained in:
Doug MacEachern 2005-12-19 22:00:39 +00:00
parent dae98314b0
commit 2d831a99f4
1 changed files with 13 additions and 1 deletions

View File

@ -1276,9 +1276,21 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
#endif #endif
} }
#ifdef __linux__ #if defined(SIOCGLIFMTU) && !defined(__hpux)
{
struct lifreq lifr;
SIGAR_SSTRCPY(lifr.lifr_name, name);
if(!ioctl(sock, SIOCGLIFMTU, &lifr)) {
ifconfig->mtu = lifr.lifr_mtu;
}
}
#elif defined(SIOCGIFMTU)
if (!ioctl(sock, SIOCGIFMTU, &ifr)) { if (!ioctl(sock, SIOCGIFMTU, &ifr)) {
# if defined(__hpux)
ifconfig->mtu = ifr.ifr_metric;
# else
ifconfig->mtu = ifr.ifr_mtu; ifconfig->mtu = ifr.ifr_mtu;
#endif
} }
#else #else
ifconfig->mtu = 0; /*XXX*/ ifconfig->mtu = 0; /*XXX*/