Finish support for IFF_SLAVE and add IFF_MASTER.
Support both in ruby binding.
This commit is contained in:
1 parent
48f9f8cc65
commit
4d19f54b94
4 files changed
+14
-1
No files matched your search
+5
-1
@@ -1550,6 +1550,7 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
|
||||
#ifdef __linux__
|
||||
int is_mcast = flags & IFF_MULTICAST;
|
||||
int is_slave = flags & IFF_SLAVE;
|
||||
int is_master = flags & IFF_MASTER;
|
||||
/*
|
||||
* XXX: should just define SIGAR_IFF_*
|
||||
* and test IFF_* bits on given platform.
|
||||
@@ -1557,13 +1558,16 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
|
||||
* for the flags we care about.
|
||||
*
|
||||
*/
|
||||
flags &= ~(IFF_MULTICAST|IFF_SLAVE);
|
||||
flags &= ~(IFF_MULTICAST|IFF_SLAVE|IFF_MASTER);
|
||||
if (is_mcast) {
|
||||
flags |= SIGAR_IFF_MULTICAST;
|
||||
}
|
||||
if (is_slave) {
|
||||
flags |= SIGAR_IFF_SLAVE;
|
||||
}
|
||||
if (is_master) {
|
||||
flags |= SIGAR_IFF_MASTER;
|
||||
}
|
||||
#endif
|
||||
ifconfig->flags = flags;
|
||||
}
|
||||
|
||||
@@ -553,6 +553,12 @@ SIGAR_DECLARE(char *) sigar_net_interface_flags_to_string(sigar_uint64_t flags,
|
||||
if (flags & SIGAR_IFF_MULTICAST) {
|
||||
strcat(buf, "MULTICAST ");
|
||||
}
|
||||
if (flags & SIGAR_IFF_SLAVE) {
|
||||
strcat(buf, "SLAVE ");
|
||||
}
|
||||
if (flags & SIGAR_IFF_MASTER) {
|
||||
strcat(buf, "MASTER ");
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user