[collectd] [PATCH] Solaris 8 fixes

collectd at wattapower.net collectd at wattapower.net
Wed Apr 28 22:41:46 CEST 2010


From: Aurélien Reynaud <collectd at wattapower.net>

---
 configure.in                   |    6 +++++-
 src/exec.c                     |   12 ++++++++++++
 src/libcollectdclient/client.h |    4 +++-
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index 3224526..35809ac 100644
--- a/configure.in
+++ b/configure.in
@@ -87,6 +87,7 @@ fi
 if test "x$ac_system" = "xSolaris"
 then
 	AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
+	AC_DEFINE(__EXTENSIONS__, 1, [Define to allow access to functions widely used but not in the standard Solaris environment.])
 fi
 
 # Where to install .pc files.
@@ -477,7 +478,7 @@ AC_HEADER_TIME
 # Checks for library functions.
 #
 AC_PROG_GCC_TRADITIONAL
-AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf if_indextoname)
+AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf if_indextoname setenv)
 
 AC_FUNC_STRERROR_R
 
@@ -715,6 +716,7 @@ if test "x$fp_layout_type" = "xunknown"; then
 #if HAVE_STDINT_H
 # include <stdint.h>
 #endif
+#include <inttypes.h>
 #if HAVE_STDBOOL_H
 # include <stdbool.h>
 #endif
@@ -759,6 +761,7 @@ if test "x$fp_layout_type" = "xunknown"; then
 #if HAVE_STDINT_H
 # include <stdint.h>
 #endif
+#include <inttypes.h>
 #if HAVE_STDBOOL_H
 # include <stdbool.h>
 #endif
@@ -811,6 +814,7 @@ if test "x$fp_layout_type" = "xunknown"; then
 #if HAVE_STDINT_H
 # include <stdint.h>
 #endif
+#include <inttypes.h>
 #if HAVE_STDBOOL_H
 # include <stdbool.h>
 #endif
diff --git a/src/exec.c b/src/exec.c
index 681b94d..c64f949 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -269,11 +269,23 @@ static void set_environment (void) /* {{{ */
 {
   char buffer[1024];
 
+#ifdef HAVE_SETENV
   ssnprintf (buffer, sizeof (buffer), "%i", interval_g);
   setenv ("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1);
 
   ssnprintf (buffer, sizeof (buffer), "%s", hostname_g);
   setenv ("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1);
+#else
+  ssnprintf (buffer, sizeof (buffer), "COLLECTD_INTERVAL=%i", interval_g);
+  putenv (buffer);
+
+  ssnprintf (buffer, sizeof (buffer), "COLLECTD_HOSTNAME=%s", hostname_g);
+  putenv (buffer);
+#endif
+
+#ifdef HAVE_SETENV
+#else
+#endif
 } /* }}} void set_environment */
 
 __attribute__((noreturn))
diff --git a/src/libcollectdclient/client.h b/src/libcollectdclient/client.h
index b0d092d..11e7b13 100644
--- a/src/libcollectdclient/client.h
+++ b/src/libcollectdclient/client.h
@@ -27,7 +27,9 @@
 /*
  * Includes (for data types)
  */
-#include <stdint.h>
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
 #include <inttypes.h>
 #include <time.h>
 
-- 
1.7.0.4




More information about the collectd mailing list