[xymon] 4.3.0 beta3 compile problem on solaris 10 sparc

Henrik Størner henrik at hswn.dk
Mon Dec 6 10:38:07 CET 2010


In <ic2jgs$8ss$1 at voodoo.hswn.dk> Henrik "Størner" <henrik at hswn.dk> writes:

>In <4CE450D8.1050809 at logicaltech.com.au> Roland Soderstrom <rolands at logicaltech.com.au> writes:

>>Another problem:
>>I'm trying to compile the client on Solaris 9 SPARC and get this error.
>>gcc -g -O2 -Wall -Wno-unused -D_REENTRANT -D_LARGEFILE_SOURCE 
>>-D_FILE_OFFSET_BITS=64 -DSunOS -I. -I/var/tmp/xymon-4.3.0.beta3/include 
>>-DCLIENTONLY=1 -I. -I../include    -c -o misc.o misc.c
>>In file included from /var/tmp/xymon-4.3.0.beta3/include/libxymon.h:56,
>>                  from misc.c:34:
>>/var/tmp/xymon-4.3.0.beta3/include/../lib/eventlog.h:38: error: syntax 
>>error before numeric constant

>Yes, I've seen this on Solaris 8 also. Looking into it.


Turned out to be a name collision between some constants defined on Solaris
and in Xymon. So renaming them in Xymon solves this issue. Patch attached,
or download rev. 6604 from SVN.


Index: xymongen/pagegen.c
===================================================================
--- xymongen/pagegen.c	(revision 6602)
+++ xymongen/pagegen.c	(revision 6604)
@@ -954,7 +954,7 @@
 				do_eventlog(output, nongreeneventlogmaxcount, nongreeneventlogmaxtime,
 				NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, nongreennodialups, 
 				host_exists,
-				NULL, NULL, NULL, COUNT_NONE, S_NONE, NULL);
+				NULL, NULL, NULL, XYMON_COUNT_NONE, XYMON_S_NONE, NULL);
 			}
 		}
 		else if (strcmp(p, "acklog.sh") == 0) {
@@ -1139,7 +1139,7 @@
 			do_eventlog(output, nongreeneventlogmaxcount, nongreeneventlogmaxtime, 
 				    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, nongreennodialups, 
 				    host_exists,
-				    NULL, NULL, NULL, COUNT_NONE, S_NONE, NULL);
+				    NULL, NULL, NULL, XYMON_COUNT_NONE, XYMON_S_NONE, NULL);
 		}
 		if (nongreenacklog && !havedoneacklog) do_acklog(output, nongreenacklogmaxcount, nongreenacklogmaxtime);
 	}
Index: lib/eventlog.c
===================================================================
--- lib/eventlog.c	(revision 6602)
+++ lib/eventlog.c	(revision 6604)
@@ -641,7 +641,7 @@
 		oldcolname = colorname(eventcolor(oldcol));
 		newcolname = colorname(eventcolor(newcol));
 		/* For DURATION counts, we must parse all events until now */
-		if ((counttype != COUNT_DURATION) && (eventtime > lastevent)) break;
+		if ((counttype != XYMON_COUNT_DURATION) && (eventtime > lastevent)) break;
 		eventhost = hostinfo(hostname);
 		eventcolumn = getname(svcname, 1);
 
@@ -657,7 +657,7 @@
 					ignoredialups, hostcheck) == 0) continue;
 
 			/* For duration counts, record all events. We'll filter out the colors later. */
