pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ganglia-monitor-core: Testing patches to parallel/ganglia-monitor-core



Module Name:	pkgsrc-wip
Committed By:	Jason Bacon <bacon%NetBSD.org@localhost>
Pushed By:	outpaddling
Date:		Wed Sep 19 16:01:31 2018 -0500
Changeset:	becd29390f1a5b148ffa112c562c3b01f84d4321

Modified Files:
	Makefile
Added Files:
	ganglia-monitor-core/DESCR
	ganglia-monitor-core/Makefile
	ganglia-monitor-core/PLIST
	ganglia-monitor-core/distinfo
	ganglia-monitor-core/files/gmetad.sh
	ganglia-monitor-core/files/gmond.sh
	ganglia-monitor-core/files/smf/manifest.xml
	ganglia-monitor-core/patches/patch-ac
	ganglia-monitor-core/patches/patch-configure
	ganglia-monitor-core/patches/patch-gmetad_conf.c.in
	ganglia-monitor-core/patches/patch-gmetad_data__thread.c
	ganglia-monitor-core/patches/patch-gmetad_rrd__helpers.c
	ganglia-monitor-core/patches/patch-gmond_gmond.conf.5
	ganglia-monitor-core/patches/patch-gmond_modules_conf.d_modpython.conf.in
	ganglia-monitor-core/patches/patch-lib__gm_protocol_dr.c
	ganglia-monitor-core/patches/patch-lib__update_pidfile.c
	ganglia-monitor-core/patches/patch-lib_default__conf.h.in
	ganglia-monitor-core/patches/patch-libmetrics__solaris__metrics.c
	ganglia-monitor-core/patches/patch-libmetrics_freebsd_metrics.c

Log Message:
ganglia-monitor-core: Testing patches to parallel/ganglia-monitor-core

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=becd29390f1a5b148ffa112c562c3b01f84d4321

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |   1 +
 ganglia-monitor-core/DESCR                         |  17 ++
 ganglia-monitor-core/Makefile                      |  99 +++++++++
 ganglia-monitor-core/PLIST                         |  34 ++++
 ganglia-monitor-core/distinfo                      |  18 ++
 ganglia-monitor-core/files/gmetad.sh               |  45 ++++
 ganglia-monitor-core/files/gmond.sh                |  42 ++++
 ganglia-monitor-core/files/smf/manifest.xml        |  41 ++++
 ganglia-monitor-core/patches/patch-ac              | 226 +++++++++++++++++++++
 ganglia-monitor-core/patches/patch-configure       |  89 ++++++++
 .../patches/patch-gmetad_conf.c.in                 |  15 ++
 .../patches/patch-gmetad_data__thread.c            |  15 ++
 .../patches/patch-gmetad_rrd__helpers.c            |  16 ++
 .../patches/patch-gmond_gmond.conf.5               |  21 ++
 .../patch-gmond_modules_conf.d_modpython.conf.in   |  17 ++
 .../patches/patch-lib__gm_protocol_dr.c            |  31 +++
 .../patches/patch-lib__update_pidfile.c            |  15 ++
 .../patches/patch-lib_default__conf.h.in           |  15 ++
 .../patches/patch-libmetrics__solaris__metrics.c   |  15 ++
 .../patches/patch-libmetrics_freebsd_metrics.c     |  24 +++
 20 files changed, 796 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index f0447efafc..e3e76f47f6 100644
--- a/Makefile
+++ b/Makefile
@@ -967,6 +967,7 @@ SUBDIR+=	gambas3-runtime
 SUBDIR+=	gambas3-scripter
 SUBDIR+=	gambatte-dev
 SUBDIR+=	gambit
+SUBDIR+=	ganglia-monitor-core
 SUBDIR+=	ganglia-webfrontend
 SUBDIR+=	gappa
 SUBDIR+=	garden
