Subject: kern/33755: Kernel lacks a VFS/Disk IO Stats API for pkgsrc/net/net-snmp mib module: ucd-snmp/diskio (snmptable diskIOTable)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <lavalamp@spiritual-machines.org>
List: netbsd-bugs
Date: 06/17/2006 04:20:00
>Number:         33755
>Category:       kern
>Synopsis:       Kernel lacks a VFS/Disk IO Stats API for pkgsrc/net/net-snmp mib module: ucd-snmp/diskio (snmptable diskIOTable)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 17 04:20:00 +0000 2006
>Originator:     Brian A. Seklecki
>Release:        NetBSD thunderwing 3.0_STABLE NetBSD 3.0_STABLE (GENERIC.MPACPI-NOIPV6+IPSEC)
>Organization:
Spiritual Machines
>Environment:
NetBSD thunderwing 3.0_STABLE NetBSD 3.0_STABLE (GENERIC.MPACPI-NOIPV6+IPSEC)
>Description:
bin/sh ../libtool --mode=compile cc -I../include -I. -I../agent -I../agent/mibgroup  -I../snmplib -I/usr/pkg/includ
e -I/usr/include -O2 -Dnetbsd1 -I/usr/pkg/include -I/usr/include -Dnetbsdelf -c -o snmpd.lo snmpd.c
 cc -I../include -I. -I../agent -I../agent/mibgroup -I../snmplib -I/usr/pkgsrc/net/net-snmp/work/.buildlink/include
-O2 -Dnetbsd1 -Dnetbsdelf -c snmpd.c  -fPIC -DPIC -o .libs/snmpd.o
 cc -I../include -I. -I../agent -I../agent/mibgroup -I../snmplib -I/usr/pkgsrc/net/net-snmp/work/.buildlink/include
-O2 -Dnetbsd1 -Dnetbsdelf -c snmpd.c -o snmpd.o >/dev/null 2>&1
/bin/sh ../libtool --mode=link cc -O2 -Dnetbsd1 -I/usr/pkg/include -I/usr/include -Dnetbsdelf -o snmpd snmpd.lo  -L/
usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib libnetsnmpmibs.la  libnetsnmpagent.la helpers/libnetsnmphel
pers.la -L/usr/lib/lib -lwrap ../snmplib/libnetsnmp.la -lkvm -lz -ldes -lcrypto -lm
cc -O2 -Dnetbsd1 -I/usr/pkgsrc/net/net-snmp/work/.buildlink/include -Dnetbsdelf -o .libs/snmpd .libs/snmpd.o -Wl,-R/
usr/pkg/lib  -L/usr/pkgsrc/net/net-snmp/work/.buildlink/lib ./.libs/libnetsnmpmibs.so ./.libs/libnetsnmpagent.so hel
pers/.libs/libnetsnmphelpers.so -L/usr/lib/lib -lwrap ../snmplib/.libs/libnetsnmp.so -lkvm -lz -ldes -lcrypto -lm  -
Wl,--rpath -Wl,/usr/pkg/lib
./.libs/libnetsnmpmibs.so: warning: warning: reference to obsolete getfsstat(); use getvfsstat()
./.libs/libnetsnmpmibs.so: undefined reference to `var_diskio'
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/net/net-snmp/work/net-snmp-5.3.0.1/agent
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/net/net-snmp/work/net-snmp-5.3.0.1
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/net/net-snmp

>How-To-Repeat:
Build pkgsrc/net/net-snmp/ with-mib-modules+="ucd-snmp/diskio".


See above error message.  Examine #IFDEF'd code for FreeBSD.  Notice that we lack.

#if defined (freebsd4) || defined(freebsd5)
#include <sys/param.h>
#if __FreeBSD_version >= 500101
#include <sys/resource.h>       /* for CPUSTATES in devstat.h */
#else
#include <sys/dkstat.h>
#endif
#include <devstat.h>
#include <net-snmp/utilities.h>


#if defined(freebsd5) && __FreeBSD_version >= 500107
  #define GETDEVS(x) devstat_getdevs(NULL, (x))
#else
  #define GETDEVS(x) getdevs((x))
#endif



>Fix:
FreeBBSD implements:

/usr/include/sys/devicestat.h
/usr/include/sys/dkstat.h
/usr/include/sys/stat.h
/usr/include/sys/statvfs.h
/usr/include/devstat.h


http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/devicestat.h
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/statvfs.h

We will need to adopt something similar for our VFS layer to make this code work.