[netperf-dev] netperf4 commit notice r124 - in branches/glib_migration: . src

raj at netperf.org raj at netperf.org
Tue Apr 4 14:18:36 PDT 2006


Author: raj
Date: 2006-04-04 14:18:34 -0700 (Tue, 04 Apr 2006)
New Revision: 124

Modified:
   branches/glib_migration/config.h.in
   branches/glib_migration/configure
   branches/glib_migration/configure.ac
   branches/glib_migration/src/netlib.c
   branches/glib_migration/src/netperf.c
   branches/glib_migration/src/netperf.h
   branches/glib_migration/src/netserver.c
Log:
More fixes and cleanups and such, some triggered by
the AIX port, others on general principles.


Modified: branches/glib_migration/config.h.in
===================================================================
--- branches/glib_migration/config.h.in	2006-04-04 21:16:57 UTC (rev 123)
+++ branches/glib_migration/config.h.in	2006-04-04 21:18:34 UTC (rev 124)
@@ -9,6 +9,9 @@
 /* Define to 1 if you have the <arpa/nameser.h> header file. */
 #undef HAVE_ARPA_NAMESER_H
 
+/* Define to 1 if you have the `bindprocessor' function. */
+#undef HAVE_BINDPROCESSOR
+
 /* Define to 1 if you have the `bind_to_cpu_id' function. */
 #undef HAVE_BIND_TO_CPU_ID
 

Modified: branches/glib_migration/configure
===================================================================
--- branches/glib_migration/configure	2006-04-04 21:16:57 UTC (rev 123)
+++ branches/glib_migration/configure	2006-04-04 21:18:34 UTC (rev 124)
@@ -20540,6 +20540,11 @@
 
 # likely as good a place as any to see about adding stuff to flags I
 # wonder if this needs to get any more sophisticated than this?
+# normally, these would come from the pkg-config stuff on our
+# dependencies, but since we won't always have our dependencies
+# compiled with the same compiler as we are using, taking the straight
+# --cflags from pkg-config can cause us trouble - in particular, gcc's
+# ever so helpful -pthread option.  sigh
 
 case $target in
      *-*-linux*)
@@ -20548,6 +20553,8 @@
      *-*-hpux*)
         CPPFLAGS="$CPPFLAGS -D_REENTRANT"
 	;;
+     *-*-aix*)
+        CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
 esac
 
 # need to check if the compiler is gcc and if so add -pthread
@@ -22471,7 +22478,8 @@
 
 
 
-for ac_func in mpctl processor_bind sched_setaffinity bind_to_cpu_id
+
+for ac_func in bindprocessor bind_to_cpu_id mpctl processor_bind sched_setaffinity
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -22593,6 +22601,8 @@
 pkg_config_cflags=""
 pkg_config_libs_l=""
 pkg_config_libs_L=""
+pkg_config_other_cflags=""
+pkg_config_other_libs=""
 
 
 
@@ -22702,11 +22712,20 @@
 
     pkg_config_cflags=`$PKG_CONFIG --cflags-only-I \
 			libxml-2.0 glib-2.0 gmodule-2.0 gthread-2.0`
+    pkg_config_other_cflags=`$PKG_CONFIG --cflags-only-other \
+			libxml-2.0 glib-2.0 gmodule-2.0 gthread-2.0`
     pkg_config_libs_L=`$PKG_CONFIG  --libs-only-L \
 			libxml-2.0 glib-2.0 gmodule-2.0  gthread-2.0`
     pkg_config_libs_l=`$PKG_CONFIG  --libs-only-l \
 			libxml-2.0 glib-2.0 gmodule-2.0  gthread-2.0`
+    pkg_config_other_libs=`$PKG_CONFIG  --libs-only-other \
+			libxml-2.0 glib-2.0 gmodule-2.0  gthread-2.0`
 
+echo
+echo "OTHER CFLAGS" $pkg_config_other_cflags
+echo "OTHER LIBS" $pkg_config_other_libs
+echo
+
 # see if we should be enabling histogram support
 
 echo "$as_me:$LINENO: checking whether to include histogram support" >&5

Modified: branches/glib_migration/configure.ac
===================================================================
--- branches/glib_migration/configure.ac	2006-04-04 21:16:57 UTC (rev 123)
+++ branches/glib_migration/configure.ac	2006-04-04 21:18:34 UTC (rev 124)
@@ -27,6 +27,11 @@
 
 # likely as good a place as any to see about adding stuff to flags I
 # wonder if this needs to get any more sophisticated than this?
+# normally, these would come from the pkg-config stuff on our
+# dependencies, but since we won't always have our dependencies
+# compiled with the same compiler as we are using, taking the straight
+# --cflags from pkg-config can cause us trouble - in particular, gcc's
+# ever so helpful -pthread option.  sigh
 
 case $target in 
      *-*-linux*)
@@ -35,6 +40,8 @@
      *-*-hpux*)
         CPPFLAGS="$CPPFLAGS -D_REENTRANT"
 	;;
