On Mon, 2009-09-28 at 22:11 -0400, Joel Reed wrote:
> The attached patch implements 3 "Network Interface" performance category 
> counters. The counters are "Bytes Received/sec", "Bytes Sent/sec", and 
> "Bytes Total/sec". A sample program using these counters and sample 
> output is attached as well.
> 
> This information is obtained by reading /proc/net/dev.

The value returned by mono_networkinterface_list() is not freed
properly. In get_networkinterface_instance() you do:
        g_free (buf);
but it should be something like:
        for (i = 0; i < count; i++)
                g_free (buf [i]);

I would make mono_networkinterface_list() return a null-terminated array
and then use g_strfreev () on it.

As for mono_networkinterface_list(), I think it belongs somewhere else
perhaps utils/mono-networkinterfaces.c or in io-layer. If you want to go
the io-layer route:
mono_networkinterface_list => WSAIoctl(SIO_GET_INTERFACE_LIST_EX)
mono_network_get_data => GetIfTable() from Iphlpapi.dll

This way it would work in windows and linux by now and future additions
should stick to the same interface.

-Gonzalo


_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to