Bug 52736 - Update port: sysutils/ganglia-monitor-core
Summary: Update port: sysutils/ganglia-monitor-core
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-27 23:10 UTC by Brooks Davis
Modified: 2003-06-07 14:00 UTC (History)
0 users

See Also:


Attachments
file.shar (20.44 KB, text/plain)
2003-05-27 23:10 UTC, Brooks Davis
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brooks Davis freebsd_committer freebsd_triage 2003-05-27 23:10:12 UTC
Update upgrades the sysutils/ganglia-monitor-core port to Ganglia 2.5.3
(minor bugfixes), moves the include files to a ganglia subdirectory to
unbreak XFree86-4-clients, and fixes a bug which caused gmond to dump
core when started at boot.
Comment 1 brooks 2003-05-28 01:13:59 UTC
I just discovered there's a small plist bug in this version.  The
workaround is to add the following line to the plist:

@dirrm include/ganglia/ganglia

It should go above:

@dirrm include/ganglia

-- Brooks
Comment 2 brooks 2003-05-28 05:04:14 UTC
Arg.  This submission is from the wrong copy of my files.  It only works
on 5.x machines.  I'll re-roll and test on an appropriate set of
machines tomarrow.

-- Brooks
Comment 3 brooks 2003-05-28 22:37:44 UTC
On Tue, May 27, 2003 at 09:04:14PM -0700, Brooks Davis wrote:
> Arg.  This submission is from the wrong copy of my files.  It only works
> on 5.x machines.  I'll re-roll and test on an appropriate set of
> machines tomarrow.

Here's a working copy.  It resolves the plist problem in the first shar
archive and eliminates the debugging output I was mistaking for a error
last night.  This one should be good to go.