+     *-*-aix*)
+        CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
 esac
 
 # need to check if the compiler is gcc and if so add -pthread 
@@ -106,7 +113,7 @@
 
 AC_CHECK_FUNCS(sendfile)
 
-AC_CHECK_FUNCS(mpctl processor_bind sched_setaffinity bind_to_cpu_id)
+AC_CHECK_FUNCS(bindprocessor bind_to_cpu_id mpctl processor_bind sched_setaffinity)
 
 # since we are going to depend on pkg-config for glib, might as well
 # use it for libxml2 as well
@@ -126,16 +133,27 @@
 pkg_config_cflags=""
 pkg_config_libs_l=""
 pkg_config_libs_L=""
+pkg_config_other_cflags=""
+pkg_config_other_libs=""
 
     PKG_PROG_PKG_CONFIG()
 
     pkg_config_cflags=`$PKG_CONFIG --cflags-only-I \
 			libxml-2.0 glib-2.0 gmodule-2.0 gthread-2.0`
+    pkg_config_other_cflags=`$PKG_CONFIG --cflags-only-other \
+			libxml-2.0 glib-2.0 gmodule-2.0 gthread-2.0`
     pkg_config_libs_L=`$PKG_CONFIG  --libs-only-L \
 			libxml-2.0 glib-2.0 gmodule-2.0  gthread-2.0`
     pkg_config_libs_l=`$PKG_CONFIG  --libs-only-l \
 			libxml-2.0 glib-2.0 gmodule-2.0  gthread-2.0`
+    pkg_config_other_libs=`$PKG_CONFIG  --libs-only-other \
+			libxml-2.0 glib-2.0 gmodule-2.0  gthread-2.0`
 
+echo
+echo "OTHER CFLAGS" $pkg_config_other_cflags
+echo "OTHER LIBS" $pkg_config_other_libs
+echo
+
 # see if we should be enabling histogram support
 
 AC_MSG_CHECKING(whether to include histogram support)

Modified: branches/glib_migration/src/netlib.c
===================================================================
--- branches/glib_migration/src/netlib.c	2006-04-04 21:16:57 UTC (rev 123)
+++ branches/glib_migration/src/netlib.c	2006-04-04 21:18:34 UTC (rev 124)
@@ -502,7 +502,7 @@
        work, we presume that the name given wasn't a full one, so we
        just slap the NETPERFDIR and path separator in front of the
        name and try again. */
