constify nic types
This commit is contained in:
parent
bb478479b2
commit
ab3c15d2e7
|
@ -234,4 +234,8 @@ int sigar_group_name_get(sigar_t *sigar, int gid, char *buf, int buflen);
|
|||
int sigar_get_iftype(const char *name, int *type, int *inst);
|
||||
#endif
|
||||
|
||||
#define SIGAR_NIC_LOOPBACK "Local Loopback"
|
||||
#define SIGAR_NIC_ETHERNET "Ethernet"
|
||||
#define SIGAR_NIC_NETROM "AMPR NET/ROM"
|
||||
|
||||
#endif
|
||||
|
|
13
src/sigar.c
13
src/sigar.c
|
@ -1172,11 +1172,11 @@ static void get_interface_type(sigar_net_interface_config_t *ifconfig,
|
|||
|
||||
switch (family) {
|
||||
case ARPHRD_NETROM:
|
||||
type = "AMPR NET/ROM";
|
||||
type = SIGAR_NIC_NETROM;
|
||||
break;
|
||||
/* XXX more */
|
||||
default:
|
||||
type = "Ethernet";
|
||||
type = SIGAR_NIC_ETHERNET;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1244,7 +1244,8 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
|
|||
ifconfig->destination = ifconfig->address;
|
||||
ifconfig->broadcast = 0;
|
||||
sigar_hwaddr_set_null(ifconfig);
|
||||
SIGAR_SSTRCPY(ifconfig->type, "Local Loopback");
|
||||
SIGAR_SSTRCPY(ifconfig->type,
|
||||
SIGAR_NIC_LOOPBACK);
|
||||
}
|
||||
else {
|
||||
if (!ioctl(sock, SIOCGIFDSTADDR, &ifr)) {
|
||||
|
@ -1263,10 +1264,12 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
|
|||
}
|
||||
#elif defined(_AIX) || defined(__osf__)
|
||||
hwaddr_aix_lookup(sigar, ifconfig);
|
||||
SIGAR_SSTRCPY(ifconfig->type, "Ethernet");
|
||||
SIGAR_SSTRCPY(ifconfig->type,
|
||||
SIGAR_NIC_ETHERNET);
|
||||
#else
|
||||
hwaddr_arp_lookup(ifconfig, sock);
|
||||
SIGAR_SSTRCPY(ifconfig->type, "Ethernet");
|
||||
SIGAR_SSTRCPY(ifconfig->type,
|
||||
SIGAR_NIC_ETHERNET);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue