From 910c51ac59f4ffd08dd1b8e79b211f70a59657fe Mon Sep 17 00:00:00 2001 From: he Date: Thu, 19 Jan 2017 17:20:42 +0000 Subject: Reinstate the "processes" plugin for NetBSD by initializing the two per-process context switch counters to -1, indicating no support. Our kinfo_lwp structure doesn't contain the context switch counters, which in the kernel is part of the lwp structure. Also make this build on netbsd-6 and on ports which don't yet have nearbyint() by simply defining it as rint() on NetBSD. Bump PKGREVISION. --- sysutils/collectd/Makefile | 4 +++- sysutils/collectd/distinfo | 7 ++++--- sysutils/collectd/options.mk | 6 +++--- sysutils/collectd/patches/patch-src_processes.c | 10 +++++++--- sysutils/collectd/patches/patch-src_statsd.c | 19 +++++++++++++++++++ .../patches/patch-src_utils__format__kairosdb.c | 5 ++++- 6 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 sysutils/collectd/patches/patch-src_statsd.c (limited to 'sysutils') diff --git a/sysutils/collectd/Makefile b/sysutils/collectd/Makefile index 01e2ea6a207..6c954c0bde2 100644 --- a/sysutils/collectd/Makefile +++ b/sysutils/collectd/Makefile @@ -1,7 +1,9 @@ -# $NetBSD: Makefile,v 1.18 2016/10/13 15:17:28 fhajny Exp $ +# $NetBSD: Makefile,v 1.19 2017/01/19 17:20:42 he Exp $ .include "../../sysutils/collectd/Makefile.common" +PKGREVISION= 1 + COMMENT= Statistics collection daemon base RCD_SCRIPTS= collectd diff --git a/sysutils/collectd/distinfo b/sysutils/collectd/distinfo index b103109a51f..292306515b0 100644 --- a/sysutils/collectd/distinfo +++ b/sysutils/collectd/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.31 2016/12/24 10:16:07 joerg Exp $ +$NetBSD: distinfo,v 1.32 2017/01/19 17:20:42 he Exp $ SHA1 (collectd-5.6.2.tar.bz2) = 358b53ac5e0b00532d74bd40eb2658c6772d1458 RMD160 (collectd-5.6.2.tar.bz2) = 81818c24db06f7a8922dc24e7be8cbf5d86e050c @@ -17,8 +17,9 @@ SHA1 (patch-src_irq.c) = 78f1757ff2ed6db9fb1d0e773c2a01eb190d53a0 SHA1 (patch-src_libcollectclient_network__buffer.c) = 62924943831e6d0585b103e567888f9af5c46f9e SHA1 (patch-src_memory.c) = 2934cd50e454fc14d0ec952854c88b0a830fa9a7 SHA1 (patch-src_netstat__udp.c) = 30cb12d25f56c60959658dbd181783212e00cc61 -SHA1 (patch-src_processes.c) = 9a1a7a6943ea05d1a38cedf26e7aab8508df7ff1 +SHA1 (patch-src_processes.c) = dbcbb733b00bd77b0eae6d16f03fb0bcb3cbcbff +SHA1 (patch-src_statsd.c) = 35f4349d2d2c9bddc0f4770344f969157cd012f6 SHA1 (patch-src_swap.c) = 24da6e04e3006639311e8111f26f72e4fab4054a SHA1 (patch-src_tcpconns.c) = b85de1d0eb03989df12d9688b38d61733a13c028 SHA1 (patch-src_utils__dns.c) = 138a3168dc109d785412ffd068edab3b4dacca36 -SHA1 (patch-src_utils__format__kairosdb.c) = db5d13e6bbbe5adc07cd8a26ec78902cd3503bec +SHA1 (patch-src_utils__format__kairosdb.c) = 2f7bde47682d2b877f9bd2d2c794a21c297aa9e5 diff --git a/sysutils/collectd/options.mk b/sysutils/collectd/options.mk index 7d9f15643c1..3b2e61fc016 100644 --- a/sysutils/collectd/options.mk +++ b/sysutils/collectd/options.mk @@ -1,13 +1,13 @@ -# $NetBSD: options.mk,v 1.8 2016/10/13 15:17:28 fhajny Exp $ +# $NetBSD: options.mk,v 1.9 2017/01/19 17:20:42 he Exp $ PKG_OPTIONS_VAR= PKG_OPTIONS.collectd PKG_SUPPORTED_OPTIONS= cpu df interface load memory syslog uptime PKG_SUGGESTED_OPTIONS+= cpu df interface load memory syslog uptime PKG_SUPPORTED_OPTIONS.NetBSD+= contextswitch disk entropy irq pf netstat_udp -PKG_SUPPORTED_OPTIONS.NetBSD+= swap tcpconns users +PKG_SUPPORTED_OPTIONS.NetBSD+= swap tcpconns users processes PKG_SUGGESTED_OPTIONS.NetBSD+= contextswitch disk entropy irq pf netstat_udp -PKG_SUGGESTED_OPTIONS.NetBSD+= swap tcpconns users +PKG_SUGGESTED_OPTIONS.NetBSD+= swap tcpconns users processes PKG_SUPPORTED_OPTIONS.FreeBSD+= contextswitch pf processes swap tcpconns zfs-arc PKG_SUGGESTED_OPTIONS.FreeBSD+= contextswitch pf processes swap tcpconns zfs-arc diff --git a/sysutils/collectd/patches/patch-src_processes.c b/sysutils/collectd/patches/patch-src_processes.c index 245bcb2e6bc..8c6cac24dc5 100644 --- a/sysutils/collectd/patches/patch-src_processes.c +++ b/sysutils/collectd/patches/patch-src_processes.c @@ -1,8 +1,8 @@ -$NetBSD: patch-src_processes.c,v 1.4 2016/12/07 17:28:39 fhajny Exp $ +$NetBSD: patch-src_processes.c,v 1.5 2017/01/19 17:20:42 he Exp $ Add a port to NetBSD. ---- src/processes.c.orig 2016-11-30 08:52:01.324910450 +0000 +--- src/processes.c.orig 2016-11-30 08:52:01.000000000 +0000 +++ src/processes.c @@ -95,14 +95,14 @@ /* #endif KERNEL_LINUX */ @@ -63,7 +63,7 @@ Add a port to NetBSD. #elif HAVE_PROCINFO_H pagesize = getpagesize(); -@@ -1917,6 +1933,187 @@ static int ps_read(void) { +@@ -1917,6 +1933,191 @@ static int ps_read(void) { ps_submit_proc_list(ps_ptr); /* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */ @@ -166,6 +166,10 @@ Add a port to NetBSD. + pse.cpu_system = 0; + pse.cpu_user_counter = 0; + pse.cpu_system_counter = 0; ++ /* context switch counters not implemented */ ++ pse.cswitch_vol = -1; ++ pse.cswitch_invol = -1; ++ + /* + * The u-area might be swapped out, and we can't get + * at it because we have a crashdump and no swap. diff --git a/sysutils/collectd/patches/patch-src_statsd.c b/sysutils/collectd/patches/patch-src_statsd.c new file mode 100644 index 00000000000..1ce2b17fdc4 --- /dev/null +++ b/sysutils/collectd/patches/patch-src_statsd.c @@ -0,0 +1,19 @@ +$NetBSD: patch-src_statsd.c,v 1.1 2017/01/19 17:20:42 he Exp $ + +Insert workaround for possibly missing nearbyint(). +(Could be more specific, but test would be ... complicated.) + +--- src/statsd.c.orig 2017-01-19 16:24:15.000000000 +0000 ++++ src/statsd.c +@@ -48,6 +48,11 @@ + #define STATSD_DEFAULT_SERVICE "8125" + #endif + ++#ifdef __NetBSD__ ++/* May not have this, could be more specific... */ ++#define nearbyint(v) rint((v)) ++#endif ++ + enum metric_type_e { STATSD_COUNTER, STATSD_TIMER, STATSD_GAUGE, STATSD_SET }; + typedef enum metric_type_e metric_type_t; + diff --git a/sysutils/collectd/patches/patch-src_utils__format__kairosdb.c b/sysutils/collectd/patches/patch-src_utils__format__kairosdb.c index 716ddefc4f4..a1d8eec8233 100644 --- a/sysutils/collectd/patches/patch-src_utils__format__kairosdb.c +++ b/sysutils/collectd/patches/patch-src_utils__format__kairosdb.c @@ -1,4 +1,7 @@ -$NetBSD: patch-src_utils__format__kairosdb.c,v 1.3 2016/12/24 10:16:07 joerg Exp $ +$NetBSD: patch-src_utils__format__kairosdb.c,v 1.4 2017/01/19 17:20:42 he Exp $ + +Cast arguments to isalnum() and tolower() to "unsigned char" to +squelch warnings. --- src/utils_format_kairosdb.c.orig 2016-11-30 08:52:01.000000000 +0000 +++ src/utils_format_kairosdb.c -- cgit v1.2.3