FreeBSD Bugzilla – Attachment 131930 Details for
Bug 176107
net-mgmt/collectd port update: adding zfs support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 10.39 KB, created by
Krzysztof
on 2013-02-13 13:10:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Krzysztof
Created:
2013-02-13 13:10:01 UTC
Size:
10.39 KB
patch
obsolete
>diff -ruN collectd/Makefile collectd.new/Makefile >--- collectd/Makefile 2013-01-16 05:20:25.000000000 +0100 >+++ collectd.new/Makefile 2013-02-11 10:51:59.000000000 +0100 >@@ -3,7 +3,7 @@ > > PORTNAME= collectd > PORTVERSION= 4.10.8 >-PORTREVISION= 1 >+PORTREVISION= 2 > CATEGORIES= net-mgmt > MASTER_SITES= http://collectd.org/files/ > >@@ -128,7 +128,6 @@ > --disable-vmem \ > --disable-vserver \ > --disable-wireless \ >- --disable-zfs_arc \ > --without-perl-bindings \ > --without-librabbitmq \ > --disable-varnish \ >diff -ruN collectd/files/patch-configure.in collectd.new/files/patch-configure.in >--- collectd/files/patch-configure.in 2012-04-13 05:20:13.000000000 +0200 >+++ collectd.new/files/patch-configure.in 2012-12-30 23:49:40.000000000 +0100 >@@ -1,6 +1,16 @@ >---- configure.in.orig 2011-10-14 12:49:49.000000000 -0800 >-+++ configure.in 2012-03-20 08:09:25.000000000 -0800 >-@@ -98,7 +98,7 @@ >+--- configure.in.orig 2012-11-11 11:43:05.000000000 +0100 >++++ configure.in 2012-12-30 23:49:30.000000000 +0100 >+@@ -67,6 +67,9 @@ >+ *openbsd*) >+ ac_system="OpenBSD" >+ ;; >++ *freebsd*) >++ ac_system="FreeBSD" >++ ;; >+ *aix*) >+ AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel]) >+ ac_system="AIX" >+@@ -98,7 +101,7 @@ > fi > > # Where to install .pc files. >@@ -9,7 +19,16 @@ > AC_SUBST(pkgconfigdir) > > # Check for standards compliance mode >-@@ -1745,9 +1745,6 @@ >+@@ -1200,6 +1203,8 @@ >+ then >+ AC_DEFINE(HAVE_LIBKSTAT, 1, >+ [Define to 1 if you have the 'kstat' library (-lkstat)]) >++ BUILD_WITH_LIBKSTAT_LIBS="-lkstat" >++ AC_SUBST(BUILD_WITH_LIBKSTAT_LIBS) >+ fi >+ AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes") >+ AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes") >+@@ -1562,9 +1567,6 @@ > [with_libgcrypt="yes"], > [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"]) > >@@ -19,7 +38,7 @@ > fi > > CPPFLAGS="$SAVE_CPPFLAGS" >-@@ -3165,7 +3162,7 @@ >+@@ -3059,7 +3061,7 @@ > if test "x$with_python" = "xyes" > then > AC_MSG_CHECKING([for Python LIBS]) >@@ -28,7 +47,7 @@ > python_config_status=$? > > if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x" >-@@ -3180,7 +3177,7 @@ >+@@ -3074,7 +3076,7 @@ > if test "x$with_python" = "xyes" > then > LDFLAGS="-L$python_library_path $LDFLAGS" >@@ -37,3 +56,16 @@ > > AC_CHECK_FUNC(PyObject_CallFunction, > [with_python="yes"], >+@@ -4171,6 +4173,12 @@ >+ plugin_zfs_arc="yes" >+ fi >+ >++# FreeBSD >++if test "x$ac_system" = "xFreeBSD" >++then >++ plugin_zfs_arc="yes" >++fi >++ >+ if test "x$with_devinfo$with_kstat" = "xyesyes" >+ then >+ plugin_cpu="yes" >diff -ruN collectd/files/patch-src__Makefile.am collectd.new/files/patch-src__Makefile.am >--- collectd/files/patch-src__Makefile.am 2012-12-22 05:22:08.000000000 +0100 >+++ collectd.new/files/patch-src__Makefile.am 2012-12-30 23:37:04.000000000 +0100 >@@ -1,5 +1,5 @@ > --- src/Makefile.am.orig 2012-11-11 11:43:05.000000000 +0100 >-+++ src/Makefile.am 2012-12-21 16:19:37.000000000 +0100 >++++ src/Makefile.am 2012-12-30 23:34:44.000000000 +0100 > @@ -7,7 +7,7 @@ > endif > >@@ -9,6 +9,15 @@ > endif > > AM_CPPFLAGS = -DPREFIX='"${prefix}"' >+@@ -1198,7 +1198,7 @@ >+ zfs_arc_la_SOURCES = zfs_arc.c >+ zfs_arc_la_CFLAGS = $(AM_CFLAGS) >+ zfs_arc_la_LDFLAGS = -module -avoid-version >+-zfs_arc_la_LIBADD = -lkstat >++zfs_arc_la_LIBADD = $(BUILD_WITH_LIBKSTAT_LIBS) >+ collectd_LDADD += "-dlopen" zfs_arc.la >+ collectd_DEPENDENCIES += zfs_arc.la >+ endif > @@ -1257,12 +1257,7 @@ > > install-exec-hook: >diff -ruN collectd/files/patch-src__network.c collectd.new/files/patch-src__network.c >--- collectd/files/patch-src__network.c 1970-01-01 01:00:00.000000000 +0100 >+++ collectd.new/files/patch-src__network.c 2011-07-15 04:38:07.000000000 +0200 >@@ -0,0 +1,12 @@ >+--- src/network.c.orig 2011-07-14 15:41:32.000000000 +0200 >++++ src/network.c 2011-07-14 15:41:37.000000000 +0200 >+@@ -58,7 +58,9 @@ >+ #endif >+ >+ #if HAVE_LIBGCRYPT >++#pragma GCC diagnostic ignored "-Wdeprecated-declarations" >+ # include <gcrypt.h> >++#pragma GCC diagnostic warning "-Wdeprecated-declarations" >+ GCRY_THREAD_OPTION_PTHREAD_IMPL; >+ #endif >+ >diff -ruN collectd/files/patch-src__zfs_arc.c collectd.new/files/patch-src__zfs_arc.c >--- collectd/files/patch-src__zfs_arc.c 1970-01-01 01:00:00.000000000 +0100 >+++ collectd.new/files/patch-src__zfs_arc.c 2012-12-31 01:00:00.000000000 +0100 >@@ -0,0 +1,161 @@ >+--- src/zfs_arc.c.orig 2012-11-11 11:43:05.000000000 +0100 >++++ src/zfs_arc.c 2012-12-31 00:59:33.000000000 +0100 >+@@ -23,11 +23,58 @@ >+ #include "common.h" >+ #include "plugin.h" >+ >++#if !defined(HAVE_LIBKSTAT) && defined(HAVE_SYSCTLBYNAME) >++#include <sys/sysctl.h> >++#endif >++ >+ /* >+ * Global variables >+ */ >+ >+-extern kstat_ctl_t *kc; >++#if defined(HAVE_LIBKSTAT) >++ extern kstat_ctl_t *kc; >++#endif >++ >++/* >++ * Context >++ */ >++struct za_context { >++#if defined(HAVE_LIBKSTAT) >++ kstat_t *ksp; >++#endif >++}; >++ >++static int za_init_context(struct za_context *ctx) >++{ >++#if defined(HAVE_LIBKSTAT) >++ get_kstat (&ctx->ksp, "zfs", 0, "arcstats"); >++ if (ctx->ksp == NULL) >++ { >++ ERROR ("zfs_arc plugin: Cannot find zfs:0:arcstats kstat."); >++ return (-1); >++ } >++#endif >++ return 0; >++} >++ >++static long long za_get_value(struct za_context *ctx, const char* name) >++{ >++#if defined(HAVE_LIBKSTAT) >++ return get_kstat_value(ctx->ksp, name); >++#elif defined(HAVE_SYSCTLBYNAME) >++ // kstat values are available on FreeBSD through sysctl >++ char fullname[512]; >++ long long result = 0; >++ size_t size = sizeof(result); >++ ssnprintf(fullname, sizeof(fullname), "kstat.zfs.misc.arcstats.%s", name); >++ if (sysctlbyname(fullname, &result, &size, NULL, 0) != 0 || size != sizeof(result)) >++ { >++ ERROR ("zfs_arc plugin: Cannot find stats using sysctl"); >++ result = 0; >++ } >++ return result; >++#endif >++} >+ >+ static void za_submit (const char* type, const char* type_instance, value_t* values, int values_len) >+ { >+@@ -90,42 +137,40 @@ >+ >+ static int za_read (void) >+ { >+- gauge_t arcsize, targetsize, minlimit, maxlimit, hits, misses, l2_size, l2_hits, l2_misses; >+- counter_t demand_data_hits, demand_metadata_hits, prefetch_data_hits, prefetch_metadata_hits; >+- counter_t demand_data_misses, demand_metadata_misses, prefetch_data_misses, prefetch_metadata_misses; >+- counter_t l2_read_bytes, l2_write_bytes; >+- kstat_t *ksp = NULL; >++ long long arcsize, targetsize, minlimit, maxlimit, hits, misses, l2_size, l2_hits, l2_misses; >++ long long demand_data_hits, demand_metadata_hits, prefetch_data_hits, prefetch_metadata_hits; >++ long long demand_data_misses, demand_metadata_misses, prefetch_data_misses, prefetch_metadata_misses; >++ long long l2_read_bytes, l2_write_bytes; >++ struct za_context ctx; >+ >+- get_kstat (&ksp, "zfs", 0, "arcstats"); >+- if (ksp == NULL) >++ if (za_init_context (&ctx) < 0) >+ { >+- ERROR ("zfs_arc plugin: Cannot find zfs:0:arcstats kstat."); >+ return (-1); >+ } >+ >+- arcsize = get_kstat_value(ksp, "size"); >+- targetsize = get_kstat_value(ksp, "c"); >+- minlimit = get_kstat_value(ksp, "c_min"); >+- maxlimit = get_kstat_value(ksp, "c_max"); >+- >+- demand_data_hits = get_kstat_value(ksp, "demand_data_hits"); >+- demand_metadata_hits = get_kstat_value(ksp, "demand_metadata_hits"); >+- prefetch_data_hits = get_kstat_value(ksp, "prefetch_data_hits"); >+- prefetch_metadata_hits = get_kstat_value(ksp, "prefetch_metadata_hits"); >+- >+- demand_data_misses = get_kstat_value(ksp, "demand_data_misses"); >+- demand_metadata_misses = get_kstat_value(ksp, "demand_metadata_misses"); >+- prefetch_data_misses = get_kstat_value(ksp, "prefetch_data_misses"); >+- prefetch_metadata_misses = get_kstat_value(ksp, "prefetch_metadata_misses"); >+- >+- hits = get_kstat_value(ksp, "hits"); >+- misses = get_kstat_value(ksp, "misses"); >+- >+- l2_size = get_kstat_value(ksp, "l2_size"); >+- l2_read_bytes = get_kstat_value(ksp, "l2_read_bytes"); >+- l2_write_bytes = get_kstat_value(ksp, "l2_write_bytes"); >+- l2_hits = get_kstat_value(ksp, "l2_hits"); >+- l2_misses = get_kstat_value(ksp, "l2_misses"); >++ arcsize = za_get_value(&ctx, "size"); >++ targetsize = za_get_value(&ctx, "c"); >++ minlimit = za_get_value(&ctx, "c_min"); >++ maxlimit = za_get_value(&ctx, "c_max"); >++ >++ demand_data_hits = za_get_value(&ctx, "demand_data_hits"); >++ demand_metadata_hits = za_get_value(&ctx, "demand_metadata_hits"); >++ prefetch_data_hits = za_get_value(&ctx, "prefetch_data_hits"); >++ prefetch_metadata_hits = za_get_value(&ctx, "prefetch_metadata_hits"); >++ >++ demand_data_misses = za_get_value(&ctx, "demand_data_misses"); >++ demand_metadata_misses = za_get_value(&ctx, "demand_metadata_misses"); >++ prefetch_data_misses = za_get_value(&ctx, "prefetch_data_misses"); >++ prefetch_metadata_misses = za_get_value(&ctx, "prefetch_metadata_misses"); >++ >++ hits = za_get_value(&ctx, "hits"); >++ misses = za_get_value(&ctx, "misses"); >++ >++ l2_size = za_get_value(&ctx, "l2_size"); >++ l2_read_bytes = za_get_value(&ctx, "l2_read_bytes"); >++ l2_write_bytes = za_get_value(&ctx, "l2_write_bytes"); >++ l2_hits = za_get_value(&ctx, "l2_hits"); >++ l2_misses = za_get_value(&ctx, "l2_misses"); >+ >+ >+ za_submit_size (arcsize, targetsize, minlimit, maxlimit); >+@@ -146,12 +191,23 @@ >+ >+ static int za_init (void) /* {{{ */ >+ { >+- /* kstats chain already opened by update_kstat (using *kc), verify everything went fine. */ >+- if (kc == NULL) >++#if defined(HAVE_LIBKSTAT) >++ /* kstats chain already opened by update_kstat (using *kc), verify everything went fine. */ >++ if (kc == NULL) >++ { >++ ERROR ("zfs_arc plugin: kstat chain control structure not available."); >++ return (-1); >++ } >++#elif defined(HAVE_SYSCTLBYNAME) >++ /* make sure ARC is available (arc_size is not null) */ >++ unsigned long long arc_size; >++ size_t size = sizeof(arc_size); >++ if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arc_size, &size, NULL, 0) != 0 || arc_size == 0) >+ { >+- ERROR ("zfs_arc plugin: kstat chain control structure not available."); >++ ERROR ("zfs_arc plugin: could not get ARC size using sysctl, is ARC enabled?"); >+ return (-1); >+ } >++#endif >+ >+ return (0); >+ } /* }}} int za_init */ >diff -ruN collectd/pkg-plist collectd.new/pkg-plist >--- collectd/pkg-plist 2012-12-11 05:24:43.000000000 +0100 >+++ collectd.new/pkg-plist 2013-02-11 10:57:56.000000000 +0100 >@@ -107,6 +107,8 @@ > %%WRITE_HTTP%%lib/collectd/write_http.so > %%XMMS%%lib/collectd/xmms.la > %%XMMS%%lib/collectd/xmms.so >+lib/collectd/zfs_arc.la >+lib/collectd/zfs_arc.so > include/collectd/client.h > include/collectd/lcc_features.h > libdata/pkgconfig/libcollectdclient.pc
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 176107
: 131930