Add IFF_DYNAMIC support for Linux.

Support in the ruby binding.
This commit is contained in:
Matthew Kent 2009-08-08 14:44:58 -07:00
parent c007175b21
commit cfae297d9b
4 changed files with 9 additions and 0 deletions

View File

@ -684,6 +684,7 @@ static void Init_rbsigar_constants(VALUE rclass)
RB_SIGAR_CONST_INT(IFF_MULTICAST);
RB_SIGAR_CONST_INT(IFF_SLAVE);
RB_SIGAR_CONST_INT(IFF_MASTER);
RB_SIGAR_CONST_INT(IFF_DYNAMIC);
RB_SIGAR_CONST_INT(NETCONN_CLIENT);
RB_SIGAR_CONST_INT(NETCONN_SERVER);

View File

@ -585,6 +585,7 @@ SIGAR_DECLARE(int) sigar_net_route_list_destroy(sigar_t *sigar,
#define SIGAR_IFF_MULTICAST 0x800
#define SIGAR_IFF_SLAVE 0x1000
#define SIGAR_IFF_MASTER 0x2000
#define SIGAR_IFF_DYNAMIC 0x4000
#define SIGAR_NULL_HWADDR "00:00:00:00:00:00"

View File

@ -1551,6 +1551,7 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
int is_mcast = flags & IFF_MULTICAST;
int is_slave = flags & IFF_SLAVE;
int is_master = flags & IFF_MASTER;
int is_dynamic = flags & IFF_DYNAMIC;
/*
* XXX: should just define SIGAR_IFF_*
* and test IFF_* bits on given platform.
@ -1568,6 +1569,9 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
if (is_master) {
flags |= SIGAR_IFF_MASTER;
}
if (is_dynamic) {
flags |= SIGAR_IFF_DYNAMIC;
}
#endif
ifconfig->flags = flags;
}

View File

@ -559,6 +559,9 @@ SIGAR_DECLARE(char *) sigar_net_interface_flags_to_string(sigar_uint64_t flags,
if (flags & SIGAR_IFF_MASTER) {
strcat(buf, "MASTER ");
}
if (flags & SIGAR_IFF_DYNAMIC) {
strcat(buf, "DYNAMIC ");
}
return buf;
}