[netperf-dev] netperf2 commit notice r437 - in trunk: . src

raj at netperf.org raj at netperf.org
Mon Jul 18 11:52:32 PDT 2011


Author: raj
Date: 2011-07-18 11:52:32 -0700 (Mon, 18 Jul 2011)
New Revision: 437

Modified:
   trunk/Release_Notes
   trunk/src/netcpu_procstat.c
   trunk/src/netlib.c
   trunk/src/netserver.c
   trunk/src/nettest_omni.c
Log:
assorted cleanups and delete empty debug files

Modified: trunk/Release_Notes
===================================================================
--- trunk/Release_Notes	2011-07-15 23:21:30 UTC (rev 436)
+++ trunk/Release_Notes	2011-07-18 18:52:32 UTC (rev 437)
@@ -1,5 +1,11 @@
 These are the Release Notes for post-revision 2.4.5 of netperf:
 
+*) As it has been two years since the defect in Solaris getaddrinfo()
+   was submitted, it should be the case that a fix is available, so it
+   should no longer be necessary to "hide" the "Hey your platform's
+   getaddrinfo() call is buggy" warning.  Consequently, it is no
+   longer being suppressed.
+
 *) A new global command line option - -S - has been added to enable
    setting of SO_KEEPALIVE on the data socket.  This will affect the
    netperf side of the "classic" netperf tests, and will also affect

Modified: trunk/src/netcpu_procstat.c
===================================================================
--- trunk/src/netcpu_procstat.c	2011-07-15 23:21:30 UTC (rev 436)
+++ trunk/src/netcpu_procstat.c	2011-07-18 18:52:32 UTC (rev 437)
@@ -62,7 +62,7 @@
 
 
 /* The max. length of one line of /proc/stat cpu output */
-#define CPU_LINE_LENGTH ((CPU_STATES * sizeof (long) / 3 + 1) * 4 + 8)
+#define CPU_LINE_LENGTH (int)((CPU_STATES * sizeof (long) / 3 + 1) * 4 + 8)
 #define PROC_STAT_FILE_NAME "/proc/stat"
 #define N_CPU_LINES(nr) (nr == 1 ? 1 : 1 + nr)
 
