summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 068ae14)
raw | patch | inline | side by side (parent: 068ae14)
author | Florian Forster <octo@huhu.verplant.org> | |
Wed, 6 May 2009 14:28:27 +0000 (16:28 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Wed, 6 May 2009 14:28:27 +0000 (16:28 +0200) |
In rare cases, e. g. Solaris, getmntent is available but neither the one nor
the two argument version could be recognized. This lead to `cu_mount_getlist'
returning NULL without an error, leading to the df plugin fail without notice.
While at it I re-implemented the dependency checking of the DF plugin to match
the proprocessor logic in utils_mount.c.
the two argument version could be recognized. This lead to `cu_mount_getlist'
returning NULL without an error, leading to the df plugin fail without notice.
While at it I re-implemented the dependency checking of the DF plugin to match
the proprocessor logic in utils_mount.c.
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/utils_mount.c | patch | blob | history | |
src/utils_mount.h | patch | blob | history |
diff --git a/configure.in b/configure.in
index df1b187f03c2c15de2408ed6be9090a2163318c8..af0219d26d758b0bca5d9d2021161e5c174a31e9 100644 (file)
--- a/configure.in
+++ b/configure.in
[c_cv_have_one_getmntent],
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
-#include <mntent.h>
#include "$srcdir/src/utils_mount.h"]],
[[
FILE *fh;
[c_cv_have_two_getmntent],
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
-#include <sys/mnttab.h>
#include "$srcdir/src/utils_mount.h"]],
[[
FILE *fh;
plugin_tcpconns="yes"
fi
-if test "x$have_statfs" = "xyes"
+# Df plugin: Check if we know how to determine mount points first.
+#if test "x$have_listmntent" = "xyes"; then
+# plugin_df="yes"
+#fi
+if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
then
plugin_df="yes"
fi
-if test "x$have_statvfs" = "xyes"
+if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
then
plugin_df="yes"
fi
+#if test "x$have_getmntent" = "xseq"
+#then
+# plugin_df="yes"
+#fi
+if test "x$c_cv_have_one_getmntent" = "xyes"
+then
+ plugin_df="yes"
+fi
+
+# Df plugin: Check if we have either `statfs' or `statvfs' second.
+if test "x$plugin_df" = "xyes"
+then
+ plugin_df="no"
+ if test "x$have_statfs" = "xyes"
+ then
+ plugin_df="yes"
+ fi
+ if test "x$have_statvfs" = "xyes"
+ then
+ plugin_df="yes"
+ fi
+fi
if test "x$have_getifaddrs" = "xyes"
then
diff --git a/src/Makefile.am b/src/Makefile.am
index 1b46b9ba9e3fa12fae3d8f6d5990af931a7819ab..92627b97aacf6fb02a97ac9f8f2d5753dbd8aac8 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
utils_llist.c utils_llist.h \
utils_tail_match.c utils_tail_match.h \
utils_match.c utils_match.h \
- utils_mount.c utils_mount.h \
utils_tail.c utils_tail.h \
utils_threshold.c utils_threshold.h \
types_list.c types_list.h
if BUILD_PLUGIN_DF
pkglib_LTLIBRARIES += df.la
-df_la_SOURCES = df.c
+df_la_SOURCES = df.c utils_mount.c utils_mount.h
df_la_LDFLAGS = -module -avoid-version
collectd_LDADD += "-dlopen" df.la
collectd_DEPENDENCIES += df.la
diff --git a/src/utils_mount.c b/src/utils_mount.c
index c53431f1a6458e8902b25ff2537f545e536b6269..cae3706794737fe438c79132cea13121c22b7ad9 100644 (file)
--- a/src/utils_mount.c
+++ b/src/utils_mount.c
#elif HAVE_TWO_GETMNTENT || HAVE_GEN_GETMNTENT || HAVE_SUN_GETMNTENT
new = cu_mount_gen_getmntent ();
#elif HAVE_SEQ_GETMNTENT
-# warn "This version of `getmntent' hat not yet been implemented!"
+# error "This version of `getmntent' hat not yet been implemented!"
#elif HAVE_ONE_GETMNTENT
new = cu_mount_getmntent ();
#else
- new = NULL;
+# error "Could not determine how to find mountpoints."
#endif
if (first != NULL)
diff --git a/src/utils_mount.h b/src/utils_mount.h
index cab5c01ea5ea2c783629826cbb361eb9f6f3050f..1f2403c3aa26412acd36046c790db290b0610ff0 100644 (file)
--- a/src/utils_mount.h
+++ b/src/utils_mount.h
/* See below for instructions how to use the public functions. */
-#if !COLLECTD_UTILS_MOUNT_H
+#ifndef COLLECTD_UTILS_MOUNT_H
#define COLLECTD_UTILS_MOUNT_H 1
-#include "common.h"
-
#if HAVE_FS_INFO_H
# include <fs_info.h>
#endif