All,

While compiling CollectD 5.1.0 on Solaris 10 x64 using the default GCC version, I ran into a problem compiling the zfs_arch plugin:

zfs_arc.c: In function `za_read_derive':
zfs_arc.c:63: warning: passing arg 2 of `get_kstat_value' discards qualifiers from pointer target type
zfs_arc.c: In function `za_read_gauge':
zfs_arc.c:80: warning: passing arg 2 of `get_kstat_value' discards qualifiers from pointer target type
*** Error code 1
make: Fatal error: Command failed for target `zfs_arc_la-zfs_arc.lo'


zfs_arc.c's za_read_derive and za_read_gauge functions both define a "const char *kstat_value" parameter, but common.h defines get_kstat_value as receiving a "char *name" parameter. The quick fix was to redefine the kstat_value parameter in both functions as "char *kstat_value".

Fixing this issue revealed one more set of issues:

zfs_arc.c: In function `za_read_derive':
zfs_arc.c:72: warning: control reaches end of non-void function
*** Error code 1
make: Fatal error: Command failed for target `zfs_arc_la-zfs_arc.lo'

A similar error occurred for za_read_gauge. I addressed this by adding a "return (0);" at the end of both functions.

I've attached a patch for the 5.1.0 version of zfs_arc.c which incorporates both fixes.

Thanks,
Scott Severtson
Chief Architect
Digital Measures
--- collectd-5.1.0.orig/src/zfs_arc.c	2012-04-02 04:04:58.000000000 -0400
+++ collectd-5.1.0.patch/src/zfs_arc.c	2012-05-29 14:44:03.938724633 -0400
@@ -54,7 +54,7 @@
 	za_submit (type, type_instance, &vv, 1);
 }
 
-static int za_read_derive (kstat_t *ksp, const char *kstat_value,
+static int za_read_derive (kstat_t *ksp, char *kstat_value,
     const char *type, const char *type_instance)
 {
   long long tmp;
@@ -69,9 +69,11 @@
 
   v.derive = (derive_t) tmp;
   za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
+
+  return (0);
 }
 
-static int za_read_gauge (kstat_t *ksp, const char *kstat_value,
+static int za_read_gauge (kstat_t *ksp, char *kstat_value,
     const char *type, const char *type_instance)
 {
   long long tmp;
@@ -86,6 +88,8 @@
 
   v.gauge = (gauge_t) tmp;
   za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
+
+  return (0);
 }
 
 static void za_submit_ratio (const char* type_instance, gauge_t hits, gauge_t misses)
_______________________________________________
collectd mailing list
[email protected]
http://mailman.verplant.org/listinfo/collectd

Reply via email to