@@ -93,7 +93,7 @@
     proc_stat_buflen = N_CPU_LINES (lib_num_loc_cpus) * CPU_LINE_LENGTH;
     if (debug) {
       fprintf(where,
-	      "lib_num_loc_cpus %d lines %d CPU_LINE_LENGTH %lu proc_stat_buflen %d\n",
+	      "lib_num_loc_cpus %d lines %d CPU_LINE_LENGTH %d proc_stat_buflen %d\n",
 	      lib_num_loc_cpus,
 	      N_CPU_LINES(lib_num_loc_cpus),
 	      CPU_LINE_LENGTH,
@@ -140,7 +140,7 @@
     proc_stat_buflen = N_CPU_LINES (lib_num_loc_cpus) * CPU_LINE_LENGTH;
     if (debug) {
       fprintf(where,
-	      "calibrate: lib_num_loc_cpus %d lines %d CPU_LINE_LENGTH %lu proc_stat_buflen %d\n",
+	      "calibrate: lib_num_loc_cpus %d lines %d CPU_LINE_LENGTH %d proc_stat_buflen %d\n",
 	      lib_num_loc_cpus,
 	      N_CPU_LINES(lib_num_loc_cpus),
 	      CPU_LINE_LENGTH,

Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c	2011-07-15 23:21:30 UTC (rev 436)
+++ trunk/src/netlib.c	2011-07-18 18:52:32 UTC (rev 437)
@@ -2989,7 +2989,6 @@
       for (i = 0; i < temp->ai_addrlen; i++) {
 	fprintf(dumploc,
 		(temp->ai_family == AF_INET) ? " %d" : " %.2x",
-		(u_char)ai_addr->sa_data[i],
 		(u_char)ai_addr->sa_data[i]);
       }
       fprintf(dumploc,"\n");
@@ -4038,7 +4037,7 @@
   *min = h->hmin;
   *max = h->hmax;
   if (h->total){
-    *mean = h->sum / h->total;
+    *mean = (double)h->sum / (double)h->total;
     *stddev = (h->sumsquare * h->total - pow(h->sum, 2)) / pow(h->total, 2);
     *stddev = sqrt(*stddev);
   }

Modified: trunk/src/netserver.c
===================================================================
--- trunk/src/netserver.c	2011-07-15 23:21:30 UTC (rev 436)
+++ trunk/src/netserver.c	2011-07-18 18:52:32 UTC (rev 437)
@@ -170,7 +170,13 @@
 #define DEBUG_LOG_FILE DEBUG_LOG_FILE_DIR"netserver.debug"
 #endif
 
+#if !defined(PATH_MAX)
+#define PATH_MAX MAX_PATH
+#endif
+char     FileName[PATH_MAX];
 
+
+
 char     listen_port[10];
 
 struct listen_elt {
@@ -189,6 +195,7 @@
 int      not_inetd;
 int      want_daemonize;
 int      spawn_on_accept;
+int      suppress_debug = 0;
 
 extern	char	*optarg;
 extern	int	optind, opterr;
@@ -214,16 +221,26 @@
   netperf_daemon = 0;
 }
 
+void
+unlink_empty_debug_file() {
+
+#if !defined(WIN32)
+  struct stat buf;
+
+  if (stat(FileName,&buf)== 0) {
+
+    if (buf.st_size == 0) 
+      unlink(FileName);
+  }
+#endif
+}
+
 /* it is important that set_server_sock() be called before this
    routine as we depend on the control socket being dup()ed out of the
    way when we go messing about with the streams. */
 void
 open_debug_file() 
 {
-#if !defined(PATH_MAX)
-#define PATH_MAX MAX_PATH
-#endif
-
 #if !defined WIN32
 #define NETPERF_NULL "/dev/null"
 #else
@@ -231,8 +248,6 @@
 #endif
 
   FILE *rd_null_fp;
-  char FileName[PATH_MAX];   /* for opening the debug log file */
-  int  fp;
 
   if (where != NULL) fflush(where);
 
@@ -1483,6 +1498,8 @@
     accept_connections();
   }
 
+  unlink_empty_debug_file();
+
 #ifdef WIN32
   WSACleanup();
 #endif

Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c	2011-07-15 23:21:30 UTC (rev 436)
+++ trunk/src/nettest_omni.c	2011-07-18 18:52:32 UTC (rev 437)
@@ -4263,7 +4263,7 @@
 }
 
 int
-recv_data(SOCKET data_socket, struct ring_elt *recv_ring, uint32_t bytes_to_recv, struct sockaddr *source, int *sourcelen, uint32_t flags, uint32_t *num_receives) {
+recv_data(SOCKET data_socket, struct ring_elt *recv_ring, uint32_t bytes_to_recv, struct sockaddr *source, netperf_socklen_t *sourcelen, uint32_t flags, uint32_t *num_receives) {
 
   char *temp_message_ptr;
   int bytes_left;
@@ -4515,14 +4515,15 @@
 #ifdef HAVE_LINUX_TCP_H
   struct tcp_info tcp_info;
 
-  int ret, infosize;
+  int ret;
+  netperf_socklen_t infosize;
 
   if (protocol != IPPROTO_TCP)
     return -1;
 
   infosize = sizeof(struct tcp_info);
 
-  if (ret = getsockopt(socket,protocol,TCP_INFO,&tcp_info,&infosize)) {
+  if ((ret = getsockopt(socket,protocol,TCP_INFO,&tcp_info,&infosize)) == 0) {
     if (debug) {
       fprintf(where,
 	      "get_tcp_retrans:getsockopt errno %d %s\n",
@@ -4647,7 +4648,7 @@
   SOCKET	data_socket;
   int           need_socket;
 
-  int   temp_recvs;
+  uint32_t   temp_recvs;
   char  tmpfmt;
   
   struct addrinfo *local_res;
@@ -5385,7 +5386,7 @@
 	  requests_this_cwnd = 0;
 	  if (debug) {
 	    fprintf(where,
-		    "incr req_cwnd to %d first_burst %d reqs_outstndng %di trans %lu\n",
+		    "incr req_cwnd to %d first_burst %d reqs_outstndng %di trans %"PRIu64"\n",
 		    request_cwnd,
 		    first_burst_size,
 		    requests_outstanding,
@@ -5972,7 +5973,7 @@
   int   need_to_accept;
   int   connected;
   int   ret;
-  int   temp_recvs;
+  uint32_t   temp_recvs;
   
   struct	omni_request_struct	*omni_request;
   struct	omni_response_struct	*omni_response;
@@ -6418,9 +6419,6 @@
 	   something else? that is an exceedingly good question and
 	   one for which I don't presently have a good answer, but
 	   that won't stop me from guessing :) raj 2008-01-09 */
-	fprintf(where,"read zero conn_test %d null_message_ok %d\n",
-		connection_test,null_message_ok);
-	fflush(where);
 	if (!((connection_test) || (null_message_ok))) {
 	  /* if it is neither a connection_test nor null_message_ok it
 	     must be the end of the test */



More information about the netperf-dev mailing list