[netperf-dev] netperf4 commit notice r52 - in trunk: . src

raj at netperf.org raj at netperf.org
Thu Jan 26 11:50:40 PST 2006


Author: raj
Date: 2006-01-26 11:50:34 -0800 (Thu, 26 Jan 2006)
New Revision: 52

Modified:
   trunk/aclocal.m4
   trunk/configure
   trunk/src/netperf.c
   trunk/src/netperf.h
   trunk/src/netserver.c
   trunk/src/nettest_bsd.c
   trunk/src/nettest_dns.c
   trunk/src/nettest_vst.c
Log:
Fix report_flags misunderstanding, and see about doing the right things 
with stdout, stderr, and where when we are children of inetd and or daemonized


Modified: trunk/aclocal.m4
===================================================================
--- trunk/aclocal.m4	2006-01-26 06:00:39 UTC (rev 51)
+++ trunk/aclocal.m4	2006-01-26 19:50:34 UTC (rev 52)
@@ -7039,188 +7039,3 @@
 AC_MSG_RESULT([$SED])
 ])
 
-dnl This comes from libcurl's acinclude.m4.  it is not clear if this
-dnl is original libcurl code, or other code, so we include the libcurl
-dnl copyright here
-dnl
-dnl 
-dnl Copyright (c) 1996 - 2005, Daniel Stenberg, <daniel at haxx.se>.
-dnl 
-dnl All rights reserved.
-dnl 
-dnl Permission to use, copy, modify, and distribute this software for any purpose
-dnl with or without fee is hereby granted, provided that the above copyright
-dnl notice and this permission notice appear in all copies.
-dnl 
-dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
-dnl NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
-dnl OR OTHER DEALINGS IN THE SOFTWARE.
-dnl 
-dnl Except as contained in this notice, the name of a copyright holder shall not
-dnl be used in advertising or otherwise to promote the sale, use or other dealings
-dnl in this Software without prior written authorization of the copyright holder.
-
-dnl Check for socklen_t: historically on BSD it is an int, and in
-dnl POSIX 1g it is a type of its own, but some platforms use different
-dnl types for the argument to getsockopt, getpeername, etc.  So we
-dnl have to test to find something that will work.
-
-dnl Remove the AC_CHECK_TYPE - on HP-UX it would find a socklen_t, but the 
-dnl function prototypes for getsockopt et al will not actually use 
-dnl socklen_t args unless _XOPEN_SOURCE_EXTENDED is defined. so, the
-dnl AC_CHECK_TYPE will find a socklen_t and think all is happiness and
-dnl joy when you will really get warnings about mismatch types - type
-dnl mismatches that would be possibly Bad (tm) in a 64-bit compile.
-dnl raj 2005-05-11 this change may be redistributed at will 
-
-dnl also, added "extern" to the "int getpeername" in an attempt to resolve
-dnl an issue with this code under Solaris 2.9.  this too may be 
-dnl redistributed at will
-
-AC_DEFUN([OLD_TYPE_SOCKLEN_T],
-[
-      AC_MSG_CHECKING([for socklen_t equivalent])
-      AC_CACHE_VAL([curl_cv_socklen_t_equiv],
-      [
-         # Systems have either "struct sockaddr *" or
-         # "void *" as the second argument to getpeername
-         curl_cv_socklen_t_equiv=
-         for arg2 in "struct sockaddr" void; do
-            for t in int size_t unsigned long "unsigned long" socklen_t; do
-               AC_TRY_COMPILE([
-                  #ifdef HAVE_SYS_TYPES_H
-                  #include <sys/types.h>
-                  #endif
-                  #ifdef HAVE_SYS_SOCKET_H
-                  #include <sys/socket.h>
-                  #endif
-
-                  extern int getpeername (int, $arg2 *, $t *);
-               ],[
-                  $t len;
-                  getpeername(0,0,&len);
-               ],[
-                  curl_cv_socklen_t_equiv="$t"
-                  break
-               ])
-            done
-         done
-
-         if test "x$curl_cv_socklen_t_equiv" = x; then
-	# take a wild guess
-            curl_cv_socklen_t_equiv="socklen_t"
-            AC_MSG_WARN([Cannot find a type to use in place of socklen_t, guessing socklen_t])
-         fi
-      ])
-      AC_MSG_RESULT($curl_cv_socklen_t_equiv)
-      AC_DEFINE_UNQUOTED(netperf_socklen_t, $curl_cv_socklen_t_equiv,
-                        [type to use in place of socklen_t if not defined])
-])
-
-dnl *
-dnl * Copyright (c) 2001  Motoyuki Kasahara
-dnl *
-dnl * Redistribution and use in source and binary forms, with or without
-dnl * modification, are permitted provided that the following conditions
-dnl * are met:
-dnl * 1. Redistributions of source code must retain the above copyright
-dnl *    notice, this list of conditions and the following disclaimer.
-dnl * 2. Redistributions in binary form must reproduce the above copyright
-dnl *    notice, this list of conditions and the following disclaimer in the
-dnl *    documentation and/or other materials provided with the distribution.
-dnl * 3. Neither the name of the project nor the names of its contributors
-dnl *    may be used to endorse or promote products derived from this software
-dnl *    without specific prior written permission.
-dnl * 
-dnl * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
-dnl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-dnl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-dnl * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORSBE
-dnl * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-dnl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-dnl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-dnl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-dnl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-dnl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-dnl * THE POSSIBILITY OF SUCH DAMAGE.
-dnl *
-
-dnl * 
-dnl * Check for h_errno.
-dnl *
-AC_DEFUN([AC_DECL_H_ERRNO],
-[AC_CACHE_CHECK(for h_errno declaration in netdb.h, ac_cv_decl_h_errno,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include <netdb.h>]], [[
-h_errno = 0;
-]])],[ac_cv_decl_h_errno=yes],[ac_cv_decl_h_errno=no])])
-if test "$ac_cv_decl_h_errno" = yes; then
-    AC_DEFINE(H_ERRNO_DECLARED, 1,
-[Define to 1 if `h_errno' is declared by <netdb.h>])
-fi])
-
-dnl *
-dnl * Copyright (c) 2001  Motoyuki Kasahara
-dnl *
-dnl * Redistribution and use in source and binary forms, with or without
-dnl * modification, are permitted provided that the following conditions
-dnl * are met:
-dnl * 1. Redistributions of source code must retain the above copyright
-dnl *    notice, this list of conditions and the following disclaimer.
-dnl * 2. Redistributions in binary form must reproduce the above copyright
-dnl *    notice, this list of conditions and the following disclaimer in the
-dnl *    documentation and/or other materials provided with the distribution.
-dnl * 3. Neither the name of the project nor the names of its contributors
-dnl *    may be used to endorse or promote products derived from this software
-dnl *    without specific prior written permission.
-dnl * 
-dnl * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
-dnl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-dnl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-dnl * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORSBE
-dnl * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-dnl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-dnl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-dnl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-dnl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-dnl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-dnl * THE POSSIBILITY OF SUCH DAMAGE.
-dnl *
-
-dnl * 
-dnl * Check for struct sockaddr_in6
-dnl *
-AC_DEFUN([AC_STRUCT_SOCKADDR_IN6],
-[AC_CACHE_CHECK(for struct sockaddr_in6, ac_cv_struct_sockaddr_in6,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>]], [[
-struct sockaddr_in6 address;
-]])],[ac_cv_struct_sockaddr_in6=yes],[ac_cv_struct_sockaddr_in6=no])])
-if test "$ac_cv_struct_sockaddr_in6" = yes; then
-    AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
-[Define to 1 if <netinet/in.h> defines `struct sockaddr_in6'])
-fi])
-
-dnl * 
-dnl * Check for struct sockaddr_storage
-dnl * 
-AC_DEFUN([AC_STRUCT_SOCKADDR_STORAGE],
-[AC_CACHE_CHECK(for struct sockaddr_storage, ac_cv_struct_sockaddr_storage,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>]], [[
-struct sockaddr_storage address;
-]])],[ac_cv_struct_sockaddr_storage=yes],[ac_cv_struct_sockaddr_storage=no])])
-if test "$ac_cv_struct_sockaddr_storage" = yes; then
-    AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
-[Define to 1 if <netinet/in.h> defines `struct sockaddr_storage'])
-fi])
-
-

Modified: trunk/configure
===================================================================
--- trunk/configure	2006-01-26 06:00:39 UTC (rev 51)
+++ trunk/configure	2006-01-26 19:50:34 UTC (rev 52)
@@ -21622,224 +21622,11 @@
 
 # AC_TYPE_SOCKLEN_T
 
+OLD_TYPE_SOCKLEN_T
 
-      echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5
-echo $ECHO_N "checking for socklen_t equivalent... $ECHO_C" >&6
-      if test "${curl_cv_socklen_t_equiv+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-         # Systems have either "struct sockaddr *" or
-         # "void *" as the second argument to getpeername
-         curl_cv_socklen_t_equiv=
-         for arg2 in "struct sockaddr" void; do
-            for t in int size_t unsigned long "unsigned long" socklen_t; do
-               cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-                  #ifdef HAVE_SYS_TYPES_H
-                  #include <sys/types.h>
-                  #endif
-                  #ifdef HAVE_SYS_SOCKET_H
-                  #include <sys/socket.h>
-                  #endif
-
-                  extern int getpeername (int, $arg2 *, $t *);
-
-int
-main ()
-{
-
-                  $t len;
-                  getpeername(0,0,&len);
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-
-                  curl_cv_socklen_t_equiv="$t"
-                  break
-
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-            done
-         done
-
-         if test "x$curl_cv_socklen_t_equiv" = x; then
-	# take a wild guess
-            curl_cv_socklen_t_equiv="socklen_t"
-            { echo "$as_me:$LINENO: WARNING: Cannot find a type to use in place of socklen_t, guessing socklen_t" >&5
-echo "$as_me: WARNING: Cannot find a type to use in place of socklen_t, guessing socklen_t" >&2;}
-         fi
-
-fi
-
-      echo "$as_me:$LINENO: result: $curl_cv_socklen_t_equiv" >&5
-echo "${ECHO_T}$curl_cv_socklen_t_equiv" >&6
-
-cat >>confdefs.h <<_ACEOF
-#define netperf_socklen_t $curl_cv_socklen_t_equiv
-_ACEOF
-
-
-
 # AC_TYPE_IN_PORT_T
-echo "$as_me:$LINENO: checking for h_errno declaration in netdb.h" >&5
-echo $ECHO_N "checking for h_errno declaration in netdb.h... $ECHO_C" >&6
-if test "${ac_cv_decl_h_errno+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#include <netdb.h>
-int
-main ()
-{
-
-h_errno = 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_decl_h_errno=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_decl_h_errno=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_decl_h_errno" >&5
-echo "${ECHO_T}$ac_cv_decl_h_errno" >&6
-if test "$ac_cv_decl_h_errno" = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define H_ERRNO_DECLARED 1
-_ACEOF
-
-fi
-echo "$as_me:$LINENO: checking for struct sockaddr_storage" >&5
-echo $ECHO_N "checking for struct sockaddr_storage... $ECHO_C" >&6
-if test "${ac_cv_struct_sockaddr_storage+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-int
-main ()
-{
-
-struct sockaddr_storage address;
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_struct_sockaddr_storage=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_struct_sockaddr_storage=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_struct_sockaddr_storage" >&5
-echo "${ECHO_T}$ac_cv_struct_sockaddr_storage" >&6
-if test "$ac_cv_struct_sockaddr_storage" = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRUCT_SOCKADDR_STORAGE 1
-_ACEOF
-
-fi
+AC_DECL_H_ERRNO
+AC_STRUCT_SOCKADDR_STORAGE
 echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
 if test "${ac_cv_header_time+set}" = set; then

Modified: trunk/src/netperf.c
===================================================================
--- trunk/src/netperf.c	2006-01-26 06:00:39 UTC (rev 51)
+++ trunk/src/netperf.c	2006-01-26 19:50:34 UTC (rev 52)
@@ -67,6 +67,10 @@
 #include <unistd.h>
 #endif
 
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
 #ifndef HAVE_GETOPT_LONG
 #include "missing/getopt.h"
 #else
@@ -1367,14 +1371,6 @@
   set_name      = xmlGetProp(my_cmd,(const xmlChar *)"test_set");
   report_flags  = (char *)xmlGetProp(my_cmd,(const xmlChar *)"report_flags");
 
-  if (NULL == report_flags) {
-    fprintf(where,
-	    "Error: report_flags NULL in %s\n",
-	    __func__);
-    fflush(where);
-    return(NPE_EMPTY_MSG);
-  }
-
   output_file   = (char *)xmlGetProp(my_cmd,(const xmlChar *)"output_file");
 
   /* once more, we have to make sure that there really is a valid

Modified: trunk/src/netperf.h
===================================================================
--- trunk/src/netperf.h	2006-01-26 06:00:39 UTC (rev 51)
+++ trunk/src/netperf.h	2006-01-26 19:50:34 UTC (rev 52)
@@ -50,6 +50,15 @@
 #define HIST  void*
 #endif
 
+#ifndef WIN32
+#define NETPERF_DEBUG_LOG_DIR "c:\\temp\\"
+#define NETPERF_DEBUG_LOG_PREFIX  "netperf"
+#define NETPERF_DEBUG_LOG_SUFFIX  ".log"
+#else
+#define NETPERF_DEBUG_LOG_DIR "/tmp/"
+#define NETPERF_DEBUG_LOG_PREFIX  "netperf"
+#define NETPERF_DEBUG_LOG_SUFFIX  ".log"
+#endif
 
 #include "netconfidence.h"
 

Modified: trunk/src/netserver.c
===================================================================
--- trunk/src/netserver.c	2006-01-26 06:00:39 UTC (rev 51)
+++ trunk/src/netserver.c	2006-01-26 19:50:34 UTC (rev 52)
@@ -75,6 +75,10 @@
 #include <poll.h>
 #endif
 
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
@@ -424,6 +428,7 @@
 void
 daemonize()
 {
+  char filename[PATH_MAX];
 
   /* fork off - only the client will return, the parent will exit */
   
@@ -433,13 +438,30 @@
     perror("netserver fork error");
     exit(-1);
   case 0:
-    /* we are the child process. set ourselves up ad the session
+    /* we are the child process. set ourselves up as the session
        leader so we detatch from the parent, and then return to the
        caller so he can do whatever it is he wants to do */
 
     fclose(stdin);
-    fclose(stderr);
 
+    snprintf(filename,
+	     PATH_MAX,
+	     "%s%s%d%s",
+	     NETPERF_DEBUG_LOG_DIR,
+	     NETPERF_DEBUG_LOG_PREFIX,
+	     getpid(),
+	     NETPERF_DEBUG_LOG_SUFFIX);
+    where = freopen(where,filename,"w");
+    if (NULL == where) {
+      fprintf(stderr,
+	      "ERROR netserver could not freopen where to %s errno %d\n",
+	      filename,
+	      errno);
+      fflush(stderr);
+      exit(-1);
+    }
+
+    /* at this point should I close stderr?!? */
     setsid();
 
     /* not all OSes have SIGCLD as SIGCHLD */
@@ -762,6 +784,7 @@
   int               sock;
   int               listenfd     = 0;
   int               loop         = 1;
+  char              filename[PATH_MAX];
 
   NETPERF_DEBUG_ENTRY(debug,where);
 
@@ -841,6 +864,25 @@
 	     go ahead and close it */
 	  printf("child closing %d\n",listenfd);
 	  close(listenfd);
+
+	  /* switch-over to our own pid-specific logfile */
+	  snprintf(filename,
+		   PATH_MAX,
+		   "%s%s%d%s",
+		   NETPERF_DEBUG_LOG_DIR,
+		   NETPERF_DEBUG_LOG_PREFIX,
+		   getpid(),
+		   NETPERF_DEBUG_LOG_SUFFIX);
+	  
+	  where = freopen(where,filename,"w");
+	  if (NULL == where) {
+	    fprintf(stderr,
+		    "ERROR netserver could not freopen where to %s errno %d\n",
+		    filename,
+		    errno);
+	    fflush(stderr);
+	    exit(-1);
+	  }
 	  handle_netperf_requests(sock);
 	  /* as the child, if we've no more requests to process - eg
 	     the connection has closed etc, then we might as well just
@@ -916,7 +958,7 @@
 
   program_name = argv[0];
 
-  where = stdout;
+  where = stderr;
 
   decode_command_line(argc, argv);
 

Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c	2006-01-26 06:00:39 UTC (rev 51)
+++ trunk/src/nettest_bsd.c	2006-01-26 19:50:34 UTC (rev 52)
@@ -2433,16 +2433,18 @@
     rd->result_maximum = DBL_MIN;
     rd->outfd          = outfd;
     rd->sd_denominator = 0.0;
-    if (!strcmp(report_flags,"PRINT_RUN")) {
-      rd->print_run  = 1;
+    if (NULL != report_flags) {
+      if (!strcmp(report_flags,"PRINT_RUN")) {
+	rd->print_run  = 1;
+      }
+      if (!strcmp(report_flags,"PRINT_TESTS")) {
+	rd->print_test = 1;
+      }
+      if (!strcmp(report_flags,"PRINT_ALL")) {
+	rd->print_run  = 1;
+	rd->print_test = 1;
+      }
     }
-    if (!strcmp(report_flags,"PRINT_TESTS")) {
-      rd->print_test = 1;
-    }
-    if (!strcmp(report_flags,"PRINT_ALL")) {
-      rd->print_run  = 1;
-      rd->print_test = 1;
-    }
     if (test_set->debug) {
       rd->print_run  = 1;
       rd->print_test = 1;

Modified: trunk/src/nettest_dns.c
===================================================================
--- trunk/src/nettest_dns.c	2006-01-26 06:00:39 UTC (rev 51)
+++ trunk/src/nettest_dns.c	2006-01-26 19:50:34 UTC (rev 52)
@@ -1862,16 +1862,19 @@
     rd->result_maximum = DBL_MIN;
     rd->outfd          = outfd;
     rd->sd_denominator = 0.0;
-    if (!strcmp(report_flags,"PRINT_RUN")) {
-      rd->print_run  = 1;
+    /* not all strcmp's play well with a NULL pointer */
+    if (NULL != report_flags) {
+      if (!strcmp(report_flags,"PRINT_RUN")) {
+	rd->print_run  = 1;
+      }
+      if (!strcmp(report_flags,"PRINT_TESTS")) {
+	rd->print_test = 1;
+      }
+      if (!strcmp(report_flags,"PRINT_ALL")) {
+	rd->print_run  = 1;
+	rd->print_test = 1;
+      }
     }
-    if (!strcmp(report_flags,"PRINT_TESTS")) {
-      rd->print_test = 1;
-    }
-    if (!strcmp(report_flags,"PRINT_ALL")) {
-      rd->print_run  = 1;
-      rd->print_test = 1;
-    }
     if (test_set->debug) {
       rd->print_run  = 1;
       rd->print_test = 1;

Modified: trunk/src/nettest_vst.c
===================================================================
--- trunk/src/nettest_vst.c	2006-01-26 06:00:39 UTC (rev 51)
+++ trunk/src/nettest_vst.c	2006-01-26 19:50:34 UTC (rev 52)
@@ -5,7 +5,7 @@
 
 #ifndef lint
 char    nettest_id[]="\
-@(#)nettest_vst.c (c) Copyright 2005 Hewlett-Packard Co. $Id: nettest_vst.c 2005-12-23 00:43:09Z sgb $";
+@(#)nettest_vst.c (c) Copyright 2005 Hewlett-Packard Co. $Id$";
 #else
 #define DIRTY
 #define WANT_HISTOGRAM
@@ -2370,16 +2370,19 @@
     rd->result_maximum = DBL_MIN;
     rd->outfd          = outfd;
     rd->sd_denominator = 0.0;
-    if (!strcmp(report_flags,"PRINT_RUN")) {
-      rd->print_run  = 1;
+    /* not all strcmp's play well with NULL pointers. bummer */
+    if (NULL != report_flags) {
+      if (!strcmp(report_flags,"PRINT_RUN")) {
+	rd->print_run  = 1;
+      }
+      if (!strcmp(report_flags,"PRINT_TESTS")) {
+	rd->print_test = 1;
+      }
+      if (!strcmp(report_flags,"PRINT_ALL")) {
+	rd->print_run  = 1;
+	rd->print_test = 1;
+      }
     }
-    if (!strcmp(report_flags,"PRINT_TESTS")) {
-      rd->print_test = 1;
-    }
-    if (!strcmp(report_flags,"PRINT_ALL")) {
-      rd->print_run  = 1;
-      rd->print_test = 1;
-    }
     if (test_set->debug) {
       rd->print_run  = 1;
       rd->print_test = 1;



More information about the netperf-dev mailing list