-- Brooks


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	ganglia-monitor-core/
#	ganglia-monitor-core/Makefile
#	ganglia-monitor-core/pkg-descr
#	ganglia-monitor-core/pkg-install
#	ganglia-monitor-core/pkg-plist
#	ganglia-monitor-core/files
#	ganglia-monitor-core/files/gmetad.sh.sample
#	ganglia-monitor-core/files/gmond.sh.sample
#	ganglia-monitor-core/files/patch-gmetad_gmetad.c
#	ganglia-monitor-core/files/patch-gmetad_gmetad.conf
#	ganglia-monitor-core/files/patch-gmond_gmond.conf
#	ganglia-monitor-core/files/patch-lib_gmond__config.c
#	ganglia-monitor-core/files/patch-gmond_machines_freebsd.c
#	ganglia-monitor-core/files/patch-gmond_gmond.c
#	ganglia-monitor-core/files/patch-lib_Makefile.in
#	ganglia-monitor-core/distinfo
#
echo c - ganglia-monitor-core/
mkdir -p ganglia-monitor-core/ > /dev/null 2>&1
echo x - ganglia-monitor-core/Makefile
sed 's/^X//' >ganglia-monitor-core/Makefile << 'END-of-ganglia-monitor-core/Makefile'
X# Ports collection makefile for:	ganglia-monitor-core
X# Date created:				Wed Jan 23, 2003
X# Whom:					Brooks Davis <brooks@freebsd.org>
X#
X# $FreeBSD: ports/sysutils/ganglia-monitor-core/Makefile,v 1.1 2003/03/02 00:24:16 kris Exp $
X#
X
XPORTNAME=	ganglia-monitor-core
XPORTVERSION=	2.5.3
XCATEGORIES=	sysutils net parallel
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	ganglia
X.if defined (WITHOUT_GMETAD)
XPKGNAMESUFFIX=	-nogmetad
X.endif
X
XMAINTAINER=	brooks@FreeBSD.org
XCOMMENT=	"Ganglia cluster monitor, monitoring daemon"
X
X.if !defined (WITHOUT_GMETAD)
XLIB_DEPENDS=	rrd.0:${PORTSDIR}/net/rrdtool
X.endif
X
XGNU_CONFIGURE=	yes
XCONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" \
X		LIBS="-L${LOCALBASE}/lib"
XCONFIGURE_ARGS+=	--includedir=${PREFIX}/include/ganglia
X.if !defined (WITHOUT_GMETAD)
XCONFIGURE_ARGS+=	--with-gmetad
X.endif
XUSE_LIBTOOL=	yes
XINSTALLS_SHLIB=	yes
X.if defined (WITHOUT_GMETAD)
XPLIST_SUB+=	GMETAD="@comment "
X.else
XPLIST_SUB+=	GMETAD=
X.endif
XUSE_REINPLACE=	yes
X
XMAN1=		gmetric.1 gmond.1 gstat.1
X.if !defined (WITHOUT_GMETAD)
XMAN1+=		gmetad.1
X.endif
X
XCONF_DIR=	${PREFIX}/etc
XRC_DIR=		${PREFIX}/etc/rc.d
X
XFIX_CONF_FILES=	${WRKSRC}/lib/ganglia/gmond_config.h \
X		${WRKSRC}/mans/gmetad.1 \
X		${WRKSRC}/mans/gmond.1 \
X		${WRKSRC}/gmetad/cmdline.c \
X		${WRKSRC}/gmetad/cmdline.h \
X		${WRKSRC}/gmond/cmdline.c \
X		${WRKSRC}/gmond/cmdline.h
XFIX_DB_FILES=	${WRKSRC}/gmetad/gmetad.c \
X		${WRKSRC}/gmetad/gmetad.conf
X
Xpost-patch:
X	${REINPLACE_CMD} -e "s|/etc/\(gm[a-z]*d.conf\)|${CONF_DIR}/\1|g" \
X	    ${FIX_CONF_FILES}
X	${REINPLACE_CMD} -e "s|/var/lib/ganglia|/var/db/ganglia|g" \
X	    ${FIX_DB_FILES}
X
X# Post-install
X#
X
Xpost-install: install-man install-sample-files install-startup-files
X	${SH} pkg-install ${PKGNAME} POST-INSTALL
X
Xinstall-man:
X	${INSTALL_MAN} ${WRKSRC}/mans/gmetric.1 ${MANPREFIX}/man/man1
X	${INSTALL_MAN} ${WRKSRC}/mans/gmond.1 ${MANPREFIX}/man/man1
X	${INSTALL_MAN} ${WRKSRC}/mans/gstat.1 ${MANPREFIX}/man/man1
X.if !defined (WITHOUT_GMETAD)
X	${INSTALL_MAN} ${WRKSRC}/mans/gmetad.1 ${MANPREFIX}/man/man1
X.endif
X
Xinstall-sample-files:
X	${INSTALL_DATA} ${WRKSRC}/gmond/gmond.conf \
X	    ${CONF_DIR}/gmond.conf.sample
X.if !defined (WITHOUT_GMETAD)
X	${INSTALL_DATA} ${WRKSRC}/gmetad/gmetad.conf \
X	    ${CONF_DIR}/gmetad.conf.sample
X.endif
X
Xinstall-startup-files:
X	${INSTALL_SCRIPT} ${FILESDIR}/gmond.sh.sample ${RC_DIR}
X.if !defined (WITHOUT_GMETAD)
X	${INSTALL_SCRIPT} ${FILESDIR}/gmetad.sh.sample ${RC_DIR}
X.endif
X
X.include <bsd.port.mk>
END-of-ganglia-monitor-core/Makefile
echo x - ganglia-monitor-core/pkg-descr
sed 's/^X//' >ganglia-monitor-core/pkg-descr << 'END-of-ganglia-monitor-core/pkg-descr'
XGanglia provides a complete real-time monitoring and execution
Xenvironment that is in use by hundreds of universities, private and
Xgovernment laboratories and commercial cluster implementors around the
Xworld. Whether you want to monitor hundreds of computers in real-time
Xacross a university campus or around the world, ganglia is for you.
X
XWWW: http://ganglia.sourceforge.net/
X
X-- Brooks Davis <brooks@FreeBSD.org>
END-of-ganglia-monitor-core/pkg-descr
echo x - ganglia-monitor-core/pkg-install
sed 's/^X//' >ganglia-monitor-core/pkg-install << 'END-of-ganglia-monitor-core/pkg-install'
X#!/bin/sh
X
Xu=ganglia
Xg=ganglia
Xugid=97
Xhomedir=/nonexistent
Xshell=/sbin/nologin
Xrrd_rootdir=/var/db/ganglia/rrds
X
Xcase $2 in
XPOST-INSTALL)
X	if pw group show "${g}" >/dev/null 2>&1; then
X		echo "Using existing group \"${g}\"."
X	else
X		echo "Creating group \"${g}\", (gid: ${ugid})."
X		pw groupadd ${g} -g ${ugid}
X		if [ $? != 0 ]; then
X			echo "Failed to add group \"${g}\"."
X			exit 1
X		fi
X	fi
X	if pw user show "${u}" >/dev/null 2>&1; then
X		echo "Using existing user \"${u}\"."
X	else
X		echo "Creating user \"${u}\", (uid: ${ugid})."
X		pw useradd ${u} -u ${ugid} -g ${ugid} -h - \
X		    -d ${homedir} -s ${shell} -c "Ganglia User"
X		if [ $? != 0 ]; then
X			echo "Failed to add user \"${u}\"."
X			exit 1
X		fi
X	fi
X
X	mkdir -p ${rrd_rootdir}
X	chown -R ${u}:${g} ${rrd_rootdir}
X	;;
Xesac
END-of-ganglia-monitor-core/pkg-install
echo x - ganglia-monitor-core/pkg-plist
sed 's/^X//' >ganglia-monitor-core/pkg-plist << 'END-of-ganglia-monitor-core/pkg-plist'
Xbin/gstat
Xbin/gmetric
Xetc/gmond.conf.sample
X%%GMETAD%%etc/gmetad.conf.sample
Xetc/rc.d/gmond.sh.sample
X%%GMETAD%%etc/rc.d/gmetad.sh.sample
Xinclude/ganglia/ganglia.h
Xinclude/ganglia/ascii.h
Xinclude/ganglia/asciitab.h
Xinclude/ganglia/daemon_inetd.h
Xinclude/ganglia/daemon_init.h
Xinclude/ganglia/debug_msg.h
Xinclude/ganglia/error.h
Xinclude/ganglia/file.h
Xinclude/ganglia/hash.h
Xinclude/ganglia/iasciitab.h
Xinclude/ganglia/latin1tab.h
Xinclude/ganglia/llist.h
Xinclude/ganglia/my_inet_ntop.h
Xinclude/ganglia/nametab.h
Xinclude/ganglia/net.h
Xinclude/ganglia/rdwr.h
Xinclude/ganglia/utf8tab.h
Xinclude/ganglia/xmldef.h
Xinclude/ganglia/xmlparse.h
Xinclude/ganglia/xmlrole.h
Xinclude/ganglia/xmltok.h
Xinclude/ganglia/xmltok_impl.h
Xinclude/ganglia/gexec_funcs.h
Xinclude/ganglia/fsusage.h
Xinclude/ganglia/gexec_process.h
Xinclude/ganglia/gmond_config.h
Xlib/libganglia.so.2
Xlib/libganglia.so
Xlib/libganglia.la
Xlib/libganglia.a
X%%GMETAD%%sbin/gmetad
Xsbin/gmond
X@dirrm include/ganglia
X@unexec rmdir /var/db/ganglia/rrds /var/db/ganglia 2>/dev/null || true
END-of-ganglia-monitor-core/pkg-plist
echo c - ganglia-monitor-core/files
mkdir -p ganglia-monitor-core/files > /dev/null 2>&1
echo x - ganglia-monitor-core/files/gmetad.sh.sample
sed 's/^X//' >ganglia-monitor-core/files/gmetad.sh.sample << 'END-of-ganglia-monitor-core/files/gmetad.sh.sample'
X#!/bin/sh
X#
X# $FreeBSD: ports/sysutils/ganglia-monitor-core/files/gmetad.sh.sample,v 1.1 2003/03/02 00:24:16 kris Exp $
X#
X# Start or stop gmetad.
X#
X
Xrc_file=${0##*/}
Xrc_arg=$1
X
Xif ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then
X	echo "${rc_file}: Cannot determine PREFIX." >&2
X	echo "Please use the complete pathname." >&2
X	exit 64
Xfi
X
Xprogram_dir=${PREFIX}/sbin
Xprogram_file=gmetad
Xprogram_path=${program_dir}/${program_file}
X
Xconfig_dir=${PREFIX}/etc
Xconfig_file=${program_file}.conf
Xconfig_path=${config_dir}/${config_file}
X
Xsyslog_facility=daemon.err
X
Xcase "$rc_arg" in
Xstart)
X	if [ ! -x ${program_path} ]; then
X		logger -sp ${syslog_facility} -t ${program_file} \
X		    "unable to start: ${program_path} is missing."
X		exit 72
X	fi
X	if [ ! -f ${config_path} ]; then
X		logger -sp ${syslog_facility} -t ${program_file} \
X		    "unable to start: ${config_path} is missing."
X		exit 72   
X	fi
X	${program_path} && echo -n " ${program_file}"
X	;;
Xstop)
X	killall ${program_file} 2> /dev/null
X	;;
Xrestart)
X	$0 stop
X	$0 start
X	;;
Xstatus)
X	ps -auxww | egrep ${program_file} | egrep -v "($0|egrep)"
X	;;
X*)
X	echo "usage: ${rc_file} {start|stop|restart|status}" >&2
X	exit 64
X	;;
Xesac
X
Xexit 0
END-of-ganglia-monitor-core/files/gmetad.sh.sample
echo x - ganglia-monitor-core/files/gmond.sh.sample
sed 's/^X//' >ganglia-monitor-core/files/gmond.sh.sample << 'END-of-ganglia-monitor-core/files/gmond.sh.sample'
X#!/bin/sh
X#
X# $FreeBSD: ports/sysutils/ganglia-monitor-core/files/gmond.sh.sample,v 1.1 2003/03/02 00:24:16 kris Exp $
X#
X# Start or stop gmond.
X#
X
Xrc_file=${0##*/}
Xrc_arg=$1
X
Xif ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then
X	echo "${rc_file}: Cannot determine PREFIX." >&2
X	echo "Please use the complete pathname." >&2
X	exit 64
Xfi
X
Xprogram_dir=${PREFIX}/sbin
Xprogram_file=gmond
Xprogram_path=${program_dir}/${program_file}
X
Xconfig_dir=${PREFIX}/etc
Xconfig_file=${program_file}.conf
Xconfig_path=${config_dir}/${config_file}
X
Xsyslog_facility=daemon.err
X
Xcase "$rc_arg" in
Xstart)
X	if [ ! -x ${program_path} ]; then
X		logger -sp ${syslog_facility} -t ${program_file} \
X		    "unable to start: ${program_path} is missing."
X		exit 72
X	fi
X	if [ ! -f ${config_path} ]; then
X		logger -sp ${syslog_facility} -t ${program_file} \
X		    "unable to start: ${config_path} is missing."
X		exit 72   
X	fi
X	${program_path} && echo -n " ${program_file}"
X	;;
Xstop)
X	killall ${program_file} 2> /dev/null
X	;;
Xrestart)
X	$0 stop
X	$0 start
X	;;
Xstatus)
X	ps -auxww | egrep ${program_file} | egrep -v "($0|egrep)"
X	;;
X*)
X	echo "usage: ${rc_file} {start|stop|restart|status}" >&2
X	exit 64
X	;;
Xesac
X
Xexit 0
END-of-ganglia-monitor-core/files/gmond.sh.sample
echo x - ganglia-monitor-core/files/patch-gmetad_gmetad.c
sed 's/^X//' >ganglia-monitor-core/files/patch-gmetad_gmetad.c << 'END-of-ganglia-monitor-core/files/patch-gmetad_gmetad.c'
X
X$FreeBSD: ports/sysutils/ganglia-monitor-core/files/patch-gmetad_gmetad.c,v 1.1 2003/03/02 00:24:16 kris Exp $
X
X--- gmetad/gmetad.c.orig	Mon Dec  9 14:43:23 2002
X+++ gmetad/gmetad.c	Fri Feb 21 11:52:24 2003
X@@ -40,7 +40,7 @@
X pthread_mutex_t  server_socket_mutex     = PTHREAD_MUTEX_INITIALIZER;
X int server_threads = 2;
X char *rrd_rootdir =  "/var/lib/ganglia/rrds";
X-char *setuid_username = "nobody";
X+char *setuid_username = "ganglia";
X int should_setuid = 1;
X unsigned int source_index = 0;
X 
END-of-ganglia-monitor-core/files/patch-gmetad_gmetad.c
echo x - ganglia-monitor-core/files/patch-gmetad_gmetad.conf
sed 's/^X//' >ganglia-monitor-core/files/patch-gmetad_gmetad.conf << 'END-of-ganglia-monitor-core/files/patch-gmetad_gmetad.conf'
X
X$FreeBSD: ports/sysutils/ganglia-monitor-core/files/patch-gmetad_gmetad.conf,v 1.1 2003/03/02 00:24:16 kris Exp $
X
X--- gmetad/gmetad.conf.orig	Wed Jan 29 10:17:02 2003
X+++ gmetad/gmetad.conf	Fri Feb 21 11:52:58 2003
X@@ -55,9 +55,9 @@
X # default: on
X # setuid off
X #
X-# User gmetad will setuid to (defaults to "nobody")
X-# default: "nobody"
X-# setuid_username "nobody"
X+# User gmetad will setuid to (defaults to "ganglia")
X+# default: "ganglia"
X+# setuid_username "ganglia"
X #
X # The port gmetad will answer requests for XML
X # default: 8651
END-of-ganglia-monitor-core/files/patch-gmetad_gmetad.conf
echo x - ganglia-monitor-core/files/patch-gmond_gmond.conf
sed 's/^X//' >ganglia-monitor-core/files/patch-gmond_gmond.conf << 'END-of-ganglia-monitor-core/files/patch-gmond_gmond.conf'
X
X$FreeBSD: ports/sysutils/ganglia-monitor-core/files/patch-gmond_gmond.conf,v 1.1 2003/03/02 00:24:16 kris Exp $
X
X--- gmond/gmond.conf.orig	Thu Feb 20 14:34:00 2003
X+++ gmond/gmond.conf	Thu Feb 20 14:35:09 2003
X@@ -99,8 +99,8 @@
X # no_setuid  on
X #
X # Which user should gmond run as?
X-# default: nobody
X-# setuid     nobody
X+# default: ganglia
X+# setuid     ganglia
X #
X # If you do not want this host to appear in the gexec host list, set
X # this value to "on"
END-of-ganglia-monitor-core/files/patch-gmond_gmond.conf
echo x - ganglia-monitor-core/files/patch-lib_gmond__config.c
sed 's/^X//' >ganglia-monitor-core/files/patch-lib_gmond__config.c << 'END-of-ganglia-monitor-core/files/patch-lib_gmond__config.c'
X
X$FreeBSD: ports/sysutils/ganglia-monitor-core/files/patch-lib_gmond__config.c,v 1.1 2003/03/02 00:24:16 kris Exp $
X
X--- lib/gmond_config.c.orig	Thu Feb 20 14:32:29 2003
X+++ lib/gmond_config.c	Thu Feb 20 14:32:39 2003
X@@ -224,7 +224,7 @@
X    config->deaf = 0;
X    config->debug_level = 0;
X    config->no_setuid = 0;
X-   config->setuid = conf_strdup("nobody");
X+   config->setuid = conf_strdup("ganglia");
X    config->no_gexec = 0;
X    config->all_trusted = 0;
X 
END-of-ganglia-monitor-core/files/patch-lib_gmond__config.c
echo x - ganglia-monitor-core/files/patch-gmond_machines_freebsd.c
sed 's/^X//' >ganglia-monitor-core/files/patch-gmond_machines_freebsd.c << 'END-of-ganglia-monitor-core/files/patch-gmond_machines_freebsd.c'
X
X$FreeBSD$
X
X--- gmond/machines/freebsd.c.orig	Thu Aug 15 10:17:25 2002
X+++ gmond/machines/freebsd.c	Wed May 28 12:51:18 2003
X@@ -10,11 +10,36 @@
X #include <sys/param.h> 
X #include <sys/sysctl.h>
X #include <sys/user.h>
X+#if __FreeBSD_version < 500101
X #include <sys/dkstat.h>
X+#else
X+#include <sys/resource.h>
X+#endif
X+#include <sys/stat.h>
X+#include <vm/vm_param.h>
X #include <unistd.h>
X #include "ganglia.h"
X #include "metric_typedefs.h"
X 
X+#define MIB_SWAPINFO_SIZE 3
X+
X+#ifndef XSWDEV_VERSION
X+#define XSWDEV_VERSION  1
X+struct xswdev {
X+        u_int   xsw_version;
X+        udev_t  xsw_dev;
X+        int     xsw_flags;
X+        int     xsw_nblks;
X+        int     xsw_used;
X+};
X+#endif
X+
X+static int use_vm_swap_info = 0;
X+static int mibswap[MIB_SWAPINFO_SIZE];
X+static size_t mibswap_size;
X+static kvm_t *kd = NULL;
X+static int pagesize;
X+
X /* Function prototypes */
X long percentages(int cnt, int *out, register long *new,
X                           register long *old, long *diffs);
X@@ -27,6 +52,19 @@
X metric_init(void)
X {
X    g_val_t val;
X+
X+   /*
X+    * Try to use the vm.swap_info sysctl to gather swap data.  If it
X+    * isn't implemented, fall back to trying to old kvm based interface.
X+    */
X+   mibswap_size = MIB_SWAPINFO_SIZE;
X+   if (sysctlnametomib("vm.swap_info", mibswap, &mibswap_size) == -1) {
X+      kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "metric_init()"); 
X+   } else {
X+      use_vm_swap_info = 1;
X+   }
X+   pagesize = getpagesize();
X+
X    val.int32 = SYNAPSE_SUCCESS;
X    return val;
X }
X@@ -81,21 +119,33 @@
X swap_total_func ( void )
X {
X    g_val_t val;
X-
X    struct kvm_swap swap[1];
X-   kvm_t *kd;
X+   struct xswdev xsw;
X+   size_t mibsize, size;
X    int totswap, n;
X 
X-   kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open"); 
X-   n = kvm_getswapinfo(kd, swap, 1, 0);
X-   if (n < 0 || swap[0].ksw_total == 0) { 
X-       val.uint32 = 0;
X+   val.uint32 = 0; 
X+   totswap = 0;
X+
X+   if (use_vm_swap_info) {
X+      for (n = 0; ; ++n) {
X+	 mibswap[mibswap_size] = n;
X+	 size = sizeof(xsw);
X+	 if (sysctl(mibswap, mibswap_size + 1, &xsw, &size, NULL, NULL) == -1)
X+	    break;
X+	 if (xsw.xsw_version != XSWDEV_VERSION)
X+	    return val;
X+         totswap += xsw.xsw_nblks;
X+       }
X+   } else if(kd != NULL) {
X+      n = kvm_getswapinfo(kd, swap, 1, 0);
X+      if (n < 0 || swap[0].ksw_total == 0) { 
X+         val.uint32 = 0;
X+      }
X+      totswap = swap[0].ksw_total;
X    }
X-   totswap = swap[0].ksw_total;
X-   totswap *= getpagesize() / 1024;
X-   val.uint32 = totswap;
X-   kvm_close(kd);
X 
X+   val.uint32 = totswap * (pagesize / 1024);
X    return val;
X }
X 
X@@ -330,9 +380,8 @@
X    len = sizeof (free_pages);
X    if((sysctlbyname("vm.stats.vm.v_free_count", &free_pages, &len, NULL, 0) 
X 	== -1) || !len) free_pages = 0; 
X-   free_pages *= getpagesize() / 1024;
X 
X-   val.uint32 = free_pages;
X+   val.uint32 = free_pages * (pagesize / 1024);
X    return val;
X }
X 
X@@ -373,9 +422,7 @@
X 	|| !len)
X       cache = 0; 
X 
X-   cache *= getpagesize() / 1024;
X-
X-   val.uint32 = cache;
X+   val.uint32 = cache * (pagesize / 1024);
X    return val;
X }
X 
X@@ -383,23 +430,35 @@
X swap_free_func ( void )
X {
X    g_val_t val;
X+
X    struct kvm_swap swap[1];
X-   kvm_t *kd;
X+   struct xswdev xsw;
X+   size_t size;
X    int totswap, usedswap, freeswap, n;
X 
X-   kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open");
X-   n = kvm_getswapinfo(kd, swap, 1, 0);
X-   if (n < 0 || swap[0].ksw_total == 0) {
X-       val.uint32 = 0;
X-   }
X-   totswap = swap[0].ksw_total;
X-   usedswap = swap[0].ksw_used;
X-   kvm_close(kd);
X+   val.uint32 = 0;
X+   totswap = 0;
X+   usedswap = 0;
X 
X-   freeswap = totswap-usedswap;
X-   freeswap *= getpagesize() / 1024;
X+   if (use_vm_swap_info) {
X+      for (n = 0; ; ++n) {
X+	 mibswap[mibswap_size] = n;
X+	 size = sizeof(xsw);
X+	 if (sysctl(mibswap, mibswap_size + 1, &xsw, &size, NULL, NULL) == -1)
X+	    break;
X+	 if (xsw.xsw_version != XSWDEV_VERSION)
X+	    return val;
X+         totswap += xsw.xsw_nblks;
X+         usedswap += xsw.xsw_used;
X+       }
X+   } else if(kd != NULL) { 
X+      n = kvm_getswapinfo(kd, swap, 1, 0);
X+      totswap = swap[0].ksw_total;
X+      usedswap = swap[0].ksw_used;
X+   }
X+   freeswap = totswap - usedswap;
X 
X-   val.uint32 = freeswap;
X+   val.uint32 = freeswap * (pagesize / 1024);
X    return val;
X }
X 
END-of-ganglia-monitor-core/files/patch-gmond_machines_freebsd.c
echo x - ganglia-monitor-core/files/patch-gmond_gmond.c
sed 's/^X//' >ganglia-monitor-core/files/patch-gmond_gmond.c << 'END-of-ganglia-monitor-core/files/patch-gmond_gmond.c'
X
X$FreeBSD$
X
X--- gmond/gmond.c.orig	Tue Jan  7 09:05:04 2003
X+++ gmond/gmond.c	Thu Apr  3 16:40:22 2003
X@@ -163,6 +163,13 @@
X    print_gmond_config();
X    */
X 
X+   /* in machine.c */
X+   initval = metric_init();
X+   if ( initval.int32 <0)
X+      {
X+         err_quit("metric_init() returned an error");
X+      }
X+
X    if(!gmond_config.no_setuid)
X       become_a_nobody(gmond_config.setuid);
X 
X@@ -266,13 +273,6 @@
X                return -1;
X             }
X          debug_msg("multicasting on channel %s %d", gmond_config.mcast_channel, gmond_config.mcast_port);
X-
X-         /* in machine.c */
X-         initval = metric_init();
X-         if ( initval.int32 <0)
X-            {
X-               err_quit("monitor_init() returned an error");
X-            }
X 
X          pthread_create(&tid, &attr, monitor_thread, NULL);
X          debug_msg("created monitor thread");
END-of-ganglia-monitor-core/files/patch-gmond_gmond.c
echo x - ganglia-monitor-core/files/patch-lib_Makefile.in
sed 's/^X//' >ganglia-monitor-core/files/patch-lib_Makefile.in << 'END-of-ganglia-monitor-core/files/patch-lib_Makefile.in'
X
X$FreeBSD$
X
X--- lib/Makefile.in.orig	Wed May 28 12:59:41 2003
X+++ lib/Makefile.in	Wed May 28 13:00:03 2003
X@@ -471,7 +471,6 @@
X 
X install-exec-am: install-libLTLIBRARIES
X 	@$(NORMAL_INSTALL)
X-	$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
X 
X install-info: install-info-am
X 
END-of-ganglia-monitor-core/files/patch-lib_Makefile.in
echo x - ganglia-monitor-core/distinfo
sed 's/^X//' >ganglia-monitor-core/distinfo << 'END-of-ganglia-monitor-core/distinfo'
XMD5 (ganglia-monitor-core-2.5.3.tar.gz) = c6bd5f5d21b3b84286d474f7e57f5101
END-of-ganglia-monitor-core/distinfo
exit
Comment 4 Christian Weisgerber freebsd_committer freebsd_triage 2003-06-07 13:59:53 UTC
State Changed
From-To: open->closed

Committed, thanks. 
In the future, please submit updates to existing ports as a diff.