[collectd] df plugins doesn't compile on OpenBSD 4.3
Andreas Maus
maus+collectd at ypbind.de
Wed Dec 30 10:38:40 CET 2009
Hi.
I was just upgrading my collectd installations to my systems to
the current (4.9.0) version.
The only error occurs on OpenBSD 4.3 compiling the df plugin:
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -DPREFIX='"/usr/local"' -DCONFIGFILE='"/etc/collectd/collectd.conf"' -DLOCALSTATEDIR='"/var"' -DPKGLOCALSTATEDIR='"/var/lib/collectd"' -DPIDFILE='"/var/run/collectd.pid"' -DPLUGINDIR='"/usr/local/lib/collectd"' -DPKGDATADIR='"/usr/local/share/collectd"' -Wall -Werror -g -O2 -MT df.lo -MD -MP -MF .deps/df.Tpo -c -o df.lo df.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -DPREFIX=\"/usr/local\" -DCONFIGFILE=\"/etc/collectd/collectd.conf\" -DLOCALSTATEDIR=\"/var\" -DPKGLOCALSTATEDIR=\"/var/lib/collectd\" -DPIDFILE=\"/var/run/collectd.pid\" -DPLUGINDIR=\"/usr/local/lib/collectd\" -DPKGDATADIR=\"/usr/local/share/collectd\" -Wall -Werror -g -O2 -MT df.lo -MD -MP -MF .deps/df.Tpo -c df.c -fPIC -DPIC -o .libs/df.o
df.c: In function `df_read':
df.c:313: error: structure has no member named `f_favail'
df.c:314: error: structure has no member named `f_favail'
df.c:318: error: structure has no member named `f_favail'
df.c:319: error: structure has no member named `f_favail'
*** Error code 1
Stop in /tmp/collectd-4.9.0/src (line 2835 of Makefile).
*** Error code 1
Stop in /tmp/collectd-4.9.0/src (line 3610 of Makefile).
*** Error code 1
Stop in /tmp/collectd-4.9.0/src (line 2310 of Makefile).
*** Error code 1
Stop in /tmp/collectd-4.9.0 (line 409 of Makefile).
The member f_favail in the structure statfs has been introduced in OpenBSD 4.4.
I modified the configure.in and src/df.c files to check the availability of
f_favail (see attached diff).
I didn't check the results of this plugin but at least it compiles ;)
HTH,
Andreas.
P.S.: Yes, I know OpenBSD 4.3 is really old ;)
--
"Things that try to look like things often do
look more like things than things. Well-known fact."
Granny Weatherwax - "Wyrd sisters"
-------------- next part --------------
--- collectd-4.9.0.OLD/configure.in 2009-12-29 13:43:48.000000000 +0100
+++ collectd-4.9.0/configure.in 2009-12-29 13:38:03.000000000 +0100
@@ -1024,6 +1024,13 @@
#endif
])
+if test "x$have_statfs" = "xyes" -o "x$have_statvfs" = "xyes"; then
+ AC_CHECK_MEMBERS([statfs.f_favail],
+ [],
+ [],
+ [])
+fi
+
AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
[],
[],
--- collectd-4.9.0.OLD/src/df.c 2009-12-29 13:43:46.000000000 +0100
+++ collectd-4.9.0/src/df.c 2009-12-29 13:42:19.000000000 +0100
@@ -310,13 +310,23 @@
uint64_t inode_used;
/* Sanity-check for the values in the struct */
+
+#ifdef HAVE_STATFS_F_FAVAIL
if (statbuf.f_ffree < statbuf.f_favail)
statbuf.f_ffree = statbuf.f_favail;
+#endif
+
if (statbuf.f_files < statbuf.f_ffree)
statbuf.f_files = statbuf.f_ffree;
+#ifdef HAVE_STATFS_F_FAVAIL
inode_free = (uint64_t) statbuf.f_favail;
inode_reserved = (uint64_t) (statbuf.f_ffree - statbuf.f_favail);
+#else
+ inode_free = (uint64_t) statbuf.f_ffree;
+ inode_reserved = (uint64_t) 0;
+#endif
+
inode_used = (uint64_t) (statbuf.f_files - statbuf.f_ffree);
df_submit_one (disk_name, "df_inodes", "free",
More information about the collectd
mailing list