-			if (colrregexp && (counttype != COUNT_DURATION)) {
+			if (colrregexp && (counttype != XYMON_COUNT_DURATION)) {
 				colrmatch = ( (pcre_exec(colrregexp, NULL, newcolname, strlen(newcolname), 0, 0,
 							ovector, (sizeof(ovector)/sizeof(int))) >= 0) ||
 					      (pcre_exec(colrregexp, NULL, oldcolname, strlen(oldcolname), 0, 0,
@@ -678,7 +678,7 @@
 			newevent->next = eventhead;
 			eventhead = newevent;
 
-			if (counttype != COUNT_DURATION) {
+			if (counttype != XYMON_COUNT_DURATION) {
 				countrec = (eventcount_t *)xmh_item(eventhost, XMH_DATA);
 				while (countrec && (countrec->service != eventcolumn)) countrec = countrec->next;
 				if (countrec == NULL) {
@@ -695,8 +695,8 @@
 	/* Count the state changes per host */
 	svccounthead = hostcounthead = NULL;
 	switch (counttype) {
-	  case COUNT_EVENTS: count_events(&hostcounthead, &svccounthead); break;
-	  case COUNT_DURATION: count_duration(firstevent, lastevent,
+	  case XYMON_COUNT_EVENTS: count_events(&hostcounthead, &svccounthead); break;
+	  case XYMON_COUNT_DURATION: count_duration(firstevent, lastevent,
 					       pageregexp, expageregexp,
 					       hostregexp, exhostregexp,
 					       testregexp, extestregexp,
@@ -718,12 +718,12 @@
 		if (periodstring) fprintf(output, "<p><font size=+1>%s</font></p>\n", periodstring);
 
 		switch (sumtype) {
-		  case S_HOST_BREAKDOWN:
+		  case XYMON_S_HOST_BREAKDOWN:
 			/* Request for a specific service, show breakdown by host */
 			for (cwalk = hostcounthead; (cwalk); cwalk = cwalk->next) totalcount += cwalk->total;
 			fprintf(output, "<table summary=\"Breakdown by host\" border=0>\n");
 			fprintf(output, "<tr><th align=left>Host</th><th colspan=2>%s</th></tr>\n",
-				(counttype == COUNT_EVENTS) ? "State changes" : "Seconds red/yellow");
+				(counttype == XYMON_COUNT_EVENTS) ? "State changes" : "Seconds red/yellow");
 			fprintf(output, "<tr><td colspan=3><hr width=\"100%%\"></td></tr>\n");
 			for (cwalk = hostcounthead; (cwalk && (cwalk->total > 0)); cwalk = cwalk->next) {
 				fprintf(output, "<tr><td align=left>%s</td><td align=right>%lu</td><td align=right>(%6.2f %%)</tr>\n",
@@ -733,12 +733,12 @@
 			fprintf(output, "</table>\n");
 			break;
 
-		  case S_SERVICE_BREAKDOWN:
+		  case XYMON_S_SERVICE_BREAKDOWN:
 			/* Request for a specific host, show breakdown by service */
 			for (cwalk = svccounthead; (cwalk); cwalk = cwalk->next) totalcount += cwalk->total;
 			fprintf(output, "<table summary=\"Breakdown by service\" border=0>\n");
 			fprintf(output, "<tr><th align=left>Service</th><th colspan=2>%s</th></tr>\n",
-				(counttype == COUNT_EVENTS) ? "State changes" : "Seconds red/yellow");
+				(counttype == XYMON_COUNT_EVENTS) ? "State changes" : "Seconds red/yellow");
 			fprintf(output, "<tr><td colspan=3><hr width=\"100%%\"></td></tr>\n");
 			for (cwalk = svccounthead; (cwalk && (cwalk->total > 0)); cwalk = cwalk->next) {
 				fprintf(output, "<tr><td align=left>%s</td><td align=right>%lu</td><td align=right>(%6.2f %%)</tr>\n",
@@ -748,11 +748,11 @@
 			fprintf(output, "</table>\n");
 			break;
 
-		  case S_NONE:
+		  case XYMON_S_NONE:
 			break;
 		}
 
-		if (sumtype == S_NONE) {
+		if (sumtype == XYMON_S_NONE) {
 			int  count;
 			count=0;
 			ewalk=eventhead; 
@@ -783,11 +783,11 @@
 		for (ewalk=eventhead; (ewalk); ewalk=ewalk->next) {
 			char *hostname = xmh_item(ewalk->host, XMH_HOSTNAME);
 
-			if ( (counttype == COUNT_DURATION) &&
+			if ( (counttype == XYMON_COUNT_DURATION) &&
 			     (ewalk->oldcolor < COL_YELLOW) &&
 			     (ewalk->newcolor < COL_YELLOW) ) continue;
 
-			if ( (counttype == COUNT_DURATION) &&
+			if ( (counttype == XYMON_COUNT_DURATION) &&
 			     (ewalk->eventtime >= lastevent) ) continue;
 
 			fprintf(output, "<TR BGCOLOR=%s>\n", bgcolors[bgcolor]);
Index: lib/eventlog.h
===================================================================
--- lib/eventlog.h	(revision 6602)
+++ lib/eventlog.h	(revision 6604)
@@ -35,8 +35,8 @@
 	struct countlist_t *next;
 } countlist_t;
 
-typedef enum { S_NONE, S_HOST_BREAKDOWN, S_SERVICE_BREAKDOWN } eventsummary_t;
-typedef enum { COUNT_NONE, COUNT_EVENTS, COUNT_DURATION } countsummary_t;
+typedef enum { XYMON_S_NONE, XYMON_S_HOST_BREAKDOWN, XYMON_S_SERVICE_BREAKDOWN } eventsummary_t;
+typedef enum { XYMON_COUNT_NONE, XYMON_COUNT_EVENTS, XYMON_COUNT_DURATION } countsummary_t;
 
 typedef int (*f_hostcheck)(char *hostname);
 
Index: web/eventlog.c
===================================================================
--- web/eventlog.c	(revision 6602)
+++ web/eventlog.c	(revision 6604)
@@ -43,8 +43,8 @@
 char	*colorregex = NULL;
 int	ignoredialups = 0;
 int	topcount = 0;
-eventsummary_t summarybar = S_NONE;
-countsummary_t counttype = COUNT_NONE;
+eventsummary_t summarybar = XYMON_S_NONE;
+countsummary_t counttype = XYMON_COUNT_NONE;
 char	*webfile_hf = "event";
 char	*webfile_form = "event_form";
 cgidata_t *cgidata = NULL;
@@ -102,14 +102,14 @@
 			if (*(cwalk->value)) topcount = atoi(cwalk->value);
 		}
 		else if (strcasecmp(cwalk->name, "SUMMARY") == 0) {
-			if (strcasecmp(cwalk->value, "hosts") == 0) summarybar = S_HOST_BREAKDOWN;
-			else if (strcasecmp(cwalk->value, "services") == 0) summarybar = S_SERVICE_BREAKDOWN;
-			else summarybar = S_NONE;
+			if (strcasecmp(cwalk->value, "hosts") == 0) summarybar = XYMON_S_HOST_BREAKDOWN;
+			else if (strcasecmp(cwalk->value, "services") == 0) summarybar = XYMON_S_SERVICE_BREAKDOWN;
+			else summarybar = XYMON_S_NONE;
 		}
 		else if (strcasecmp(cwalk->name, "COUNTTYPE") == 0) {
-			if (strcasecmp(cwalk->value, "events") == 0) counttype = COUNT_EVENTS;
-			else if (strcasecmp(cwalk->value, "duration") == 0) counttype = COUNT_DURATION;
-			else counttype = COUNT_NONE;
+			if (strcasecmp(cwalk->value, "events") == 0) counttype = XYMON_COUNT_EVENTS;
+			else if (strcasecmp(cwalk->value, "duration") == 0) counttype = XYMON_COUNT_DURATION;
+			else counttype = XYMON_COUNT_NONE;
 		}
 		else if (strcasecmp(cwalk->name, "TIMETXT") == 0) {
 			if (*(cwalk->value)) strcpy(periodstring, cwalk->value);
@@ -165,14 +165,14 @@
 		addtobuffer(othercriteria, "&SUMMARY=services");
 		addtobuffer(othercriteria, "&TIMETXT=");
 		addtobuffer(othercriteria, periodstring);
-		if (counttype == COUNT_EVENTS) addtobuffer(othercriteria, "&COUNTTYPE=events");
-		else if (counttype == COUNT_DURATION) addtobuffer(othercriteria, "&COUNTTYPE=duration");
+		if (counttype == XYMON_COUNT_EVENTS) addtobuffer(othercriteria, "&COUNTTYPE=events");
+		else if (counttype == XYMON_COUNT_DURATION) addtobuffer(othercriteria, "&COUNTTYPE=duration");
 
 		fprintf(output, "<td width=40%% align=center valign=top>\n");
 		fprintf(output, "   <table summary=\"Top %d hosts\" border=0>\n", topcount);
 		fprintf(output, "      <tr><th colspan=3>Top %d hosts</th></tr>\n", topcount);
 		fprintf(output, "      <tr><th align=left>Host</th><th align=left colspan=2>%s</th></tr>\n",
-			(counttype == COUNT_EVENTS) ? "State changes" : "Seconds red/yellow");
+			(counttype == XYMON_COUNT_EVENTS) ? "State changes" : "Seconds red/yellow");
 
 		/* Compute the total count */
 		for (i=0, cwalk=hostcounthead; (cwalk); i++, cwalk=cwalk->next) totalcount += cwalk->total;
@@ -246,15 +246,15 @@
 		addtobuffer(othercriteria, "&SUMMARY=hosts");
 		addtobuffer(othercriteria, "&TIMETXT=");
 		addtobuffer(othercriteria, periodstring);
-		if (counttype == COUNT_EVENTS) addtobuffer(othercriteria, "&COUNTTYPE=events");
-		else if (counttype == COUNT_DURATION) addtobuffer(othercriteria, "&COUNTTYPE=duration");
+		if (counttype == XYMON_COUNT_EVENTS) addtobuffer(othercriteria, "&COUNTTYPE=events");
+		else if (counttype == XYMON_COUNT_DURATION) addtobuffer(othercriteria, "&COUNTTYPE=duration");
 
 
 		fprintf(output, "<td width=40%% align=center valign=top>\n");
 		fprintf(output, "   <table summary=\"Top %d services\" border=0>\n", topcount);
 		fprintf(output, "      <tr><th colspan=3>Top %d services</th></tr>\n", topcount);
 		fprintf(output, "      <tr><th align=left>Service</th><th align=left colspan=2>%s</th></tr>\n",
-			(counttype == COUNT_EVENTS) ? "State changes" : "Seconds red/yellow");
+			(counttype == XYMON_COUNT_EVENTS) ? "State changes" : "Seconds red/yellow");
 
 		/* Compute the total count */
 		for (i=0, cwalk=svccounthead; (cwalk); i++, cwalk=cwalk->next) totalcount += cwalk->total;
@@ -360,7 +360,7 @@
 		do_eventlog(NULL, -1, -1, fromtime, totime, 
 			    pageregex, expageregex, hostregex, exhostregex, testregex, extestregex,
 			    colorregex, ignoredialups, NULL,
-			    &events, &hcounts, &scounts, counttype, S_NONE, NULL);
+			    &events, &hcounts, &scounts, counttype, XYMON_S_NONE, NULL);
 
 		lastevent = (totime ? eventreport_time(totime) : getcurrenttime(NULL));
 


Regards,
Henrik



More information about the Xymon mailing list