Remove a few unnecessary headers and unused functions. (#667)
* EXIT_SUCCESS and EXIT_FAILURE are defined in stdlib.h, not sysexits.h so no need to include the latter. * No need to include pthread.h. * Remove the no longer used delay() function. This also removes the reliance on nanosleep(). * Remove get_tcp_windowsize() and set_tcp_windowsize() which are unused. These days, iperf uses get/setsockopt() with SO_SNDBUF SO_RCVBUF directly.
This commit is contained in:
parent
73b02f9819
commit
480824e3c1
56
LICENSE
56
LICENSE
@ -176,62 +176,6 @@ This software contains source code (src/queue.h) that is:
|
||||
|
||||
=====
|
||||
|
||||
This software contains source code (src/tcp_window_size.{c,h}) that is:
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
* Copyright (c) 1999,2000,2001,2002,2003
|
||||
* The Board of Trustees of the University of Illinois
|
||||
* All Rights Reserved.
|
||||
*---------------------------------------------------------------
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software (Iperf) and associated
|
||||
* documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute,
|
||||
* sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do
|
||||
* so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and
|
||||
* the following disclaimers.
|
||||
*
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimers in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* Neither the names of the University of Illinois, NCSA,
|
||||
* nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this Software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* ________________________________________________________________
|
||||
* National Laboratory for Applied Network Research
|
||||
* National Center for Supercomputing Applications
|
||||
* University of Illinois at Urbana-Champaign
|
||||
* http://www.ncsa.uiuc.edu
|
||||
* ________________________________________________________________
|
||||
*
|
||||
* tcp_window_size.c
|
||||
* by Mark Gates <mgates@nlanr.net>
|
||||
* -------------------------------------------------------------------
|
||||
* set/getsockopt
|
||||
* ------------------------------------------------------------------- */
|
||||
|
||||
=====
|
||||
|
||||
This software contains source code (src/units.{c.h}) that is:
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
|
63
configure
vendored
63
configure
vendored
@ -12311,69 +12311,6 @@ exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Solaris puts nanosleep in -lrt
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5
|
||||
$as_echo_n "checking for library containing nanosleep... " >&6; }
|
||||
if ${ac_cv_search_nanosleep+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_func_search_save_LIBS=$LIBS
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char nanosleep ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return nanosleep ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
for ac_lib in '' rt; do
|
||||
if test -z "$ac_lib"; then
|
||||
ac_res="none required"
|
||||
else
|
||||
ac_res=-l$ac_lib
|
||||
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
fi
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_search_nanosleep=$ac_res
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext
|
||||
if ${ac_cv_search_nanosleep+:} false; then :
|
||||
break
|
||||
fi
|
||||
done
|
||||
if ${ac_cv_search_nanosleep+:} false; then :
|
||||
|
||||
else
|
||||
ac_cv_search_nanosleep=no
|
||||
fi
|
||||
rm conftest.$ac_ext
|
||||
LIBS=$ac_func_search_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5
|
||||
$as_echo "$ac_cv_search_nanosleep" >&6; }
|
||||
ac_res=$ac_cv_search_nanosleep
|
||||
if test "$ac_res" != no; then :
|
||||
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||
|
||||
else
|
||||
|
||||
echo "nanosleep() required for timing operations."
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# On illumos we need -lsocket
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5
|
||||
$as_echo_n "checking for library containing socket... " >&6; }
|
||||
|
@ -64,12 +64,6 @@ echo "floor()"
|
||||
exit 1
|
||||
])
|
||||
|
||||
# Solaris puts nanosleep in -lrt
|
||||
AC_SEARCH_LIBS(nanosleep, [rt], [], [
|
||||
echo "nanosleep() required for timing operations."
|
||||
exit 1
|
||||
])
|
||||
|
||||
# On illumos we need -lsocket
|
||||
AC_SEARCH_LIBS(socket, [socket], [], [
|
||||
echo "socket()"
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
@ -33,8 +33,6 @@ libiperf_la_SOURCES = \
|
||||
portable_endian.h \
|
||||
queue.h \
|
||||
tcp_info.c \
|
||||
tcp_window_size.c \
|
||||
tcp_window_size.h \
|
||||
timer.c \
|
||||
timer.h \
|
||||
units.c \
|
||||
|
@ -141,8 +141,7 @@ libiperf_la_LIBADD =
|
||||
am_libiperf_la_OBJECTS = cjson.lo iperf_api.lo iperf_error.lo \
|
||||
iperf_auth.lo iperf_client_api.lo iperf_locale.lo \
|
||||
iperf_server_api.lo iperf_tcp.lo iperf_udp.lo iperf_sctp.lo \
|
||||
iperf_util.lo dscp.lo net.lo tcp_info.lo tcp_window_size.lo \
|
||||
timer.lo units.lo
|
||||
iperf_util.lo dscp.lo net.lo tcp_info.lo timer.lo units.lo
|
||||
libiperf_la_OBJECTS = $(am_libiperf_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
@ -168,7 +167,6 @@ am__objects_1 = iperf3_profile-cjson.$(OBJEXT) \
|
||||
iperf3_profile-iperf_util.$(OBJEXT) \
|
||||
iperf3_profile-dscp.$(OBJEXT) iperf3_profile-net.$(OBJEXT) \
|
||||
iperf3_profile-tcp_info.$(OBJEXT) \
|
||||
iperf3_profile-tcp_window_size.$(OBJEXT) \
|
||||
iperf3_profile-timer.$(OBJEXT) iperf3_profile-units.$(OBJEXT)
|
||||
am_iperf3_profile_OBJECTS = iperf3_profile-main.$(OBJEXT) \
|
||||
$(am__objects_1)
|
||||
@ -601,8 +599,6 @@ libiperf_la_SOURCES = \
|
||||
portable_endian.h \
|
||||
queue.h \
|
||||
tcp_info.c \
|
||||
tcp_window_size.c \
|
||||
tcp_window_size.h \
|
||||
timer.c \
|
||||
timer.h \
|
||||
units.c \
|
||||
@ -831,7 +827,6 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iperf3_profile-main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iperf3_profile-net.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iperf3_profile-tcp_info.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iperf3_profile-tcp_window_size.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iperf3_profile-timer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iperf3_profile-units.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iperf_api.Plo@am__quote@
|
||||
@ -849,7 +844,6 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_units-t_units.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_uuid-t_uuid.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcp_info.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcp_window_size.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/units.Plo@am__quote@
|
||||
|
||||
@ -1098,20 +1092,6 @@ iperf3_profile-tcp_info.obj: tcp_info.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iperf3_profile_CFLAGS) $(CFLAGS) -c -o iperf3_profile-tcp_info.obj `if test -f 'tcp_info.c'; then $(CYGPATH_W) 'tcp_info.c'; else $(CYGPATH_W) '$(srcdir)/tcp_info.c'; fi`
|
||||
|
||||
iperf3_profile-tcp_window_size.o: tcp_window_size.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iperf3_profile_CFLAGS) $(CFLAGS) -MT iperf3_profile-tcp_window_size.o -MD -MP -MF $(DEPDIR)/iperf3_profile-tcp_window_size.Tpo -c -o iperf3_profile-tcp_window_size.o `test -f 'tcp_window_size.c' || echo '$(srcdir)/'`tcp_window_size.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/iperf3_profile-tcp_window_size.Tpo $(DEPDIR)/iperf3_profile-tcp_window_size.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tcp_window_size.c' object='iperf3_profile-tcp_window_size.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iperf3_profile_CFLAGS) $(CFLAGS) -c -o iperf3_profile-tcp_window_size.o `test -f 'tcp_window_size.c' || echo '$(srcdir)/'`tcp_window_size.c
|
||||
|
||||
iperf3_profile-tcp_window_size.obj: tcp_window_size.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iperf3_profile_CFLAGS) $(CFLAGS) -MT iperf3_profile-tcp_window_size.obj -MD -MP -MF $(DEPDIR)/iperf3_profile-tcp_window_size.Tpo -c -o iperf3_profile-tcp_window_size.obj `if test -f 'tcp_window_size.c'; then $(CYGPATH_W) 'tcp_window_size.c'; else $(CYGPATH_W) '$(srcdir)/tcp_window_size.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/iperf3_profile-tcp_window_size.Tpo $(DEPDIR)/iperf3_profile-tcp_window_size.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tcp_window_size.c' object='iperf3_profile-tcp_window_size.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iperf3_profile_CFLAGS) $(CFLAGS) -c -o iperf3_profile-tcp_window_size.obj `if test -f 'tcp_window_size.c'; then $(CYGPATH_W) 'tcp_window_size.c'; else $(CYGPATH_W) '$(srcdir)/tcp_window_size.c'; fi`
|
||||
|
||||
iperf3_profile-timer.o: timer.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iperf3_profile_CFLAGS) $(CFLAGS) -MT iperf3_profile-timer.o -MD -MP -MF $(DEPDIR)/iperf3_profile-timer.Tpo -c -o iperf3_profile-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/iperf3_profile-timer.Tpo $(DEPDIR)/iperf3_profile-timer.Po
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <pthread.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
@ -75,7 +74,6 @@
|
||||
|
||||
#include "cjson.h"
|
||||
#include "units.h"
|
||||
#include "tcp_window_size.h"
|
||||
#include "iperf_util.h"
|
||||
#include "iperf_locale.h"
|
||||
#include "version.h"
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <pthread.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
@ -57,7 +56,6 @@
|
||||
#include "timer.h"
|
||||
#include "net.h"
|
||||
#include "units.h"
|
||||
#include "tcp_window_size.h"
|
||||
#include "iperf_util.h"
|
||||
#include "iperf_locale.h"
|
||||
|
||||
|
@ -164,43 +164,6 @@ timeval_diff(struct timeval * tv0, struct timeval * tv1)
|
||||
return time1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
delay(int64_t ns)
|
||||
{
|
||||
struct timespec req, rem;
|
||||
|
||||
req.tv_sec = 0;
|
||||
|
||||
while (ns >= 1000000000L) {
|
||||
ns -= 1000000000L;
|
||||
req.tv_sec += 1;
|
||||
}
|
||||
|
||||
req.tv_nsec = ns;
|
||||
|
||||
while (nanosleep(&req, &rem) == -1)
|
||||
if (EINTR == errno)
|
||||
memcpy(&req, &rem, sizeof(rem));
|
||||
else
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
# ifdef DELAY_SELECT_METHOD
|
||||
int
|
||||
delay(int us)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = us;
|
||||
(void) select(1, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, &tv);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
cpu_util(double pcpu[3])
|
||||
{
|
||||
|
@ -44,8 +44,6 @@ int timeval_equals(struct timeval *tv0, struct timeval *tv1);
|
||||
|
||||
double timeval_diff(struct timeval *tv0, struct timeval *tv1);
|
||||
|
||||
int delay(int64_t ns);
|
||||
|
||||
void cpu_util(double pcpu[3]);
|
||||
|
||||
const char* get_system_info(void);
|
||||
|
@ -1,124 +0,0 @@
|
||||
/*---------------------------------------------------------------
|
||||
* Copyright (c) 1999,2000,2001,2002,2003
|
||||
* The Board of Trustees of the University of Illinois
|
||||
* All Rights Reserved.
|
||||
*---------------------------------------------------------------
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software (Iperf) and associated
|
||||
* documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute,
|
||||
* sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do
|
||||
* so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and
|
||||
* the following disclaimers.
|
||||
*
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimers in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* Neither the names of the University of Illinois, NCSA,
|
||||
* nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this Software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* ________________________________________________________________
|
||||
* National Laboratory for Applied Network Research
|
||||
* National Center for Supercomputing Applications
|
||||
* University of Illinois at Urbana-Champaign
|
||||
* http://www.ncsa.uiuc.edu
|
||||
* ________________________________________________________________
|
||||
*
|
||||
* tcp_window_size.c
|
||||
* by Mark Gates <mgates@nlanr.net>
|
||||
* -------------------------------------------------------------------
|
||||
* set/getsockopt
|
||||
* ------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* imported into iperfjd branch: 3 Feb 2009 jdugan
|
||||
*
|
||||
* made variable names more sane
|
||||
* removed some cruft
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
* If bufsize > 0, set the TCP window size (via the socket buffer
|
||||
* sizes) for sock. Otherwise leave it as the system default.
|
||||
*
|
||||
* This must be called prior to calling listen() or connect() on
|
||||
* the socket, for TCP window sizes > 64 KB to be effective.
|
||||
*
|
||||
* This now works on UNICOS also, by setting TCP_WINSHIFT.
|
||||
* This now works on AIX, by enabling RFC1323.
|
||||
* returns -1 on error, 0 on no error.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
set_tcp_windowsize(int sock, int bufsize, int dir)
|
||||
{
|
||||
int rc;
|
||||
int newbufsize;
|
||||
|
||||
assert(sock >= 0);
|
||||
|
||||
if (bufsize > 0)
|
||||
{
|
||||
/*
|
||||
* note: results are verified after connect() or listen(), since
|
||||
* some OS's don't show the corrected value until then.
|
||||
*/
|
||||
// printf("Setting TCP buffer to size: %d\n", bufsize);
|
||||
newbufsize = bufsize;
|
||||
rc = setsockopt(sock, SOL_SOCKET, dir, (char *) &newbufsize, sizeof(newbufsize));
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
} else {
|
||||
// printf(" Using default TCP buffer size and assuming OS will do autotuning\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
* returns the TCP window size (on the sending buffer, SO_SNDBUF),
|
||||
* or -1 on error.
|
||||
* ------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
get_tcp_windowsize(int sock, int dir)
|
||||
{
|
||||
int bufsize = 0;
|
||||
|
||||
int rc;
|
||||
socklen_t len;
|
||||
|
||||
/* send buffer -- query for buffer size */
|
||||
len = sizeof bufsize;
|
||||
rc = getsockopt(sock, SOL_SOCKET, dir, (char *) &bufsize, &len);
|
||||
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
return bufsize;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* iperf, Copyright (c) 2014, The Regents of the University of
|
||||
* California, through Lawrence Berkeley National Laboratory (subject
|
||||
* to receipt of any required approvals from the U.S. Dept. of
|
||||
* Energy). All rights reserved.
|
||||
*
|
||||
* If you have questions about your rights to use or distribute this
|
||||
* software, please contact Berkeley Lab's Technology Transfer
|
||||
* Department at TTD@lbl.gov.
|
||||
*
|
||||
* NOTICE. This software is owned by the U.S. Department of Energy.
|
||||
* As such, the U.S. Government has been granted for itself and others
|
||||
* acting on its behalf a paid-up, nonexclusive, irrevocable,
|
||||
* worldwide license in the Software to reproduce, prepare derivative
|
||||
* works, and perform publicly and display publicly. Beginning five
|
||||
* (5) years after the date permission to assert copyright is obtained
|
||||
* from the U.S. Department of Energy, and subject to any subsequent
|
||||
* five (5) year renewals, the U.S. Government is granted for itself
|
||||
* and others acting on its behalf a paid-up, nonexclusive,
|
||||
* irrevocable, worldwide license in the Software to reproduce,
|
||||
* prepare derivative works, distribute copies to the public, perform
|
||||
* publicly and display publicly, and to permit others to do so.
|
||||
*
|
||||
* This code is distributed under a BSD style license, see the LICENSE
|
||||
* file for complete information.
|
||||
*/
|
||||
int set_tcp_windowsize(int sock, int bufsize, int dir);
|
||||
int get_tcp_windowsize(int sock, int dir);
|
Loading…
Reference in New Issue
Block a user