Correct a number of issues with the previous commit:
- Patch a number of bugs in the metric code that caused gmond to be unstable, particularly on 4.x. These will be in the next ganglia release. - Use CFLAGS instead of CPPFLAGS to pass the include arguments. This appears to fix the bug where an installed, obsolete ganglia.h would break the build. - Do a better job of respecting CFLAGS and LDFLAGS. - Drop USE_LIBTOOL_VER. It appears to break sparc64. - Fix a warning caused by an @unexec in the plist when gmetad.conf has been modified. The port revision has been bumped. All users of 3.0.0 should upgrade.
This commit is contained in:
parent
306d362e4f
commit
94b4baba35
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=130382
@ -5,32 +5,33 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= ganglia-monitor-core
|
||||
PORTNAME= monitor-core
|
||||
PORTVERSION= 3.0.0
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= sysutils net parallel
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
|
||||
MASTER_SITE_SUBDIR= ganglia
|
||||
PKGNAMEPREFIX= ganglia-
|
||||
DISTNAME= ganglia-${PORTVERSION}
|
||||
|
||||
MAINTAINER= brooks@FreeBSD.org
|
||||
COMMENT= Ganglia cluster monitor, monitoring daemon
|
||||
|
||||
PKGINSTALL= ${WRKSRC}/pkg-install
|
||||
|
||||
.if defined (WITH_GMETAD)
|
||||
LIB_DEPENDS= rrd.0:${PORTSDIR}/net/rrdtool
|
||||
.endif
|
||||
|
||||
PKGINSTALL= ${WRKSRC}/pkg-install
|
||||
|
||||
OPTIONS+= GMETAD "include gmetad" on
|
||||
|
||||
GNU_CONFIGURE= yes
|
||||
CONFIGURE_ENV= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
|
||||
CPPFLAGS= -I${LOCALBASE}/include ${PTHREAD_CFLAGS}
|
||||
LDFLAGS= -L${LOCALBASE}/lib
|
||||
CONFIGURE_ENV= CFLAGS="${_CFLAGS}" LDFLAGS="${_LDFLAGS}"
|
||||
_CFLAGS= ${CFLAGS} -I${LOCALBASE}/include ${PTHREAD_CFLAGS}
|
||||
_LDFLAGS= ${LDFLAGS} -L${LOCALBASE}/lib
|
||||
|
||||
USE_REINPLACE= yes
|
||||
USE_BZIP2= yes
|
||||
USE_LIBTOOL_VER= 15
|
||||
USE_RC_SUBR= ganglia.sh
|
||||
|
||||
SUB_FILES= pkg-install
|
||||
|
@ -0,0 +1,184 @@
|
||||
|
||||
$FreeBSD$
|
||||
|
||||
--- srclib/libmetrics/freebsd/metrics.c.orig
|
||||
+++ srclib/libmetrics/freebsd/metrics.c
|
||||
@@ -51,6 +51,8 @@
|
||||
#define UINT64_MAX ULLONG_MAX
|
||||
#endif
|
||||
|
||||
+#define VFCF_NONLOCAL (VFCF_NETWORK|VFCF_SYNTHETIC|VFCF_LOOPBACK)
|
||||
+
|
||||
#define timertod(tvp) \
|
||||
((double)(tvp)->tv_sec + (double)(tvp)->tv_usec/(1000*1000))
|
||||
|
||||
@@ -243,49 +245,40 @@
|
||||
g_val_t
|
||||
machine_type_func ( void )
|
||||
{
|
||||
- g_val_t val;
|
||||
- char machine_type[MAX_G_STRING_SIZE];
|
||||
- size_t len = MAX_G_STRING_SIZE;
|
||||
- if (sysctlbyname("hw.machine", &machine_type, &len, NULL, 0) == -1 || !len)
|
||||
- strncpy( val.str, "x86", MAX_G_STRING_SIZE );
|
||||
+ g_val_t val;
|
||||
+ size_t len = sizeof(val.str);
|
||||
|
||||
- strncpy( val.str, machine_type, MAX_G_STRING_SIZE );
|
||||
- return val;
|
||||
+ if (sysctlbyname("hw.machine", val.str, &len, NULL, 0) == -1 ||
|
||||
+ (len == 0))
|
||||
+ strlcpy(val.str, "unknown", sizeof(val.str));
|
||||
+
|
||||
+ return val;
|
||||
}
|
||||
|
||||
g_val_t
|
||||
os_name_func ( void )
|
||||
{
|
||||
- g_val_t val;
|
||||
- char osname[MAX_G_STRING_SIZE];
|
||||
- size_t len = MAX_G_STRING_SIZE;
|
||||
- if (sysctlbyname("kern.ostype", &osname, &len, NULL, 0) == -1 || !len)
|
||||
- strncpy( val.str, "FreeBSD", MAX_G_STRING_SIZE );
|
||||
+ g_val_t val;
|
||||
+ size_t len = sizeof(val.str);
|
||||
|
||||
- strncpy( val.str, osname, MAX_G_STRING_SIZE );
|
||||
-
|
||||
- return val;
|
||||
+ if (sysctlbyname("kern.ostype", val.str, &len, NULL, 0) == -1 ||
|
||||
+ (len == 0))
|
||||
+ strlcpy(val.str, "FreeBSD (unknown)", sizeof(val.str));
|
||||
+
|
||||
+ return val;
|
||||
}
|
||||
|
||||
g_val_t
|
||||
os_release_func ( void )
|
||||
{
|
||||
- g_val_t val;
|
||||
- int mib[2];
|
||||
- size_t len;
|
||||
- char *prefix, buf[1024];
|
||||
-
|
||||
- prefix = "";
|
||||
-
|
||||
- mib[0] = CTL_KERN;
|
||||
- mib[1] = KERN_OSRELEASE;
|
||||
- len = sizeof(buf);
|
||||
- if (sysctl(mib, 2, &buf, &len, NULL, 0) == -1)
|
||||
- strncpy( val.str, "Unknown", MAX_G_STRING_SIZE );
|
||||
+ g_val_t val;
|
||||
+ size_t len = sizeof(val.str);
|
||||
|
||||
- strncpy( val.str, buf, MAX_G_STRING_SIZE );
|
||||
+ if (sysctlbyname("kern.osrelease", val.str, &len, NULL, 0) == -1 ||
|
||||
+ (len == 0))
|
||||
+ strlcpy(val.str, "unknown", sizeof(val.str));
|
||||
|
||||
- return val;
|
||||
+ return val;
|
||||
}
|
||||
|
||||
/* Get the CPU state given by index, from kern.cp_time
|
||||
@@ -910,8 +903,9 @@
|
||||
static char *
|
||||
makenetvfslist(void)
|
||||
{
|
||||
- char *str = NULL, *strptr, **listptr = NULL;
|
||||
- int cnt, i;
|
||||
+ char *str = NULL, *strptr, **listptr = NULL;
|
||||
+ size_t slen;
|
||||
+ int cnt, i;
|
||||
|
||||
#if __FreeBSD_version > 500000
|
||||
struct xvfsconf *xvfsp, *keep_xvfsp = NULL;
|
||||
@@ -938,20 +932,22 @@
|
||||
goto done;
|
||||
}
|
||||
|
||||
- for (cnt = 0, i = 0; i < maxvfsconf; i++) {
|
||||
- if (xvfsp->vfc_flags & (VFCF_NETWORK|VFCF_SYNTHETIC|VFCF_LOOPBACK)) {
|
||||
- listptr[cnt++] = strdup(xvfsp->vfc_name);
|
||||
- if (listptr[cnt-1] == NULL) {
|
||||
- warnx("malloc failed");
|
||||
- goto done;
|
||||
- }
|
||||
+ for (cnt = 0; cnt < maxvfsconf; xvfsp++) {
|
||||
+ if (xvfsp->vfc_flags & VFCF_NONLOCAL)
|
||||
+ continue;
|
||||
+
|
||||
+ listptr[cnt] = strdup(xvfsp->vfc_name);
|
||||
+ if (listptr[cnt] == NULL) {
|
||||
+ warnx("malloc failed");
|
||||
+ goto done;
|
||||
}
|
||||
- xvfsp++;
|
||||
+ cnt++;
|
||||
}
|
||||
#else
|
||||
int mib[3], maxvfsconf;
|
||||
size_t miblen;
|
||||
struct ovfsconf *ptr;
|
||||
+ int fd;
|
||||
|
||||
mib[0] = CTL_VFS; mib[1] = VFS_GENERIC; mib[2] = VFS_MAXTYPENUM;
|
||||
miblen=sizeof(maxvfsconf);
|
||||
@@ -966,31 +962,45 @@
|
||||
goto done;
|
||||
}
|
||||
|
||||
- for (ptr = getvfsent(); ptr; ptr = getvfsent())
|
||||
- if (ptr->vfc_flags & (VFCF_NETWORK|VFCF_SYNTHETIC|VFCF_LOOPBACK)) {
|
||||
- listptr[cnt++] = strdup(ptr->vfc_name);
|
||||
- if (listptr[cnt-1] == NULL) {
|
||||
- warnx("malloc failed");
|
||||
- goto done;
|
||||
- }
|
||||
+ cnt = 0;
|
||||
+ while ((ptr = getvfsent()) != NULL && cnt < maxvfsconf) {
|
||||
+ if (ptr->vfc_flags & VFCF_NONLOCAL)
|
||||
+ continue;
|
||||
+
|
||||
+ listptr[cnt] = strdup(ptr->vfc_name);
|
||||
+ if (listptr[cnt] == NULL) {
|
||||
+ warnx("malloc failed");
|
||||
+ goto done;
|
||||
}
|
||||
+ cnt++;
|
||||
+ }
|
||||
#endif
|
||||
|
||||
if (cnt == 0)
|
||||
goto done;
|
||||
|
||||
- if ((str = malloc(sizeof(char) * (32 * cnt + cnt + 2))) == NULL) {
|
||||
+ /*
|
||||
+ * Count up the string lengths, we need a extra byte to hold
|
||||
+ * the between entries ',' or the NUL at the end.
|
||||
+ */
|
||||
+ for (i = 0; i < cnt; i++)
|
||||
+ slen = strlen(listptr[i]) + 1;
|
||||
+ /* Add 2 for initial "no". */
|
||||
+ slen += 2;
|
||||
+
|
||||
+ if ((str = malloc(slen)) == NULL) {
|
||||
warnx("malloc failed");
|
||||
goto done;
|
||||
}
|
||||
|
||||
- *str = 'n'; *(str + 1) = 'o';
|
||||
+ str[0] = 'n';
|
||||
+ str[1] = 'o';
|
||||
for (i = 0, strptr = str + 2; i < cnt; i++, strptr++) {
|
||||
- strncpy(strptr, listptr[i], 32);
|
||||
+ strcpy(strptr, listptr[i]);
|
||||
strptr += strlen(listptr[i]);
|
||||
*strptr = ',';
|
||||
}
|
||||
- *(--strptr) = '\0';
|
||||
+ *strptr = '\0';
|
||||
|
||||
done:
|
||||
#if __FreeBSD_version > 500000
|
@ -4,12 +4,13 @@ bin/gstat
|
||||
bin/gmetric
|
||||
@unexec if cmp -s %D/etc/gmond.conf %D/etc/gmond.conf.sample; then rm -f %D/etc/gmond.conf; fi
|
||||
etc/gmond.conf.sample
|
||||
%%GMETAD%%@unexec cmp -s %D/etc/gmetad.conf %D/etc/gmetad.conf.sample && rm -f %D/etc/gmetad.conf
|
||||
%%GMETAD%%@unexec if cmp -s %D/etc/gmetad.conf %D/etc/gmetad.conf.sample; then rm -f %D/etc/gmetad.conf; fi
|
||||
%%GMETAD%%etc/gmetad.conf.sample
|
||||
include/ganglia.h
|
||||
lib/libganglia-3.0.0.so.0
|
||||
lib/libganglia-3.0.0.so
|
||||
lib/libganglia.so
|
||||
lib/libganglia.la
|
||||
lib/libganglia.a
|
||||
%%GMETAD%%sbin/gmetad
|
||||
sbin/gmond
|
||||
|
Loading…
Reference in New Issue
Block a user