diff --git a/ganglia-monitor-core/DESCR b/ganglia-monitor-core/DESCR
new file mode 100644
index 0000000000..d09a98dd1f
--- /dev/null
+++ b/ganglia-monitor-core/DESCR
@@ -0,0 +1,17 @@
+Ganglia is a scalable distributed monitoring system for high-performance
+computing systems such as clusters and Grids. It is based on a hierarchical
+design targeted at federations of clusters. It relies on a multicast-based
+listen/announce protocol to monitor state within clusters and uses a tree of
+point-to-point connections amongst representative cluster nodes to federate
+clusters and aggregate their state. It leverages widely used technologies such
+as XML for data representation, XDR for compact, portable data transport, and
+RRDtool for data storage and visualization. It uses carefully engineered data
+structures and algorithms to achieve very low per-node overheads and high
+concurrency. The implementation is robust, has been ported to an extensive set
+of operating systems and processor architectures, and is currently in use on
+over 500 clusters around the world. It has been used to link clusters across
+university campuses and around the world and can scale to handle clusters with
+2000 nodes.
+
+You may wish to install www/ganglia-webfrontend to monitor your systems via
+the web.
diff --git a/ganglia-monitor-core/Makefile b/ganglia-monitor-core/Makefile
new file mode 100644
index 0000000000..0a26162f1c
--- /dev/null
+++ b/ganglia-monitor-core/Makefile
@@ -0,0 +1,99 @@
+# $NetBSD: Makefile,v 1.58 2018/04/16 14:35:04 wiz Exp $
+#
+
+DISTNAME=		ganglia-3.7.2
+PKGNAME=		ganglia-monitor-core-3.7.2
+PKGREVISION=		4
+CATEGORIES=		net parallel
+MASTER_SITES=		${MASTER_SITE_SOURCEFORGE:=ganglia/}
+
+MAINTAINER=		pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=		http://ganglia.sourceforge.net/
+COMMENT=		Ganglia cluster monitor, monitoring daemon
+LICENSE=		modified-bsd
+
+GNU_CONFIGURE=		yes
+SET_LIBDIR=		yes
+
+USE_LIBTOOL=		yes
+USE_LANGUAGES=		c c99
+USE_TOOLS+=		pkg-config
+
+PLIST_VARS+=		python
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.ganglia
+PKG_SUPPORTED_OPTIONS=	python		# Gmond support for python modules
+
+.include "../../mk/bsd.prefs.mk"
+
+CONFIGURE_ARGS+=	--with-gmetad
+CONFIGURE_ARGS+=	--enable-setuid=${GANGLIA_USER}
+CONFIGURE_ARGS+=	--enable-setgid=${GANGLIA_GROUP}
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mpython)
+CONFIGURE_ARGS+=	--with-python=${PYTHONBIN}
+PLIST.python=		yes
+CONF_FILES+=		${EGDIR}/conf.d/modpython.conf \
+			${PKG_SYSCONFDIR}/gmond.conf.d/modpython.conf
+.include "../../lang/python/application.mk"
+.else
+CONFIGURE_ARGS+=	--disable-python
+.endif
+
+GANGLIA_USER?=			ganglia
+GANGLIA_GROUP?=			${GANGLIA_USER}
+GANGLIA_VARBASE?=		${VARBASE}/db
+
+PKG_GROUPS+=			${GANGLIA_GROUP}
+PKG_USERS+=			${GANGLIA_USER}:${GANGLIA_GROUP}
+PKG_GECOS.${GANGLIA_USER}=	Ganglia daemon user
+PKG_HOME.${GANGLIA_USER}=	${GANGLIA_VARBASE}/ganglia
+
+OWN_DIRS_PERMS+=		${GANGLIA_VARBASE}/ganglia ${GANGLIA_USER} ${GANGLIA_GROUP} 0755
+OWN_DIRS_PERMS+=		${GANGLIA_VARBASE}/ganglia/rrds ${GANGLIA_USER} ${GANGLIA_GROUP} 0755
+
+INSTALL_MAKE_FLAGS+=	sysconfdir=${EGDIR}
+
+SUBST_CLASSES+=		paths
+SUBST_STAGE.paths=	pre-configure
+SUBST_MESSAGE.paths=	Fixing default paths
+SUBST_FILES.paths=	configure ganglia.html			\
+			gmetad/cmdline.c gmetad/cmdline.h	\
+			gmetric/cmdline.c gmetric/cmdline.h	\
+			gmond/cmdline.c gmond/cmdline.h		\
+			gmond/g25_config.h gmond/gmond.conf.5	\
+			gmond/modules/conf.d/modpython.conf	\
+			gmond/modules/conf.d/modpython.conf.in	\
+			gmond/modules/python/README.in		\
+			mans/gmetad.1 mans/gmetric.1 mans/gmond.1
+SUBST_SED.paths+=	-e 's,/etc/ganglia,${PKG_SYSCONFDIR},g'
+SUBST_SED.paths+=	-e 's,/usr/lib/ganglia,${PREFIX}/lib/ganglia,g'
+SUBST_VARS.paths+=	GANGLIA_VARBASE
+
+FILES_SUBST+=		GANGLIA_VARBASE=${GANGLIA_VARBASE}
+
+DOCDIR=			${PREFIX}/share/doc/ganglia
+EGDIR=			${PREFIX}/share/examples/ganglia
+CONF_FILES=		${EGDIR}/gmond.conf ${PKG_SYSCONFDIR}/gmond.conf
+CONF_FILES+=		${EGDIR}/gmetad.conf ${PKG_SYSCONFDIR}/gmetad.conf
+
+RCD_SCRIPTS=		gmond gmetad
+SMF_NAME=		ganglia
+SMF_INSTANCES=		${RCD_SCRIPTS}
+
+INSTALLATION_DIRS=	${DOCDIR} ${EGDIR} ${PKGMANDIR}/man1 ${PKGMANDIR}/man5
+
+post-install:
+	${WRKSRC}/gmond/gmond -t > ${DESTDIR}${EGDIR}/gmond.conf
+	${INSTALL_DATA} ${WRKSRC}/gmond/modules/python/README ${DESTDIR}${DOCDIR}/
+
+.include "../../databases/rrdtool/buildlink3.mk"
+.include "../../devel/apr/buildlink3.mk"
+.include "../../devel/confuse/buildlink3.mk"
+.include "../../devel/pcre/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../textproc/expat/buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/ganglia-monitor-core/PLIST b/ganglia-monitor-core/PLIST
new file mode 100644
index 0000000000..c99b06287d
--- /dev/null
+++ b/ganglia-monitor-core/PLIST
@@ -0,0 +1,34 @@
+@comment $NetBSD: PLIST,v 1.8 2018/01/01 22:29:51 rillig Exp $
+bin/ganglia-config
+bin/gmetric
+bin/gstat
+include/ganglia.h
+include/ganglia_gexec.h
+include/gm_file.h
+include/gm_metric.h
+include/gm_mmn.h
+include/gm_msg.h
+include/gm_protocol.h
+include/gm_value.h
+lib/ganglia/modcpu.so
+lib/ganglia/moddisk.so
+lib/ganglia/modload.so
+lib/ganglia/modmem.so
+lib/ganglia/modmulticpu.so
+lib/ganglia/modnet.so
+lib/ganglia/modproc.so
+${PLIST.python}lib/ganglia/modpython.so
+lib/ganglia/modsys.so
+lib/libganglia.la
+man/man1/gmetad.1
+man/man1/gmetad.py.1
+man/man1/gmetric.1
+man/man1/gmond.1
+man/man1/gstat.1
+man/man5/gmond.conf.5
+sbin/gmetad
+sbin/gmond
+share/doc/ganglia/README
+${PLIST.python}share/examples/ganglia/conf.d/modpython.conf
+share/examples/ganglia/gmetad.conf
+share/examples/ganglia/gmond.conf
diff --git a/ganglia-monitor-core/distinfo b/ganglia-monitor-core/distinfo
new file mode 100644
index 0000000000..3ccc07e0f5
--- /dev/null
+++ b/ganglia-monitor-core/distinfo
@@ -0,0 +1,18 @@
+$NetBSD: distinfo,v 1.15 2017/06/30 00:52:44 kamil Exp $
+
+SHA1 (ganglia-3.7.2.tar.gz) = 5ea23da8e5b85da53216dd7c742c8154e7aa576e
+RMD160 (ganglia-3.7.2.tar.gz) = 9b5c48bcf2aa489caea689713dabb12804d9cee2
+SHA512 (ganglia-3.7.2.tar.gz) = a88955e59421a447e5752a9bfe5f599d989a7a5a0141141ab3601d1ab250be4eebbede8bcef8baa151b2f9deaf3f56e30aef8ea709f3cc820a79fa3d3961e0df
+Size (ganglia-3.7.2.tar.gz) = 1302320 bytes
+SHA1 (patch-ac) = 09a96c391f185ddd5f7a64a8b030f38c36ffbc76
+SHA1 (patch-configure) = d8f096263a8b2f04e30d4a053b4636ac5d1cd95f
+SHA1 (patch-gmetad_conf.c.in) = 75aa2d0c5d8af8a2864f7225444f1f263df4a60b
+SHA1 (patch-gmetad_data__thread.c) = f35bfe050495d106e1db74b663df12ed88f7afe6
+SHA1 (patch-gmetad_rrd__helpers.c) = e1afe61311b0df96f633983e673652b32a1938f4
+SHA1 (patch-gmond_gmond.conf.5) = dfabfee6fb26cd5a384c1baed48fe631b957cf5b
+SHA1 (patch-gmond_modules_conf.d_modpython.conf.in) = 5b0d79efb34dae2f46dd911509759e8d75b4af96
+SHA1 (patch-lib__gm_protocol_dr.c) = 9d17d79bb1a6426a2547c00006819483aff47363
+SHA1 (patch-lib__update_pidfile.c) = a8ed4fbeabf5d46a523c5cd3b891e5752d74187b
+SHA1 (patch-lib_default__conf.h.in) = 70dbcbc39226369c9fb4f59240b8568854ac4e87
+SHA1 (patch-libmetrics__solaris__metrics.c) = 2b6ad945ed7eafa05fe4c24a535b00deba46173d
+SHA1 (patch-libmetrics_freebsd_metrics.c) = acb3485a603c13fd4a9f7d7af621988f777ede6e
diff --git a/ganglia-monitor-core/files/gmetad.sh b/ganglia-monitor-core/files/gmetad.sh
new file mode 100644
index 0000000000..edb9df2b2d
--- /dev/null
+++ b/ganglia-monitor-core/files/gmetad.sh
@@ -0,0 +1,45 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: gmetad.sh,v 1.1 2007/09/16 10:29:53 joerg Exp $
+#
+# PROVIDE: gmetad
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# You will need to set some variables in /etc/rc.conf to start gmetad:
+#
+# gmetad=YES
+
+if [ -f /etc/rc.subr ]
+then
+	. /etc/rc.subr
+fi
+
+name="gmetad"
+rcvar=$name
+command="@PREFIX@/sbin/gmetad"
+required_files="@PKG_SYSCONFDIR@/gmetad.conf"
+start_cmd="gmetad_start"
+stop_cmd="gmetad_stop"
+restart_cmd="gmetad_stop ; gmetad_start"
+
+gmetad_start ()
+{
+	# gmetad/process_xml.c 1060 re-releases a lock, claiming it's 
+	# ``required under certain errors''
+	export PTHREAD_DIAGASSERT=A
+	${command}
+}
+
+gmetad_stop()
+{
+	pkill ${name} 2>/dev/null
+}
+
+if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]
+then
+	load_rc_config $name
+	run_rc_command "$1"
+else
+	eval ${start_cmd}
+fi
diff --git a/ganglia-monitor-core/files/gmond.sh b/ganglia-monitor-core/files/gmond.sh
new file mode 100644
index 0000000000..c3bbfff489
--- /dev/null
+++ b/ganglia-monitor-core/files/gmond.sh
@@ -0,0 +1,42 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: gmond.sh,v 1.1 2007/09/16 10:29:53 joerg Exp $
+#
+# PROVIDE: gmond
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# You will need to set some variables in /etc/rc.conf to start gmond:
+#
+# gmond=YES
+
+if [ -f /etc/rc.subr ]
+then
+	. /etc/rc.subr
+fi
+
+name="gmond"
+rcvar=$name
+command="@PREFIX@/sbin/gmond"
+required_files="@PKG_SYSCONFDIR@/gmond.conf"
+start_cmd="gmond_start"
+stop_cmd="gmond_stop"
+restart_cmd="gmond_stop ; gmond_start"
+
+gmond_start ()
+{
+	${command}
+}
+
+gmond_stop()
+{
+	pkill ${name} 2>/dev/null
+}
+
+if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]
+then
+	load_rc_config $name
+	run_rc_command "$1"
+else
+	eval ${start_cmd}
+fi
diff --git a/ganglia-monitor-core/files/smf/manifest.xml b/ganglia-monitor-core/files/smf/manifest.xml
new file mode 100644
index 0000000000..5c78e3139a
--- /dev/null
+++ b/ganglia-monitor-core/files/smf/manifest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<service_bundle type="manifest" name="export">
+  <service name="@SMF_PREFIX@/ganglia" type="service" version="1">
+    <dependency name="network" grouping="require_all" restart_on="error" type="service">
+      <service_fmri value="svc:/milestone/network:default" />
+    </dependency>
+    <dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
+      <service_fmri value="svc:/system/filesystem/local" />
+    </dependency>
+    <method_context working_directory="@GANGLIA_VARBASE@/ganglia" />
+    <property_group name="startd" type="framework">
+      <propval name="duration" type="astring" value="contract" />
+      <propval name="ignore_error" type="astring" value="core,signal" />
+    </property_group>
+    <instance name="gmetad" enabled="false">
+      <exec_method type="method" name="start" exec="@PREFIX@/sbin/gmetad" timeout_seconds="60" />
+      <exec_method type="method" name="stop" exec=":kill" timeout_seconds="60" />
+      <property_group name="application" type="application">
+        <propval name="config_file" type="astring" value="@PKG_SYSCONFDIR@/gmetad.conf" />
+      </property_group>
+      <template>
+        <common_name>
+          <loctext xml:lang="C">Ganglia Meta Daemon</loctext>
+        </common_name>
+      </template>
+    </instance>
+    <instance name="gmond" enabled="false">
+      <exec_method type="method" name="start" exec="@PREFIX@/sbin/gmond" timeout_seconds="60" />
+      <exec_method type="method" name="stop" exec=":kill" timeout_seconds="60" />
+      <property_group name="application" type="application">
+        <propval name="config_file" type="astring" value="@PKG_SYSCONFDIR@/gmond.conf" />
+      </property_group>
+      <template>
+        <common_name>
+          <loctext xml:lang="C">Ganglia Monitoring Daemon</loctext>
+        </common_name>
+      </template>
+    </instance>
+  </service>
+</service_bundle>
diff --git a/ganglia-monitor-core/patches/patch-ac b/ganglia-monitor-core/patches/patch-ac
new file mode 100644
index 0000000000..930b6e4cd2
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-ac
@@ -0,0 +1,226 @@
+$NetBSD: patch-ac,v 1.7 2017/06/30 00:52:44 kamil Exp $
+
+First chunk: update sysctl name for changes in NetBSD.
+
+Rest:
+From Manuel Tobias Schiller <mala%hinterbergen.de@localhost>:
+I managed to trace things to the file libmetrics/netbsd/metrics.c in
+the get_netbw function. Apparently, the code in get_netbw violates
+alignment constraints for sparc64. I attached a patch against the result
+of a "make patch" in parallel/ganglia-monitor-core. While I was at it, I
+also changed proc_run_func somewhat to only count actually running
+processes (having a look at NetBSD's ps(1) implementation) - without the
+change, I got around 30 running processes on an idle machine.
+
+--- libmetrics/netbsd/metrics.c.orig	2015-07-01 19:49:35.000000000 +0000
++++ libmetrics/netbsd/metrics.c
+@@ -9,10 +9,15 @@
+  *  Tested on NetBSD 2.0.2 (i386)
+  */
+ 
++#define _KMEMUSER
++
+ #include <kvm.h>
+ 
+ #include <sys/param.h> 
++#include <sys/proc.h>
+ #include <sys/mount.h>
++#include <sys/vmmeter.h>
++#include <uvm/uvm_extern.h>
+ #if __NetBSD_Version__ > 299000000
+ #include <sys/statvfs.h>
+ #define statfs statvfs
+@@ -21,7 +26,6 @@
+ #endif
+ #include <sys/sysctl.h>
+ #include <sys/time.h>
+-#include <sys/user.h>
+ #include <sys/resource.h>
+ #include <sys/sched.h>
+ #include <sys/stat.h>
+@@ -134,7 +138,10 @@ cpu_speed_func ( void )
+ 
+    cpu_speed = 0;
+ 
+-#if (__NetBSD_Version__ > 299000000)
++#if (__NetBSD_Version__ > 500000000)
++   if (sysctlbyname("machdep.tsc_freq", &cpu_speed, &len, NULL, 0) == -1)
++      val.uint32 = 0;
++#elif (__NetBSD_Version__ > 299000000)
+    if (sysctlbyname("machdep.est.frequency.target", &cpu_speed, &len, NULL, 0) == -1)
+       val.uint32 = 0;
+ #endif
+@@ -559,49 +566,56 @@ proc_total_func ( void )
+ g_val_t
+ proc_run_func( void )
+ {
+-   struct kinfo_proc *kp;
+-   int i;
+-   int state;
+-   int nentries;
+-   int what = KERN_PROC_ALL;
+    g_val_t val;
++   struct kinfo_proc2 *kp;
++   int cnt, i, j;
++   unsigned int count = 0;
+ 
+    val.uint32 = 0;
+ 
+    if (kd == NULL)
+       goto output;
+-#ifdef KERN_PROC_NOTHREADS
+-   what |= KERN_PROC_NOTHREADS
+-#endif
+-   if ((kp = kvm_getprocs(kd, what, 0, &nentries)) == 0 || nentries < 0)
++   kp = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &cnt);
++   if (0 == kp || cnt < 0)
+       goto output;
+-
+-   for (i = 0; i < nentries; kp++, i++) {
+-#ifdef KINFO_PROC_SIZE
+-      state = kp->ki_stat;
+-#else
+-      state = kp->kp_proc.p_stat;
+-#endif
+-      switch(state) {
+-#if (__NetBSD_Version__ >= 200000000)
+-         case SACTIVE:
+-#else
+-         case SRUN:
+-         case SONPROC:
+-#endif
+-         case SIDL:
+-            val.uint32++;
+-            break;
++   for (i = 0; i < cnt; i++) {
++      struct kinfo_lwp* kl;
++      int nlwps;
++      if (((kp + i) -> p_realstat != SACTIVE))
++	      continue;
++      kl = kvm_getlwps(kd, (kp + i)->p_pid, (kp + i)->p_paddr,
++	      sizeof(struct kinfo_lwp), &nlwps);
++      if (kl == 0)
++	  nlwps = 0;
++      if (0 == nlwps) count ++;
++      else {
++	  for (j = 0; j < nlwps; j++) {
++	      switch (kl[j].l_stat) {
++		  case LSRUN:
++		      ++count;
++		      break;
++	      }
++	  }
+       }
+    }
+ 
+-   if (val.uint32 > 0)
+-      val.uint32--;
++   val.uint32 = count;
+ 
+ output:
+    return val;
+ }
+ 
++/*
++** FIXME - This metric is not valid on NetBSD
++*/
++g_val_t
++cpu_steal_func ( void )
++{
++	static g_val_t val;
++	val.f = 0.0;
++	return val;
++}
++
+ g_val_t
+ mem_free_func ( void )
+ {
+@@ -1135,36 +1149,41 @@ get_netbw(double *in_bytes, double *out_
+ 
+ 	next = buf;
+ 	while (next < lim) {
++		struct if_msghdr tmp;
+ 
+ 		ifm = (struct if_msghdr *)next;
+-		
+-		if (ifm->ifm_type == RTM_IFINFO) {
++	 	memcpy(&tmp, ifm, sizeof(tmp));
++	
++		if (tmp.ifm_type == RTM_IFINFO) {
+ 			sdl = (struct sockaddr_dl *)(ifm + 1);
+ 		} else {
+ 			fprintf(stderr, "out of sync parsing NET_RT_IFLIST\n");
+ 			fprintf(stderr, "expected %d, got %d\n", RTM_IFINFO,
+-				ifm->ifm_type);
+-			fprintf(stderr, "msglen = %d\n", ifm->ifm_msglen);
++				tmp.ifm_type);
++			fprintf(stderr, "msglen = %d\n", tmp.ifm_msglen);
+ 			fprintf(stderr, "buf:%p, next:%p, lim:%p\n", buf, next,
+ 				lim);
+ 			goto output;
+ 		}
+ 
+-		next += ifm->ifm_msglen;
++		next += tmp.ifm_msglen;
+ 		while (next < lim) {
++			unsigned short msglen;
+ 			nextifm = (struct if_msghdr *)next;
+ 
+ 			if (nextifm->ifm_type != RTM_NEWADDR)
+ 				break;
+ 
+-			next += nextifm->ifm_msglen;
++                        memcpy(&msglen, &nextifm->ifm_msglen,
++                                        sizeof(nextifm->ifm_msglen));
++                        next += msglen;
+ 		}
+ 
+-		if ((ifm->ifm_flags & IFF_LOOPBACK) || 
+-		    !(ifm->ifm_flags & IFF_UP))
++		if ((tmp.ifm_flags & IFF_LOOPBACK) || 
++		    !(tmp.ifm_flags & IFF_UP))
+ 			continue;
+ 
+-		index = ifm->ifm_index;
++		index = tmp.ifm_index;
+ 
+ 		/* If we don't have a previous value yet, make a slot. */
+ 		if (index >= indexes) {
+@@ -1187,25 +1206,25 @@ get_netbw(double *in_bytes, double *out_
+ 		 */
+ 		if (!seen[index]) {
+ 			seen[index] = 1;
+-			lastcount[index].in_bytes = ifm->ifm_data.ifi_ibytes;
+-			lastcount[index].out_bytes = ifm->ifm_data.ifi_obytes;
+-			lastcount[index].in_pkts = ifm->ifm_data.ifi_ipackets;
+-			lastcount[index].out_pkts = ifm->ifm_data.ifi_opackets;
++			lastcount[index].in_bytes = tmp.ifm_data.ifi_ibytes;
++			lastcount[index].out_bytes = tmp.ifm_data.ifi_obytes;
++			lastcount[index].in_pkts = tmp.ifm_data.ifi_ipackets;
++			lastcount[index].out_pkts = tmp.ifm_data.ifi_opackets;
+ 		}
+ 
+ 		traffic.in_bytes = counterdiff(lastcount[index].in_bytes,
+-		    ifm->ifm_data.ifi_ibytes, ULONG_MAX, 0);
++		    tmp.ifm_data.ifi_ibytes, ULONG_MAX, 0);
+ 		traffic.out_bytes = counterdiff(lastcount[index].out_bytes,
+-		    ifm->ifm_data.ifi_obytes, ULONG_MAX, 0);
++		    tmp.ifm_data.ifi_obytes, ULONG_MAX, 0);
+ 		traffic.in_pkts = counterdiff(lastcount[index].in_pkts,
+-		    ifm->ifm_data.ifi_ipackets, ULONG_MAX, 0);
++		    tmp.ifm_data.ifi_ipackets, ULONG_MAX, 0);
+ 		traffic.out_pkts = counterdiff(lastcount[index].out_pkts,
+-		    ifm->ifm_data.ifi_opackets, ULONG_MAX, 0);
++		    tmp.ifm_data.ifi_opackets, ULONG_MAX, 0);
+ 
+-		lastcount[index].in_bytes = ifm->ifm_data.ifi_ibytes;
+-		lastcount[index].out_bytes = ifm->ifm_data.ifi_obytes;
+-		lastcount[index].in_pkts = ifm->ifm_data.ifi_ipackets;
+-		lastcount[index].out_pkts = ifm->ifm_data.ifi_opackets;
++		lastcount[index].in_bytes = tmp.ifm_data.ifi_ibytes;
++		lastcount[index].out_bytes = tmp.ifm_data.ifi_obytes;
++		lastcount[index].in_pkts = tmp.ifm_data.ifi_ipackets;
++		lastcount[index].out_pkts = tmp.ifm_data.ifi_opackets;
+ 
+ #ifdef NETBW_DEBUG
+ 		if_indextoname(index, name);
diff --git a/ganglia-monitor-core/patches/patch-configure b/ganglia-monitor-core/patches/patch-configure
new file mode 100644
index 0000000000..128f93c688
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-configure
@@ -0,0 +1,89 @@
+$NetBSD: patch-configure,v 1.1 2016/02/16 12:48:18 fhajny Exp $
+
+- Portability.
+- Make local storage dir consistent.
+- Fix C99 handling on SunOS.
+
+--- configure.orig	2015-07-01 19:49:35.000000000 +0000
++++ configure
+@@ -12844,7 +12844,7 @@ if test "${with_memcached+set}" = set; t
+ fi
+ 
+ 
+-if test x"$memcache" == xyes; then
++if test x"$memcache" = xyes; then
+ 
+ pkg_failed=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DEPS" >&5
+@@ -12948,7 +12948,7 @@ if test "${with_riemann+set}" = set; the
+ fi
+ 
+ 
+-if test x"$with_riemann" == xyes; then
++if test x"$with_riemann" = xyes; then
+ echo
+ echo Checking for Protocol Buffers
+ 
+@@ -13368,7 +13368,7 @@ if test x"$libpcrepath" != x && test x"$
+   echo "Added -I$libpcrepath/include to CFLAGS"
+   echo "Added -L$libpcrepath/${LIB_SUFFIX} to LDFLAGS"
+ fi
+-if test x"$libpcre" == xyes ; then
++if test x"$libpcre" = xyes ; then
+   for ac_header in pcre/pcre.h pcre.h
+ do :
+   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+@@ -15779,7 +15779,7 @@ fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ 
+ 
+-varstatedir="/var/lib"
++varstatedir="@GANGLIA_VARBASE@"
+ 
+ # Used when static linking requested
+ EXPORT_SYMBOLS="-export-dynamic"
+@@ -15901,11 +15901,7 @@ $as_echo "#define DARWIN 1" >>confdefs.h
+ $as_echo "#define SUPPORT_GEXEC 0" >>confdefs.h
+ 
+ 		CFLAGS="$CFLAGS -D__EXTENSIONS__ -DHAVE_STRERROR"
+-		if test x"$ac_cv_prog_cc_c99" = x -o x"$ac_cv_prog_cc_c99" = xno; then
+-		   CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199506L"
+-		else
+-		   CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L"
+-		fi
++		CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L"
+ 		if test x"$ac_cv_c_compiler_gnu" != xyes; then
+ 		   LIBS="-lm $LIBS"
+ 		fi
+@@ -15917,7 +15913,6 @@ $as_echo "#define SOLARIS 1" >>confdefs.
+ 
+ $as_echo "#define SUPPORT_GEXEC 0" >>confdefs.h
+ 
+-		varstatedir="/var/db"
+ 		osreldate=`awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $3 }' /usr/include/osreldate.h`
+ 		if test $osreldate -lt 502102; then
+ 		   CFLAGS="-pthread $CFLAGS -D_REENTRANT"
+@@ -15930,7 +15925,6 @@ $as_echo "#define FREEBSD 1" >>confdefs.
+ 
+ $as_echo "#define SUPPORT_GEXEC 0" >>confdefs.h
+ 
+-		varstatedir="/var/db"
+ 
+ $as_echo "#define DRAGONFLYBSD 1" >>confdefs.h
+ 
+@@ -15938,7 +15932,6 @@ $as_echo "#define DRAGONFLYBSD 1" >>conf
+ *netbsd*)
+ $as_echo "#define SUPPORT_GEXEC 0" >>confdefs.h
+ 
+-		varstatedir="/var/db"
+ 
+ $as_echo "#define NETBSD 1" >>confdefs.h
+ 
+@@ -15946,7 +15939,6 @@ $as_echo "#define NETBSD 1" >>confdefs.h
+ *openbsd*)
+ $as_echo "#define SUPPORT_GEXEC 0" >>confdefs.h
+ 
+-		varstatedir="/var/db"
+ 
+ $as_echo "#define OPENBSD 1" >>confdefs.h
+ 
diff --git a/ganglia-monitor-core/patches/patch-gmetad_conf.c.in b/ganglia-monitor-core/patches/patch-gmetad_conf.c.in
new file mode 100644
index 0000000000..7575858361
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-gmetad_conf.c.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-gmetad_conf.c.in,v 1.1 2016/02/16 12:48:18 fhajny Exp $
+
+Use setuid user from configure.
+
+--- gmetad/conf.c.in.orig	2015-07-01 19:49:35.000000000 +0000
++++ gmetad/conf.c.in
+@@ -475,7 +475,7 @@ set_defaults (gmetad_config_t *config)
+    config->trusted_hosts = NULL;
+    config->debug_level = 0;
+    config->should_setuid = 1;
+-   config->setuid_username = "nobody";
++   config->setuid_username = SETUID_USER;
+    config->rrd_rootdir = "@varstatedir@/ganglia/rrds";
+    config->rrdcached_addrstr = NULL;
+    memset(&config->rrdcached_address, 0, sizeof (config->rrdcached_address));
diff --git a/ganglia-monitor-core/patches/patch-gmetad_data__thread.c b/ganglia-monitor-core/patches/patch-gmetad_data__thread.c
new file mode 100644
index 0000000000..10e682d37d
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-gmetad_data__thread.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+# Portability
+--- gmetad/data_thread.c.orig	2015-07-01 19:49:35.000000000 +0000
++++ gmetad/data_thread.c
+@@ -1,6 +1,9 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#ifndef __linux__
++#include <sys/filio.h>
++#endif
+ #include <sys/ioctl.h>
+ #include <sys/poll.h>
+ #include <sys/time.h>
diff --git a/ganglia-monitor-core/patches/patch-gmetad_rrd__helpers.c b/ganglia-monitor-core/patches/patch-gmetad_rrd__helpers.c
new file mode 100644
index 0000000000..5f60b1ce7e
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-gmetad_rrd__helpers.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+# Portability
+
+--- gmetad/rrd_helpers.c.orig	2015-07-01 19:49:35.000000000 +0000
++++ gmetad/rrd_helpers.c
+@@ -2,6 +2,9 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#ifndef __linux__
++#include <sys/filio.h>
++#endif
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
diff --git a/ganglia-monitor-core/patches/patch-gmond_gmond.conf.5 b/ganglia-monitor-core/patches/patch-gmond_gmond.conf.5
new file mode 100644
index 0000000000..dfdc574a7c
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-gmond_gmond.conf.5
@@ -0,0 +1,21 @@
+$NetBSD: patch-gmond_gmond.conf.5,v 1.1 2016/02/16 12:48:18 fhajny Exp $
+
+Default paths.
+
+--- gmond/gmond.conf.5.orig	2015-07-01 19:49:35.000000000 +0000
++++ gmond/gmond.conf.5
+@@ -718,12 +718,12 @@ to be garbled.)
+ This directive allows the user to include additional configuration files
+ rather than having to add all gmond configuration directives to the
+ gmond.conf file.  The following example includes any file with the extension
+-of .conf contained in the directory conf.d as if the contents of the included 
++of .conf contained in the directory gmond.conf.d as if the contents of the included 
+ configuration files were part of the original gmond.conf file. This allows 
+ the user to modularize their configuration file.  One usage example might 
+ be to load individual metric modules by including module specific .conf files.
+ .PP
+-include ('/etc/ganglia/conf.d/*.conf')
++include ('/etc/ganglia/gmond.conf.d/*.conf')
+ .SH "ACCESS CONTROL"
+ .IX Header "ACCESS CONTROL"
+ The \fBudp_recv_channel\fR and \fBtcp_accept_channel\fR directives
diff --git a/ganglia-monitor-core/patches/patch-gmond_modules_conf.d_modpython.conf.in b/ganglia-monitor-core/patches/patch-gmond_modules_conf.d_modpython.conf.in
new file mode 100644
index 0000000000..1a08fa83d1
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-gmond_modules_conf.d_modpython.conf.in
@@ -0,0 +1,17 @@
+$NetBSD: patch-gmond_modules_conf.d_modpython.conf.in,v 1.1 2016/02/16 12:48:18 fhajny Exp $
+
+Default paths.
+
+--- gmond/modules/conf.d/modpython.conf.in.orig	2015-07-01 19:49:35.000000000 +0000
++++ gmond/modules/conf.d/modpython.conf.in
+@@ -9,8 +9,8 @@ modules {
+   module {
+     name = "python_module"
+     path = "modpython.so"
+-    params = "@moduledir@/python_modules"
++    params = "@moduledir@"
+   }
+ }
+ 
+-include ("@sysconfdir@/conf.d/*.pyconf")
++include ("@sysconfdir@/gmond.conf.d/*.pyconf")
diff --git a/ganglia-monitor-core/patches/patch-lib__gm_protocol_dr.c b/ganglia-monitor-core/patches/patch-lib__gm_protocol_dr.c
new file mode 100644
index 0000000000..8bdba1e467
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-lib__gm_protocol_dr.c
@@ -0,0 +1,31 @@
+$NetBSD: patch-lib__gm_protocol_dr.c,v 1.1 2012/03/13 12:36:25 fhajny Exp $
+
+Use INT32 macros, LONG ones were taken out of LP64 on Solaris.
+--- lib/gm_protocol_xdr.c.orig	2009-01-28 23:23:20.000000000 +0000
++++ lib/gm_protocol_xdr.c
+@@ -53,9 +53,9 @@ xdr_Ganglia_metadata_message (XDR *xdrs,
+ 				 return FALSE;
+ 
+ 		} else {
+-		IXDR_PUT_U_LONG(buf, objp->slope);
+-		IXDR_PUT_U_LONG(buf, objp->tmax);
+-		IXDR_PUT_U_LONG(buf, objp->dmax);
++		IXDR_PUT_U_INT32(buf, objp->slope);
++		IXDR_PUT_U_INT32(buf, objp->tmax);
++		IXDR_PUT_U_INT32(buf, objp->dmax);
+ 		}
+ 		 if (!xdr_array (xdrs, (char **)&objp->metadata.metadata_val, (u_int *) &objp->metadata.metadata_len, ~0,
+ 			sizeof (Ganglia_extra_data), (xdrproc_t) xdr_Ganglia_extra_data))
+@@ -78,9 +78,9 @@ xdr_Ganglia_metadata_message (XDR *xdrs,
+ 				 return FALSE;
+ 
+ 		} else {
+-		objp->slope = IXDR_GET_U_LONG(buf);
+-		objp->tmax = IXDR_GET_U_LONG(buf);
+-		objp->dmax = IXDR_GET_U_LONG(buf);
++		objp->slope = IXDR_GET_U_INT32(buf);
++		objp->tmax = IXDR_GET_U_INT32(buf);
++		objp->dmax = IXDR_GET_U_INT32(buf);
+ 		}
+ 		 if (!xdr_array (xdrs, (char **)&objp->metadata.metadata_val, (u_int *) &objp->metadata.metadata_len, ~0,
+ 			sizeof (Ganglia_extra_data), (xdrproc_t) xdr_Ganglia_extra_data))
diff --git a/ganglia-monitor-core/patches/patch-lib__update_pidfile.c b/ganglia-monitor-core/patches/patch-lib__update_pidfile.c
new file mode 100644
index 0000000000..3461309666
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-lib__update_pidfile.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-lib__update_pidfile.c,v 1.1 2016/02/16 12:48:18 fhajny Exp $
+
+Portability.
+
+--- lib/update_pidfile.c.orig	2015-07-01 19:49:35.000000000 +0000
++++ lib/update_pidfile.c
+@@ -1,7 +1,7 @@
+ /**
+  * @file update_pidfile.c Functions for standalone daemons
+  */
+-#define _XOPEN_SOURCE 500 /* for getpgid */
++#define _XOPEN_SOURCE 700 /* for getpgid */
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <stdio.h>
diff --git a/ganglia-monitor-core/patches/patch-lib_default__conf.h.in b/ganglia-monitor-core/patches/patch-lib_default__conf.h.in
new file mode 100644
index 0000000000..b9da566b3a
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-lib_default__conf.h.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-lib_default__conf.h.in,v 1.1 2016/02/16 12:48:18 fhajny Exp $
+
+Default paths.
+
+--- lib/default_conf.h.in.orig	2015-07-01 19:49:35.000000000 +0000
++++ lib/default_conf.h.in
+@@ -393,7 +393,7 @@ collection_group {\n\
+   }\n\
+ }\n\
+ \n\
+-include (\"" SYSCONFDIR "/conf.d/*.conf\")\n\
++include (\"" SYSCONFDIR "/gmond.conf.d/*.conf\")\n\
+ \n\
+ "
+ 
diff --git a/ganglia-monitor-core/patches/patch-libmetrics__solaris__metrics.c b/ganglia-monitor-core/patches/patch-libmetrics__solaris__metrics.c
new file mode 100644
index 0000000000..b5d79b0472
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-libmetrics__solaris__metrics.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-libmetrics__solaris__metrics.c,v 1.1 2016/02/16 12:48:18 fhajny Exp $
+
+Portability.
+
+--- libmetrics/solaris/metrics.c.orig	2015-07-01 19:49:35.000000000 +0000
++++ libmetrics/solaris/metrics.c
+@@ -1362,7 +1362,7 @@ part_max_used_func ( void )
+ g_val_t
+ cpu_steal_func ( void )
+ {
+-   static g_val_t val=0;
++   static g_val_t val={0};
+    return val;
+ }
+ 
diff --git a/ganglia-monitor-core/patches/patch-libmetrics_freebsd_metrics.c b/ganglia-monitor-core/patches/patch-libmetrics_freebsd_metrics.c
new file mode 100644
index 0000000000..35a0a154cd
--- /dev/null
+++ b/ganglia-monitor-core/patches/patch-libmetrics_freebsd_metrics.c
@@ -0,0 +1,24 @@
+$NetBSD: patch-libmetrics_freebsd_metrics.c,v 1.1 2016/02/16 12:48:18 fhajny Exp $
+
+Portability.
+
+--- libmetrics/freebsd/metrics.c.orig	2013-05-07 09:39:40.000000000 -0500
++++ libmetrics/freebsd/metrics.c	2014-10-14 15:32:43.000000000 -0500
+@@ -461,6 +461,17 @@
+    return val;
+ }
+ 
++/*
++** FIXME - Not yet implemented on FreeBSD.
++*/
++g_val_t
++cpu_steal_func ( void )
++{
++   g_val_t val;
++   val.f = 0.0;
++   return val;
++}
++
+ g_val_t
+ load_one_func ( void )
+ {


Home | Main Index | Thread Index | Old Index