-    NETPERF_SNPRINTF(path,PATH_MAX,"%s%s%s",NETPERFDIR,NETPERF_PATH_SEP,name);
+    NETPERF_SNPRINTF(path,PATH_MAX,"%s%s%s",NETPERFDIR,G_DIR_SEPARATOR_S,name);
     path[PATH_MAX] = '\0';
     if (0 == NETPERF_STAT(path,&buf)) {
       strncpy(full,path,fulllen);
@@ -1179,7 +1179,7 @@
     strcpy(ld_library_path,temp);
     tokens = g_strsplit(ld_library_path,":",15);
     for (tok = 0; tokens[tok] != NULL; tok++) {
-      g_snprintf(full_path,PATH_MAX,"%s%s%s",tokens[tok],NETPERF_PATH_SEP,la);
+      g_snprintf(full_path,PATH_MAX,"%s%s%s",tokens[tok],G_DIR_SEPARATOR_S,la);
       if (g_stat(full_path,&buf) == 0) {
 	/* we have a winner, time to go */
 	break;
@@ -1252,7 +1252,7 @@
 	strcpy(lib,"dlnamefound");
       }
       strcpy(lib,libdir);
-      strcat(lib,NETPERF_PATH_SEP);
+      strcat(lib,G_DIR_SEPARATOR_S);
       strcat(lib,dlname);
     }
     else {
@@ -1360,7 +1360,9 @@
     if (NULL == handle)
       handle = open_library_path(library_name,"Path", FALSE);
     if (NULL == handle)
-      handle = open_library_path(library_name,LIBDIR, TRUE);
+      handle = open_library_path(library_name,
+				 "." G_SEARCHPATH_SEPARATOR_S LIBDIR,
+				 TRUE);
   }
 
   if (debug) {

Modified: branches/glib_migration/src/netperf.c
===================================================================
--- branches/glib_migration/src/netperf.c	2006-04-04 21:16:57 UTC (rev 123)
+++ branches/glib_migration/src/netperf.c	2006-04-04 21:18:34 UTC (rev 124)
@@ -289,9 +289,9 @@
       if (0 == g_stat("default_config.xml",&buf)) {
 	fname = "default_config.xml";
       }
-      else if (0 == g_stat(NETPERFDIR NETPERF_PATH_SEP "default_config.xml",
+      else if (0 == g_stat(NETPERFDIR G_DIR_SEPARATOR_S "default_config.xml",
 			 &buf)) {
-	fname = NETPERFDIR NETPERF_PATH_SEP "default_config.xml";
+	fname = NETPERFDIR G_DIR_SEPARATOR_S "default_config.xml";
       }
       else {
 	fname = "missing config file";
@@ -301,9 +301,9 @@
       if (0 == g_stat("default_commands.xml",&buf)) {
 	fname = "default_commands.xml";
       }
-      else if (0 == g_stat(NETPERFDIR NETPERF_PATH_SEP "default_commands.xml",
+      else if (0 == g_stat(NETPERFDIR G_DIR_SEPARATOR_S "default_commands.xml",
 			 &buf)) {
-	fname = NETPERFDIR NETPERF_PATH_SEP "default_commands.xml";
+	fname = NETPERFDIR G_DIR_SEPARATOR_S "default_commands.xml";
       }
       else {
 	fname = "missing commands file";

Modified: branches/glib_migration/src/netperf.h
===================================================================
--- branches/glib_migration/src/netperf.h	2006-04-04 21:16:57 UTC (rev 123)
+++ branches/glib_migration/src/netperf.h	2006-04-04 21:18:34 UTC (rev 124)
@@ -71,6 +71,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <glib/gprintf.h>
+
 #define NETPERF_MUTEX_T GMutex
 #define NETPERF_RWLOCK_T GStaticRWLock
 #define NETPERF_THREAD_T GThread *
@@ -90,10 +91,10 @@
 
 #include "netperf_hist.h"
 
-#ifdef WIN32
-#define NETPERF_DEBUG_LOG_DIR "c:\\temp\\"
-#define NETPERF_DEBUG_LOG_PREFIX  "netperf"
-#define NETPERF_DEBUG_LOG_SUFFIX  ".log"
+#define NETPERF_DEBUG_LOG_PREFIX "netperf_"
+#define NETPERF_DEBUG_LOG_SUFFIX "_log.txt"
+
+#ifdef G_OS_WIN32
 #define netperf_socklen_t socklen_t
 #define CLOSE_SOCKET(x) closesocket(x)
 #define strcasecmp(a,b) _stricmp(a,b)
@@ -101,9 +102,6 @@
 #define __func__ __FUNCTION__
 #define PATH_MAX MAXPATHLEN
 #else
-#define NETPERF_DEBUG_LOG_DIR "/tmp/"
-#define NETPERF_DEBUG_LOG_PREFIX  "netperf"
-#define NETPERF_DEBUG_LOG_SUFFIX  ".log"
 #define INVALID_SOCKET -1
 #define SOCKET_ERROR -1
 #define SOCKET int
@@ -148,14 +146,13 @@
 #define SET_TEST_DATA(test,ptr)           test->test_specific_data = ptr
 
 
-#ifdef WIN32
+#ifdef G_OS_WIN32
 #define CHECK_FOR_NOT_SOCKET (WSAGetLastError() == WSAENOTSOCK)
 #define CHECK_FOR_INVALID_SOCKET (temp_socket == INVALID_SOCKET)
 #define CHECK_FOR_RECV_ERROR(len) (len == SOCKET_ERROR)
 #define CHECK_FOR_SEND_ERROR(len) (len >= 0) || \
         (len == SOCKET_ERROR && WSAGetLastError() == WSAEINTR)
 #define GET_ERRNO WSAGetLastError()
-#define NETPERF_PATH_SEP "\\"
 #ifndef SHUT_WR
 #define SHUT_WR SD_SEND
 #endif
@@ -165,7 +162,6 @@
 #define CHECK_FOR_RECV_ERROR(len) (len < 0)
 #define CHECK_FOR_SEND_ERROR(len) (len >=0) || (errno == EINTR)
 #define GET_ERRNO errno
-#define NETPERF_PATH_SEP "/"
 #endif
 
 

Modified: branches/glib_migration/src/netserver.c
===================================================================
--- branches/glib_migration/src/netserver.c	2006-04-04 21:16:57 UTC (rev 123)
+++ branches/glib_migration/src/netserver.c	2006-04-04 21:18:34 UTC (rev 124)
@@ -852,8 +852,9 @@
 	  /* switch-over to our own pid-specific logfile */
 	  snprintf(filename,
 		   PATH_MAX,
-		   "%s%s%d%s",
-		   NETPERF_DEBUG_LOG_DIR,
+		   "%s%c%s%d%s",
+		   g_get_tmp_dir(),
+		   G_DIR_SEPARATOR,
 		   NETPERF_DEBUG_LOG_PREFIX,
 		   getpid(),
 		   NETPERF_DEBUG_LOG_SUFFIX);
@@ -1054,8 +1055,9 @@
 	 stderr. this needs to be made a bit more clean one of these days */
       char debugfile[PATH_MAX];
       sprintf(debugfile,
-	      "%s%s_%d%s",
-	      NETPERF_DEBUG_LOG_DIR,
+	      "%s%c%s%d%s",
+	      g_get_tmp_dir(),
+	      G_DIR_SEPARATOR,
 	      NETPERF_DEBUG_LOG_PREFIX,
 	      getpid(),
 	      NETPERF_DEBUG_LOG_SUFFIX);



More information about the netperf-dev mailing list