Re: Static content in /proc/net/dev.
fredag den 14 januari 2011 klockan 11:51 skrev Bjoern A. Zeeb detta:
> On Wed, 29 Dec 2010, Bjoern A. Zeeb wrote:
>
> Hi,
>
>> On Wed, 29 Dec 2010, Timo Juhani Lindfors wrote:
>>> http://lists.freebsd.org/mailman/listinfo/freebsd-emulation
>>>
>>> perhaps be the proper forum for this?
>>
>> I hacked this together very quickly; can you test it? I think it's
>> the closest you could possibly get. In case you could confirm if the
>> MC counter is receive only that would be good as well.
>>
>> http://people.freebsd.org/~bz/20101229-02-sys-linprocfs-donetdev.diff
>
> Was anyone able to test this?
The changes are functional (single homed kfreebsd-amd64):
Inter-| Receive| Transmit
face|bytes packets errs drop fifo frame compressed multicast| bytes packets errs drop fifo colls carrier compressed
eth0: 548817 5190 0 0 0 0 0 2 632409 3179 0 0 0 0 0 0
lo0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Personally I dislike polluting the FreeBSD namespace with Linux
interface naming, so this must be changed before a patch should
be considered for inclusion.
The patched kernel was tested against the original source netload-1.2.2,
as contained in netdiag_1.0-13, see also [1]. That piece of software
relies on `/proc/net/dev' for its functionality, and with the patched
kernel it delivers most of the expected statistics. Only most of them,
since the present patch cannot furnish all error and fifo statistics.
A recalculation of the original patch against kfreebsd-8_8.1+dfsg-7.1
is being attached here.
Best regards,
Mats E Andersson, DM
[1] http://bugs.debian.org/608300
Description: Include interface statistics in `/proc/net/dev`
Use available kernel statistics to simulate the corresponding
numbers available in the native Linux entry.
.
The present text is to be included after both of
.
debian/patches/104_linprocfs.diff
debian/patches/908_linprocfs_is_not_proc.diff
Author: Bjoern A. Zeeb <bzeeb-lists@lists.zabbadoz.net>
X-Debian-Adaption: Mats Erik Andersson <debian@gisladisker.se>
X-Original-Patch: http://people.freebsd.org/~bz/20101229-02-sys-linprocfs-donetdev.diff
X-Original-Update: 2010-12-29
Forwarded: no
Last-Update: 2011-01-18
--- kfreebsd-8-8.1+dfsg.debian/sys/compat/linprocfs/linprocfs.c
+++ kfreebsd-8-8.1+dfsg/sys/compat/linprocfs/linprocfs.c
@@ -1116,20 +1116,43 @@
char ifname[16]; /* XXX LINUX_IFNAMSIZ */
struct ifnet *ifp;
- sbuf_printf(sb, "%6s|%58s|%s\n%6s|%58s|%58s\n",
- "Inter-", " Receive", " Transmit", " face",
- "bytes packets errs drop fifo frame compressed",
- "bytes packets errs drop fifo frame compressed");
+ sbuf_printf(sb, "%6s|%58s|%s\n"
+ "%6s|%58s|%58s\n",
+ "Inter-", " Receive", " Transmit",
+ " face",
+ "bytes packets errs drop fifo frame compressed multicast",
+ "bytes packets errs drop fifo colls carrier compressed");
CURVNET_SET(TD_TO_VNET(curthread));
IFNET_RLOCK();
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
linux_ifname(ifp, ifname, sizeof ifname);
- sbuf_printf(sb, "%6.6s:", ifname);
- sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu ",
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL);
+ sbuf_printf(sb, "%6.6s: ", ifname);
+ sbuf_printf(sb, "%7lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu ",
+ ifp->if_ibytes, /* rx_bytes */
+ ifp->if_ipackets, /* rx_packets */
+ ifp->if_ierrors, /* rx_errors */
+ ifp->if_iqdrops, /* rx_dropped +
+ * rx_missed_errors */
+ 0UL, /* rx_fifo_errors */
+ 0UL, /* rx_length_errors +
+ * rx_over_errors +
+ * rx_crc_errors +
+ * rx_frame_errors */
+ 0UL, /* rx_compressed */
+ ifp->if_imcasts); /* multicast, XXX-BZ rx only? */
sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL);
+ ifp->if_obytes, /* tx_bytes */
+ ifp->if_opackets, /* tx_packets */
+ ifp->if_oerrors, /* tx_errors */
+ 0UL, /* tx_dropped */
+ 0UL, /* tx_fifo_errors */
+ ifp->if_collisions, /* collisions */
+ 0UL, /* tx_carrier_errors +
+ * tx_aborted_errors +
+ * tx_window_errors +
+ * tx_heartbeat_errors */
+ 0UL); /* tx_compressed */
}
IFNET_RUNLOCK();
CURVNET_RESTORE();
Reply to: