use sigar_net_interface_flags_to_string

This commit is contained in:
Doug MacEachern 2007-09-03 03:13:41 +00:00
parent a919d9457f
commit 315910c638
2 changed files with 9 additions and 1 deletions

View File

@ -17,7 +17,7 @@ iflist.each do |ifname|
ptp + bcast + " Mask:" + ifconfig.netmask ptp + bcast + " Mask:" + ifconfig.netmask
puts "\t" + puts "\t" +
flags.to_s + #XXX Sigar.net_interface_flags_to_s(flags) +
" MTU:" + ifconfig.mtu.to_s + " MTU:" + ifconfig.mtu.to_s +
" Metric:" + ifconfig.metric.to_s " Metric:" + ifconfig.metric.to_s

View File

@ -35,6 +35,12 @@ static VALUE rb_sigar_format_size(VALUE rclass, VALUE size)
return rb_str_new2(sigar_format_size(NUM2LL(size), buffer)); return rb_str_new2(sigar_format_size(NUM2LL(size), buffer));
} }
static VALUE rb_sigar_net_interface_flags_to_s(VALUE rclass, VALUE flags)
{
char buffer[1024];
return rb_str_new2(sigar_net_interface_flags_to_string(NUM2LL(flags), buffer));
}
static VALUE rb_sigar_net_address_to_string(sigar_net_address_t address) static VALUE rb_sigar_net_address_to_string(sigar_net_address_t address)
{ {
char addr_str[SIGAR_INET6_ADDRSTRLEN]; char addr_str[SIGAR_INET6_ADDRSTRLEN];
@ -159,6 +165,8 @@ void Init_rbsigar(void)
rb_define_singleton_method(rclass, "new", rb_sigar_new, 0); rb_define_singleton_method(rclass, "new", rb_sigar_new, 0);
rb_define_singleton_method(rclass, "format_size", rb_sigar_format_size, 1); rb_define_singleton_method(rclass, "format_size", rb_sigar_format_size, 1);
rb_define_singleton_method(rclass, "net_interface_flags_to_s",
rb_sigar_net_interface_flags_to_s, 1);
/* generated */ /* generated */
rb_sigar_define_module_methods(rclass); rb_sigar_define_module_methods(rclass);