iperf-patch 4.83 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Index: include/headers.h
===================================================================
RCS file: /usr/flux/CVS/emulab-iperf/include/headers.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 headers.h
*** include/headers.h	24 Oct 2005 15:18:33 -0000	1.1.1.1
--- include/headers.h	24 Oct 2005 16:06:09 -0000
***************
*** 180,186 ****
--- 180,190 ----
  // from the gnu archive
  
  #include <iperf-int.h>
+ #ifdef __FreeBSD__
+ typedef uint64_t max_size_t;
+ #else
  typedef uintmax_t max_size_t;
+ #endif
  
  /* in case the OS doesn't have these, we provide our own implementations */
  #include "gettimeofday.h"
Index: src/Client.cpp
Leigh B. Stoller's avatar
Leigh B. Stoller committed
23 24 25
diff -c src/Client.cpp:1.1 src/Client.cpp:1.3
*** src/Client.cpp:1.1	Mon Oct 24 09:18:33 2005
--- src/Client.cpp	Tue Nov  8 17:10:42 2005
26
***************
Leigh B. Stoller's avatar
Leigh B. Stoller committed
27 28
*** 216,228 ****
          // perform write 
29 30 31 32
          currLen = write( mSettings->mSock, mBuf, mSettings->mBufLen ); 
          if ( currLen < 0 ) {
!             WARN_errno( currLen < 0, "write2" ); 
!             break; 
Leigh B. Stoller's avatar
Leigh B. Stoller committed
33
          }
34 35 36 37
  
!         // report packets 
!         reportstruct->packetLen = currLen;
!         ReportPacket( mSettings->reporthdr, reportstruct );
Leigh B. Stoller's avatar
Leigh B. Stoller committed
38
          
39 40
          if ( delay > 0 ) {
              delay_loop( delay ); 
Leigh B. Stoller's avatar
Leigh B. Stoller committed
41 42
--- 216,231 ----
          // perform write 
43 44 45 46 47 48
          currLen = write( mSettings->mSock, mBuf, mSettings->mBufLen ); 
          if ( currLen < 0 ) {
! 	    if (errno != ENOBUFS) {
!                 WARN_errno( currLen < 0, "write2" ); 
! 		break;
! 	    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
49 50
! 	    currLen = 0;
          }
51
  
Leigh B. Stoller's avatar
Leigh B. Stoller committed
52 53 54 55
! 	// report packets 
! 	reportstruct->packetLen = currLen;
! 	ReportPacket( mSettings->reporthdr, reportstruct );
          
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
          if ( delay > 0 ) {
              delay_loop( delay ); 
Index: src/Makefile.in
===================================================================
RCS file: /usr/flux/CVS/emulab-iperf/src/Makefile.in,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile.in
*** src/Makefile.in	24 Oct 2005 15:18:33 -0000	1.1.1.1
--- src/Makefile.in	24 Oct 2005 16:06:10 -0000
***************
*** 38,44 ****
  POST_UNINSTALL = :
  build_triplet = @build@
  host_triplet = @host@
! bin_PROGRAMS = iperf$(EXEEXT)
  subdir = src
  DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
--- 38,44 ----
  POST_UNINSTALL = :
  build_triplet = @build@
  host_triplet = @host@
! bin_PROGRAMS = emulab-iperf$(EXEEXT)
  subdir = src
  DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
***************
*** 266,273 ****
  
  clean-binPROGRAMS:
  	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
! iperf$(EXEEXT): $(iperf_OBJECTS) $(iperf_DEPENDENCIES) 
! 	@rm -f iperf$(EXEEXT)
  	$(CXXLINK) $(iperf_LDFLAGS) $(iperf_OBJECTS) $(iperf_LDADD) $(LIBS)
  
  mostlyclean-compile:
--- 266,273 ----
  
  clean-binPROGRAMS:
  	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
! emulab-iperf$(EXEEXT): $(iperf_OBJECTS) $(iperf_DEPENDENCIES) 
! 	@rm -f emulab-iperf$(EXEEXT)
  	$(CXXLINK) $(iperf_LDFLAGS) $(iperf_OBJECTS) $(iperf_LDADD) $(LIBS)
  
  mostlyclean-compile:
Index: src/main.cpp
===================================================================
RCS file: /usr/flux/CVS/emulab-iperf/src/main.cpp,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 main.cpp
*** src/main.cpp	24 Oct 2005 15:18:34 -0000	1.1.1.1
--- src/main.cpp	24 Oct 2005 16:06:10 -0000
***************
*** 163,168 ****
--- 163,173 ----
      // read settings from command-line parameters
      Settings_ParseCommandLine( argc, argv, ext_gSettings );
  
+     // if needed, redirect the output into a specified file
+     if ( !isSTDOUT( ext_gSettings ) ) {
+         redirect( ext_gSettings->mOutputFileName );
+     }
+ 
      // Check for either having specified client or server
      if ( ext_gSettings->mThreadMode == kMode_Client 
           || ext_gSettings->mThreadMode == kMode_Listener ) {
Index: src/stdio.c
===================================================================
RCS file: /usr/flux/CVS/emulab-iperf/src/stdio.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 stdio.c
*** src/stdio.c	24 Oct 2005 15:18:34 -0000	1.1.1.1
--- src/stdio.c	24 Oct 2005 16:06:10 -0000
***************
*** 255,262 ****
   * ------------------------------------------------------------------- */
  
  void redirect(const char *inOutputFileName) {
- #ifdef WIN32
- 
      FILE *fp;
  
      if ( inOutputFileName == NULL ) {
--- 255,260 ----
***************
*** 264,277 ****
          return;
      }
  
!     fp = freopen(inOutputFileName, "a+", stdout);
      if ( fp == NULL ) {
          fprintf(stderr, "redirect stdout failed!\n");
          return;
      }
- 
- #endif
- 
      return;
  }
  
--- 262,272 ----
          return;
      }
  
!     fp = freopen(inOutputFileName, "a", stdout);
      if ( fp == NULL ) {
          fprintf(stderr, "redirect stdout failed!\n");
          return;
      }
      return;
  }