- Code sanitization

-> Fixed indentations
	-> Removed compile-time warnings that appeared with gcc-8
	-> Replaced fpritnfs(stderr, ..) with TRACE_DBGs

Signed-off-by: Jamshed <asim@dslohost002.jf.intel.com>
master
Jamshed 2019-06-04 01:17:24 +00:00
parent 242ae4530b
commit efeab20fd2
21 changed files with 1223 additions and 1168 deletions

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15 from Makefile.am. # Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc. # Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -133,7 +133,7 @@ am__recursive_targets = \
$(RECURSIVE_CLEAN_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets) $(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck cscope distdir distdir-am dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)config.h.in $(LISP)config.h.in
# Read a list of newline-separated strings from the standard input, # Read a list of newline-separated strings from the standard input,
@ -334,8 +334,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' $(SHELL) ./config.status'; \ echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \ $(SHELL) ./config.status;; \
*) \ *) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
esac; esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -478,7 +478,10 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES) distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
$(am__remove_distdir) $(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)" test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@ -543,7 +546,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)" || chmod -R a+r "$(distdir)"
dist-gzip: distdir dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir) $(am__post_remove_distdir)
dist-bzip2: distdir dist-bzip2: distdir
@ -569,7 +572,7 @@ dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \ @echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2 "deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir) $(am__post_remove_distdir)
dist-zip: distdir dist-zip: distdir
@ -587,7 +590,7 @@ dist dist-all:
distcheck: dist distcheck: dist
case '$(DIST_ARCHIVES)' in \ case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \ *.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \ *.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \ *.tar.lz*) \
@ -597,7 +600,7 @@ distcheck: dist
*.tar.Z*) \ *.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \ *.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \ *.zip*) \
unzip $(distdir).zip ;;\ unzip $(distdir).zip ;;\
esac esac

189
aclocal.m4 vendored
View File

@ -1,6 +1,6 @@
# generated automatically by aclocal 1.15 -*- Autoconf -*- # generated automatically by aclocal 1.16.1 -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc. # Copyright (C) 1996-2018 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely. If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])]) To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2014 Free Software Foundation, Inc. # Copyright (C) 2002-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# generated from the m4 files accompanying Automake X.Y. # generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.) # (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION], AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.15' [am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro. dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.15], [], m4_if([$1], [1.16.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
]) ])
@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.15])dnl [AM_AUTOMAKE_VERSION([1.16.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*- # AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*- # AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2014 Free Software Foundation, Inc. # Copyright (C) 1997-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]]) Usually this means the macro was only invoked conditionally.]])
fi])]) fi])])
# Copyright (C) 1999-2014 Free Software Foundation, Inc. # Copyright (C) 1999-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -332,13 +332,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*- # Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2014 Free Software Foundation, Inc. # Copyright (C) 1999-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# _AM_OUTPUT_DEPENDENCY_COMMANDS # _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------ # ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
@ -346,49 +345,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# Older Autoconf quotes --file arguments for eval, but not when files # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval # are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting. # if we detect the quoting.
case $CONFIG_FILES in # TODO: see whether this extra hack can be removed once we start
*\'*) eval set x "$CONFIG_FILES" ;; # requiring Autoconf 2.70 or later.
*) set x $CONFIG_FILES ;; AS_CASE([$CONFIG_FILES],
esac [*\'*], [eval set x "$CONFIG_FILES"],
[*], [set x $CONFIG_FILES])
shift shift
for mf # Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do do
# Strip MF so we end up with the name of the file. # Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'` am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not. # Check whether this is an Automake generated Makefile which includes
# We used to match only the files named 'Makefile.in', but # dependency-tracking related rules and includes.
# some people rename them; so instead we look at the file content. # Grep'ing the whole file directly is not great: AIX grep has a line
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000. # limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
dirpart=`AS_DIRNAME("$mf")` || continue
else am_dirpart=`AS_DIRNAME(["$am_mf"])`
continue am_filepart=`AS_BASENAME(["$am_mf"])`
fi AM_RUN_LOG([cd "$am_dirpart" \
# Extract the definition of DEPDIR, am__include, and am__quote && sed -e '/# am--include-marker/d' "$am_filepart" \
# from the Makefile without running 'make'. | $MAKE -f - am--depfiles]) || am_rc=$?
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done done
if test $am_rc -ne 0; then
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).])
fi
AS_UNSET([am_dirpart])
AS_UNSET([am_filepart])
AS_UNSET([am_mf])
AS_UNSET([am_rc])
rm -f conftest-deps.mk
} }
])# _AM_OUTPUT_DEPENDENCY_COMMANDS ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
@ -397,18 +388,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# ----------------------------- # -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE. # This macro should only be invoked once -- use via AC_REQUIRE.
# #
# This code is only required when automatic dependency tracking # This code is only required when automatic dependency tracking is enabled.
# is enabled. FIXME. This creates each '.P' file that we will # This creates each '.Po' and '.Plo' makefile fragment that we'll need in
# need in order to bootstrap the dependency handling code. # order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles], [AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
])
# Do all the work for Automake. -*- Autoconf -*- # Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc. # Copyright (C) 1996-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -495,8 +485,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x # For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see: # dies out for good. For more background, see:
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)']) AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target (and possibly the TAP driver). The # We need awk for the "check" target (and possibly the TAP driver). The
# system "awk" is bad on some platforms. # system "awk" is bad on some platforms.
@ -563,7 +553,7 @@ END
Aborting the configuration process, to ensure you take notice of the issue. Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <http://www.gnu.org/software/coreutils/>. that behaves properly: <https://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@ -605,7 +595,7 @@ for _am_header in $config_headers :; do
done done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2014 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -626,7 +616,7 @@ if test x"${install_sh+set}" != xset; then
fi fi
AC_SUBST([install_sh])]) AC_SUBST([install_sh])])
# Copyright (C) 2003-2014 Free Software Foundation, Inc. # Copyright (C) 2003-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -647,7 +637,7 @@ AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*- # Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -655,49 +645,42 @@ AC_SUBST([am__leading_dot])])
# AM_MAKE_INCLUDE() # AM_MAKE_INCLUDE()
# ----------------- # -----------------
# Check to see how make treats includes. # Check whether make has an 'include' directive that can support all
# the idioms we need for our automatic dependency tracking code.
AC_DEFUN([AM_MAKE_INCLUDE], AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make} [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
cat > confinc << 'END' cat > confinc.mk << 'END'
am__doit: am__doit:
@echo this is the am__doit target @echo this is the am__doit target >confinc.out
.PHONY: am__doit .PHONY: am__doit
END END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#" am__include="#"
am__quote= am__quote=
_am_result=none # BSD make does it like this.
# First try GNU make style include. echo '.include "confinc.mk" # ignored' > confmf.BSD
echo "include confinc" > confmf # Other make implementations (GNU, Solaris 10, AIX) do it like this.
# Ignore all kinds of additional output from 'make'. echo 'include confinc.mk # ignored' > confmf.GNU
case `$am_make -s -f confmf 2> /dev/null` in #( _am_result=no
*the\ am__doit\ target*) for s in GNU BSD; do
am__include=include AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
am__quote= AS_CASE([$?:`cat confinc.out 2>/dev/null`],
_am_result=GNU ['0:this is the am__doit target'],
;; [AS_CASE([$s],
esac [BSD], [am__include='.include' am__quote='"'],
# Now try BSD make style include. [am__include='include' am__quote=''])])
if test "$am__include" = "#"; then if test "$am__include" != "#"; then
echo '.include "confinc"' > confmf _am_result="yes ($s style)"
case `$am_make -s -f confmf 2> /dev/null` in #( break
*the\ am__doit\ target*) fi
am__include=.include done
am__quote="\"" rm -f confinc.* confmf.*
_am_result=BSD AC_MSG_RESULT([${_am_result}])
;; AC_SUBST([am__include])])
esac AC_SUBST([am__quote])])
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2014 Free Software Foundation, Inc. # Copyright (C) 1997-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -736,7 +719,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*- # Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -765,7 +748,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION], AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2014 Free Software Foundation, Inc. # Copyright (C) 1999-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -812,7 +795,7 @@ AC_LANG_POP([C])])
# For backward compatibility. # For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2014 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -831,7 +814,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*- # Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc. # Copyright (C) 1996-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -912,7 +895,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file rm -f conftest.file
]) ])
# Copyright (C) 2009-2014 Free Software Foundation, Inc. # Copyright (C) 2009-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -972,7 +955,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
]) ])
# Copyright (C) 2001-2014 Free Software Foundation, Inc. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1000,7 +983,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])]) AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2014 Free Software Foundation, Inc. # Copyright (C) 2006-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1019,7 +1002,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*- # Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2014 Free Software Foundation, Inc. # Copyright (C) 2004-2018 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,

View File

@ -26,7 +26,9 @@
#include "debug.h" #include "debug.h"
#define MAX_URL_LEN 128 #define MAX_URL_LEN 128
#define MAX_FILE_LEN 128 #define FILE_LEN 128
#define FILE_IDX 10
#define MAX_FILE_LEN (FILE_LEN + FILE_IDX)
#define HTTP_HEADER_LEN 1024 #define HTTP_HEADER_LEN 1024
#define IP_RANGE 1 #define IP_RANGE 1
@ -64,7 +66,7 @@ static int num_cores;
static int core_limit; static int core_limit;
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
static int fio = FALSE; static int fio = FALSE;
static char outfile[MAX_FILE_LEN + 1]; static char outfile[FILE_LEN + 1];
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
static char host[MAX_IP_STR_LEN + 1] = {'\0'}; static char host[MAX_IP_STR_LEN + 1] = {'\0'};
static char url[MAX_URL_LEN + 1] = {'\0'}; static char url[MAX_URL_LEN + 1] = {'\0'};
@ -775,7 +777,7 @@ main(int argc, char **argv)
return FALSE; return FALSE;
} }
fio = TRUE; fio = TRUE;
strncpy(outfile, optarg, MAX_FILE_LEN); strncpy(outfile, optarg, FILE_LEN);
break; break;
case 'n': case 'n':
process_cpu = mystrtol(optarg, 10); process_cpu = mystrtol(optarg, 10);

View File

@ -15,13 +15,13 @@ the connection:
1. Client initiates connection (receiver listens on `port` and client sends to 1. Client initiates connection (receiver listens on `port` and client sends to
`ip:port` for `length` seconds) `ip:port` for `length` seconds)
- `python recv.py wait [port]` - `python recv.py wait [ip] [port]`
- `./client send [ip] [port] [length (seconds)]` - `./client send [ip] [port] [length (seconds)]`
2. Receiver initiates connection (client listens on `port`, receiver sends a 2. Receiver initiates connection (client listens on `port`, receiver sends a
start message to `ip:port`, and then client sends back to receiver for `length` start message to `ip:port`, and then client sends back to receiver for `length`
seconds) seconds)
- `./client wait [port] [length (seconds)]` - `./client wait [ip] [port] [length (seconds)]`
- `python recv.py send [ip] [port]` - `python recv.py send [ip] [port]`
*NOTE*: If using CCP with mTCP, you will need to ensure that `LD_LIBRARY_PATH` *NOTE*: If using CCP with mTCP, you will need to ensure that `LD_LIBRARY_PATH`
@ -39,7 +39,7 @@ Setup Notes
=========== ===========
0. Ensure the ARP table and routing table are populated correctly and located inside ./config/ 0. Ensure the ARP table and routing table are populated correctly and located inside ./config/
1. Build this application by simply running make in this directory (apps/perf) 1. Build this application by simply running make in this directory (apps/perf)
2. Assuming sender and receiver are on the same network and/or have a very low 2. Assuming sender and receiver are on the same network and/or have a very low
@ -54,7 +54,7 @@ Setup Notes
3. Start mTCP perf client in wait mode, listening on, e.g., port 9000 and 3. Start mTCP perf client in wait mode, listening on, e.g., port 9000 and
sending for 30 seconds: sending for 30 seconds:
`sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ./client wait 9000 30` `sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ./client wait 10.1.1.5 9000 30`
4. Start python receiver in send mode, where client ip is e.g. 10.1.1.5 4. Start python receiver in send mode, where client ip is e.g. 10.1.1.5

View File

@ -24,346 +24,350 @@
#include "http_parsing.h" #include "http_parsing.h"
#include "debug.h" #include "debug.h"
#define MAX_CPUS 16 #define MAX_CPUS 16
#define MAX_URL_LEN 128 #define MAX_URL_LEN 128
#define MAX_FILE_LEN 128 #define MAX_FILE_LEN 128
#define HTTP_HEADER_LEN 1024 #define HTTP_HEADER_LEN 1024
#define IP_RANGE 1 #define IP_RANGE 1
#define MAX_IP_STR_LEN 16 #define MAX_IP_STR_LEN 16
#define BUF_SIZE (32*1024) #define BUF_SIZE (32 * 1024)
#define CALC_MD5SUM FALSE #define CALC_MD5SUM FALSE
#define TIMEVAL_TO_MSEC(t) ((t.tv_sec * 1000) + (t.tv_usec / 1000)) #define TIMEVAL_TO_MSEC(t) ((t.tv_sec * 1000) + (t.tv_usec / 1000))
#define TIMEVAL_TO_USEC(t) ((t.tv_sec * 1000000) + (t.tv_usec)) #define TIMEVAL_TO_USEC(t) ((t.tv_sec * 1000000) + (t.tv_usec))
#define TS_GT(a,b) ((int64_t)((a)-(b)) > 0) #define TS_GT(a,b) ((int64_t)((a)-(b)) > 0)
#ifndef TRUE #ifndef TRUE
#define TRUE (1) #define TRUE (1)
#endif #endif
#ifndef FALSE #ifndef FALSE
#define FALSE (0) #define FALSE (0)
#endif #endif
#define CONCURRENCY 1 #define CONCURRENCY 1
#define BUF_LEN 8192 #define BUF_LEN 8192
#define MAX_FLOW_NUM (10000) #define MAX_FLOW_NUM (10000)
#define MAX_EVENTS (30000) #define MAX_EVENTS (30000)
#define DEBUG(fmt, args...) fprintf(stderr, "[DEBUG] " fmt "\n", ## args) #define DEBUG(fmt, args...) fprintf(stderr, "[DEBUG] " fmt "\n", ## args)
#define ERROR(fmt, args...) fprintf(stderr, fmt "\n", ## args) #define ERROR(fmt, args...) fprintf(stderr, fmt "\n", ## args)
#define SAMPLE(fmt, args...) fprintf(stdout, fmt "\n", ## args) #define SAMPLE(fmt, args...) fprintf(stdout, fmt "\n", ## args)
#define SEND_MODE 1
#define WAIT_MODE 2
#define SEND_MODE 1
#define WAIT_MODE 2
/*----------------------------------------------------------------------------*/
struct thread_context struct thread_context
{ {
int core; int core;
mctx_t mctx; mctx_t mctx;
}; };
/*----------------------------------------------------------------------------*/
void SignalHandler(int signum) void
SignalHandler(int signum)
{ {
ERROR("Received SIGINT"); ERROR("Received SIGINT");
exit(-1); exit(-1);
} }
/*----------------------------------------------------------------------------*/
void print_usage(int mode) { void
if (mode == SEND_MODE || mode == 0) { print_usage(int mode)
ERROR("(client initiates) usage: ./client send [ip] [port] [length (seconds)]");
}
if (mode == WAIT_MODE || mode == 0) {
ERROR("(server initiates) usage: ./client wait [length (seconds)]");
}
}
int main(int argc, char **argv)
{ {
int ret, i, c; if (mode == SEND_MODE || mode == 0) {
ERROR("(client initiates) usage: ./client send [ip] [port] [length (seconds)]");
}
if (mode == WAIT_MODE || mode == 0) {
ERROR("(server initiates) usage: ./client wait [length (seconds)]");
}
}
/*----------------------------------------------------------------------------*/
int
main(int argc, char **argv)
{
int ret, i, c;
//mtcp //mtcp
mctx_t mctx; mctx_t mctx;
struct mtcp_conf mcfg; struct mtcp_conf mcfg;
struct thread_context *ctx; struct thread_context *ctx;
struct mtcp_epoll_event *events; struct mtcp_epoll_event *events;
struct mtcp_epoll_event ev; struct mtcp_epoll_event ev;
int core = 0; int core = 0;
int ep_id; int ep_id;
// sockets // sockets
struct sockaddr_in saddr, daddr; struct sockaddr_in saddr, daddr;
int sockfd; int sockfd;
int backlog = 3; int backlog = 3;
// counters // counters
int sec_to_send; int sec_to_send;
int wrote = 0, int wrote = 0,
read = 0, read = 0,
bytes_sent = 0, bytes_sent = 0,
events_ready = 0, events_ready = 0,
nevents = 0, nevents = 0,
sent_close = 0; sent_close = 0;
// time // time
double elapsed_time = 0.0; double elapsed_time = 0.0;
struct timeval t1, t2; struct timeval t1, t2;
struct timespec ts_start, now; struct timespec ts_start, now;
time_t end_time; time_t end_time;
// send buffer // send buffer
char buf[BUF_LEN]; char buf[BUF_LEN];
char rcvbuf[BUF_LEN]; char rcvbuf[BUF_LEN];
// args // args
int mode = 0; int mode = 0;
if (argc < 2) { if (argc < 2) {
print_usage(0); print_usage(0);
return -1; return -1;
} }
if (strncmp(argv[1], "send", 4) == 0) { if (strncmp(argv[1], "send", 4) == 0) {
if (argc < 5) { if (argc < 5) {
print_usage(SEND_MODE); print_usage(SEND_MODE);
return -1; return -1;
} }
mode = SEND_MODE; mode = SEND_MODE;
DEBUG("Send mode"); DEBUG("Send mode");
// Parse command-line args // Parse command-line args
daddr.sin_family = AF_INET; daddr.sin_family = AF_INET;
daddr.sin_addr.s_addr = inet_addr(argv[2]);; daddr.sin_addr.s_addr = inet_addr(argv[2]);;
daddr.sin_port = htons(atoi(argv[3])); daddr.sin_port = htons(atoi(argv[3]));
sec_to_send = atoi(argv[4]); sec_to_send = atoi(argv[4]);
} else if (strncmp(argv[1], "wait", 4) == 0) { } else if (strncmp(argv[1], "wait", 4) == 0) {
if (argc < 4) { if (argc < 4) {
print_usage(WAIT_MODE); print_usage(WAIT_MODE);
return -1; return -1;
} }
mode = WAIT_MODE; mode = WAIT_MODE;
DEBUG("Wait mode"); DEBUG("Wait mode");
saddr.sin_family = AF_INET; saddr.sin_family = AF_INET;
saddr.sin_addr.s_addr = inet_addr("10.1.1.5");//INADDR_ANY; saddr.sin_addr.s_addr = inet_addr(argv[2]);
saddr.sin_port = htons(atoi(argv[2])); saddr.sin_port = htons(atoi(argv[3]));
sec_to_send = atoi(argv[3]); sec_to_send = atoi(argv[4]);
} else { } else {
ERROR("Unknown mode \"%s\"", argv[1]); ERROR("Unknown mode \"%s\"", argv[1]);
print_usage(0); print_usage(0);
} }
if (mode == 0) { if (mode == 0) {
return -1; return -1;
} }
// This must be done before mtcp_init // This must be done before mtcp_init
mtcp_getconf(&mcfg); mtcp_getconf(&mcfg);
mcfg.num_cores = 1; mcfg.num_cores = 1;
mtcp_setconf(&mcfg); mtcp_setconf(&mcfg);
// Seed RNG // Seed RNG
srand(time(NULL)); srand(time(NULL));
// Init mtcp // Init mtcp
DEBUG("Initializing mtcp...\n"); DEBUG("Initializing mtcp...\n");
if (mtcp_init("client.conf")) { if (mtcp_init("client.conf")) {
ERROR("Failed to initialize mtcp.\n"); ERROR("Failed to initialize mtcp.\n");
return -1; return -1;
} }
// Default simple config, this must be done after mtcp_init // Default simple config, this must be done after mtcp_init
mtcp_getconf(&mcfg); mtcp_getconf(&mcfg);
mcfg.max_concurrency = 3 * CONCURRENCY; mcfg.max_concurrency = 3 * CONCURRENCY;
mcfg.max_num_buffers = 3 * CONCURRENCY; mcfg.max_num_buffers = 3 * CONCURRENCY;
mtcp_setconf(&mcfg); mtcp_setconf(&mcfg);
// Catch ctrl+c to clean up // Catch ctrl+c to clean up
mtcp_register_signal(SIGINT, SignalHandler); mtcp_register_signal(SIGINT, SignalHandler);
DEBUG("Creating thread context..."); DEBUG("Creating thread context...");
mtcp_core_affinitize(core); mtcp_core_affinitize(core);
ctx = (struct thread_context *) calloc(1, sizeof(struct thread_context)); ctx = (struct thread_context *) calloc(1, sizeof(struct thread_context));
if (!ctx) { if (!ctx) {
ERROR("Failed to create context."); ERROR("Failed to create context.");
perror("calloc"); perror("calloc");
return -1; return -1;
} }
ctx->core = core; ctx->core = core;
ctx->mctx = mtcp_create_context(core); ctx->mctx = mtcp_create_context(core);
if (!ctx->mctx) { if (!ctx->mctx) {
ERROR("Failed to create mtcp context."); ERROR("Failed to create mtcp context.");
return -1; return -1;
} }
mctx = ctx->mctx; mctx = ctx->mctx;
if (mode == SEND_MODE) { if (mode == SEND_MODE) {
// Create pool of TCP source ports for outgoing conns // Create pool of TCP source ports for outgoing conns
DEBUG("Creating pool of TCP source ports..."); DEBUG("Creating pool of TCP source ports...");
mtcp_init_rss(mctx, INADDR_ANY, IP_RANGE, daddr.sin_addr.s_addr, daddr.sin_port); mtcp_init_rss(mctx, INADDR_ANY, IP_RANGE, daddr.sin_addr.s_addr, daddr.sin_port);
} }
DEBUG("Creating epoller..."); DEBUG("Creating epoller...");
ep_id = mtcp_epoll_create(ctx->mctx, mcfg.max_num_buffers); ep_id = mtcp_epoll_create(ctx->mctx, mcfg.max_num_buffers);
events = (struct mtcp_epoll_event *) calloc(mcfg.max_num_buffers, sizeof(struct mtcp_epoll_event)); events = (struct mtcp_epoll_event *) calloc(mcfg.max_num_buffers, sizeof(struct mtcp_epoll_event));
if (!events) { if (!events) {
ERROR("Failed to allocate events."); ERROR("Failed to allocate events.");
return -1; return -1;
} }
DEBUG("Creating socket..."); DEBUG("Creating socket...");
sockfd = mtcp_socket(mctx, AF_INET, SOCK_STREAM, 0); sockfd = mtcp_socket(mctx, AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) { if (sockfd < 0) {
ERROR("Failed to create socket."); ERROR("Failed to create socket.");
return -1; return -1;
} }
ret = mtcp_setsock_nonblock(mctx, sockfd); ret = mtcp_setsock_nonblock(mctx, sockfd);
if (ret < 0) { if (ret < 0) {
ERROR("Failed to set socket in nonblocking mode."); ERROR("Failed to set socket in nonblocking mode.");
return -1; return -1;
} }
ev.events = MTCP_EPOLLIN; ev.events = MTCP_EPOLLIN;
ev.data.sockid = sockfd; ev.data.sockid = sockfd;
mtcp_epoll_ctl(mctx, ep_id, MTCP_EPOLL_CTL_ADD, sockfd, &ev); mtcp_epoll_ctl(mctx, ep_id, MTCP_EPOLL_CTL_ADD, sockfd, &ev);
if (mode == WAIT_MODE) { if (mode == WAIT_MODE) {
ret = mtcp_bind(mctx, sockfd, (struct sockaddr *)&saddr, sizeof(struct sockaddr_in)); ret = mtcp_bind(mctx, sockfd, (struct sockaddr *)&saddr, sizeof(struct sockaddr_in));
if (ret < 0) { if (ret < 0) {
ERROR("Failed to bind to the listening socket."); ERROR("Failed to bind to the listening socket.");
} }
ret = mtcp_listen(mctx, sockfd, backlog); ret = mtcp_listen(mctx, sockfd, backlog);
if (ret < 0) { if (ret < 0) {
ERROR("Failed to listen: %s", strerror(errno)); ERROR("Failed to listen: %s", strerror(errno));
} }
while (1) { // loop until connected to a server, break when we can send while (1) { // loop until connected to a server, break when we can send
nevents = mtcp_epoll_wait(mctx, ep_id, events, MAX_EVENTS, -1); nevents = mtcp_epoll_wait(mctx, ep_id, events, MAX_EVENTS, -1);
if (nevents < 0) { if (nevents < 0) {
if (errno != EINTR) { if (errno != EINTR) {
perror("mtcp_epoll_wait"); perror("mtcp_epoll_wait");
} }
return -1; return -1;
} }
for (i = 0; i < nevents; i++) { for (i = 0; i < nevents; i++) {
if (events[i].data.sockid == sockfd) { if (events[i].data.sockid == sockfd) {
c = mtcp_accept(mctx, sockfd, NULL, NULL); c = mtcp_accept(mctx, sockfd, NULL, NULL);
if (c >= 0) { if (c >= 0) {
if (c >= MAX_FLOW_NUM) { if (c >= MAX_FLOW_NUM) {
ERROR("Invalid socket id %d.", c); ERROR("Invalid socket id %d.", c);
} }
DEBUG("Accepted new connection"); DEBUG("Accepted new connection");
} else { } else {
ERROR("mtcp_accept() %s", strerror(errno)); ERROR("mtcp_accept() %s", strerror(errno));
} }
mtcp_epoll_ctl(mctx, ep_id, MTCP_EPOLL_CTL_DEL, sockfd, &ev); mtcp_epoll_ctl(mctx, ep_id, MTCP_EPOLL_CTL_DEL, sockfd, &ev);
sockfd = c; sockfd = c;
ev.events = MTCP_EPOLLIN | MTCP_EPOLLOUT; ev.events = MTCP_EPOLLIN | MTCP_EPOLLOUT;
ev.data.sockid = sockfd; ev.data.sockid = sockfd;
mtcp_epoll_ctl(mctx, ep_id, MTCP_EPOLL_CTL_ADD, sockfd, &ev); mtcp_epoll_ctl(mctx, ep_id, MTCP_EPOLL_CTL_ADD, sockfd, &ev);
goto end_wait_loop; goto end_wait_loop;
} else { } else {
ERROR("Received event on unknown socket."); ERROR("Received event on unknown socket.");
} }
} }
} }
} }
end_wait_loop: end_wait_loop:
if (mode == SEND_MODE) { if (mode == SEND_MODE) {
DEBUG("Connecting socket..."); DEBUG("Connecting socket...");
ret = mtcp_connect(mctx, sockfd, (struct sockaddr *)&daddr, sizeof(struct sockaddr_in)); ret = mtcp_connect(mctx, sockfd, (struct sockaddr *)&daddr, sizeof(struct sockaddr_in));
if (ret < 0) { if (ret < 0) {
ERROR("mtcp_connect failed."); ERROR("mtcp_connect failed.");
if (errno != EINPROGRESS) { if (errno != EINPROGRESS) {
perror("mtcp_connect"); perror("mtcp_connect");
mtcp_close(mctx, sockfd); mtcp_close(mctx, sockfd);
return -1; return -1;
} }
} }
DEBUG("Connection created."); DEBUG("Connection created.");
} }
clock_gettime(CLOCK_MONOTONIC, &ts_start); clock_gettime(CLOCK_MONOTONIC, &ts_start);
end_time = ts_start.tv_sec + sec_to_send; end_time = ts_start.tv_sec + sec_to_send;
memset(buf, 0x90, sizeof(char) * BUF_LEN); memset(buf, 0x90, sizeof(char) * BUF_LEN);
buf[BUF_LEN-1] = '\0'; buf[BUF_LEN-1] = '\0';
while (1) { while (1) {
wrote = mtcp_write(ctx->mctx, sockfd, buf, BUF_LEN); wrote = mtcp_write(ctx->mctx, sockfd, buf, BUF_LEN);
bytes_sent += wrote; bytes_sent += wrote;
if (wrote > 0) { if (wrote > 0) {
gettimeofday(&t1, NULL); gettimeofday(&t1, NULL);
break; break;
} }
} }
//ev.events = MTCP_EPOLLIN | MTCP_EPOLLOUT; //ev.events = MTCP_EPOLLIN | MTCP_EPOLLOUT;
//mtcp_epoll_ctl(mctx, ep_id, MTCP_EPOLL_CTL_ADD, sockfd, &ev); //mtcp_epoll_ctl(mctx, ep_id, MTCP_EPOLL_CTL_ADD, sockfd, &ev);
// //
while (1) { // check time while (1) { // check time
events_ready = mtcp_epoll_wait(ctx->mctx, ep_id, events, mcfg.max_num_buffers, -1); events_ready = mtcp_epoll_wait(ctx->mctx, ep_id, events, mcfg.max_num_buffers, -1);
for (int i=0; i < events_ready; i++) { for (int i = 0; i < events_ready; i++) {
assert(sockfd == events[i].data.sockid); assert(sockfd == events[i].data.sockid);
if (events[i].events & MTCP_EPOLLIN) { if (events[i].events & MTCP_EPOLLIN) {
read = mtcp_read(ctx->mctx, sockfd, rcvbuf, BUF_LEN); read = mtcp_read(ctx->mctx, sockfd, rcvbuf, BUF_LEN);
if (read <= 0) { if (read <= 0) {
continue; continue;
} else { } else {
DEBUG("Got FIN-ACK from receiver (%d bytes): %s", read, rcvbuf); DEBUG("Got FIN-ACK from receiver (%d bytes): %s", read, rcvbuf);
goto stop_timer; goto stop_timer;
} }
} else if (events[i].events == MTCP_EPOLLOUT) { } else if (events[i].events == MTCP_EPOLLOUT) {
//if (bytes_sent < sec_to_send) { //if (bytes_sent < sec_to_send) {
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
if (now.tv_sec < end_time) { if (now.tv_sec < end_time) {
wrote = mtcp_write(ctx->mctx, sockfd, buf, BUF_LEN); wrote = mtcp_write(ctx->mctx, sockfd, buf, BUF_LEN);
bytes_sent += wrote; bytes_sent += wrote;
//DEBUG("wrote %d, total %d", wrote, bytes_sent); //DEBUG("wrote %d, total %d", wrote, bytes_sent);
} else if (!sent_close) { } else if (!sent_close) {
memset(buf, 0x96, sizeof(char) * BUF_LEN); memset(buf, 0x96, sizeof(char) * BUF_LEN);
mtcp_write(ctx->mctx, sockfd, buf, 1); mtcp_write(ctx->mctx, sockfd, buf, 1);
DEBUG("Done writing... waiting for FIN-ACK"); DEBUG("Done writing... waiting for FIN-ACK");
sent_close = 1; sent_close = 1;
} }
} }
} }
} }
stop_timer: stop_timer:
gettimeofday(&t2, NULL); gettimeofday(&t2, NULL);
DEBUG("Done reading. Closing socket..."); DEBUG("Done reading. Closing socket...");
mtcp_close(mctx, sockfd); mtcp_close(mctx, sockfd);
DEBUG("Socket closed."); DEBUG("Socket closed.");
printf("\n\n"); printf("\n\n");
elapsed_time = (t2.tv_sec - t1.tv_sec) * 1.0; elapsed_time = (t2.tv_sec - t1.tv_sec) * 1.0;
elapsed_time += (t2.tv_usec - t1.tv_usec) / 1000000.0; elapsed_time += (t2.tv_usec - t1.tv_usec) / 1000000.0;
printf("Time elapsed: %f\n", elapsed_time); printf("Time elapsed: %f\n", elapsed_time);
printf("Total bytes sent: %d\n", bytes_sent); printf("Total bytes sent: %d\n", bytes_sent);
printf("Throughput: %.3fMbit/sec\n", ((bytes_sent * 8.0 / 1000000.0) / elapsed_time)); printf("Throughput: %.3fMbit/sec\n", ((bytes_sent * 8.0 / 1000000.0) / elapsed_time));
mtcp_destroy_context(ctx->mctx); mtcp_destroy_context(ctx->mctx);
free(ctx); free(ctx);
mtcp_destroy(); mtcp_destroy();
return 0; return 0;
} }

View File

@ -52,9 +52,9 @@ def server(mode):
port = None port = None
if mode == "wait": if mode == "wait":
port = eval(sys.argv[2]) port = eval(sys.argv[3])
s = socket(AF_INET, SOCK_STREAM) s = socket(AF_INET, SOCK_STREAM)
s.bind(('10.1.1.6', port)) s.bind((sys.argv[2], port))
s.listen(1) s.listen(1)
print 'Server ready...' print 'Server ready...'
while 1: while 1:
@ -85,7 +85,7 @@ def main():
else: else:
mode = sys.argv[1] mode = sys.argv[1]
if mode == "wait": if mode == "wait":
if len(sys.argv) != 3: if len(sys.argv) != 4:
usage() usage()
elif mode == "send": elif mode == "send":
if len(sys.argv) != 4: if len(sys.argv) != 4:

13
compile
View File

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Wrapper for compilers which do not understand '-c -o'. # Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc. # Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>. # Written by Tom Tromey <tromey@cygnus.com>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
@ -255,7 +255,8 @@ EOF
echo "compile $scriptversion" echo "compile $scriptversion"
exit $? exit $?
;; ;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return... func_cl_wrapper "$@" # Doesn't return...
;; ;;
esac esac
@ -339,9 +340,9 @@ exit $ret
# Local Variables: # Local Variables:
# mode: shell-script # mode: shell-script
# sh-indentation: 2 # sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC" # time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC" # time-stamp-end: "; # UTC"
# End: # End:

645
configure vendored
View File

@ -638,7 +638,6 @@ am__nodep
AMDEPBACKSLASH AMDEPBACKSLASH
AMDEP_FALSE AMDEP_FALSE
AMDEP_TRUE AMDEP_TRUE
am__quote
am__include am__include
DEPDIR DEPDIR
am__untar am__untar
@ -729,7 +728,8 @@ PACKAGE_VERSION
PACKAGE_TARNAME PACKAGE_TARNAME
PACKAGE_NAME PACKAGE_NAME
PATH_SEPARATOR PATH_SEPARATOR
SHELL' SHELL
am__quote'
ac_subst_files='' ac_subst_files=''
ac_user_opts=' ac_user_opts='
enable_option_checking enable_option_checking
@ -4359,6 +4359,8 @@ main ()
if (*(data + i) != *(data3 + i)) if (*(data + i) != *(data3 + i))
return 14; return 14;
close (fd); close (fd);
free (data);
free (data3);
return 0; return 0;
} }
_ACEOF _ACEOF
@ -4598,7 +4600,7 @@ fi
fi fi
am__api_version='1.15' am__api_version='1.16'
# Find a good install program. We prefer a C program (faster), # Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or # so one script is as good as another. But avoid the broken or
@ -5024,45 +5026,45 @@ DEPDIR="${am__leading_dot}deps"
ac_config_commands="$ac_config_commands depfiles" ac_config_commands="$ac_config_commands depfiles"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
am_make=${MAKE-make} $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
cat > confinc << 'END' cat > confinc.mk << 'END'
am__doit: am__doit:
@echo this is the am__doit target @echo this is the am__doit target >confinc.out
.PHONY: am__doit .PHONY: am__doit
END END
# If we don't find an include directive, just comment out the code.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
$as_echo_n "checking for style of include used by $am_make... " >&6; }
am__include="#" am__include="#"
am__quote= am__quote=
_am_result=none # BSD make does it like this.
# First try GNU make style include. echo '.include "confinc.mk" # ignored' > confmf.BSD
echo "include confinc" > confmf # Other make implementations (GNU, Solaris 10, AIX) do it like this.
# Ignore all kinds of additional output from 'make'. echo 'include confinc.mk # ignored' > confmf.GNU
case `$am_make -s -f confmf 2> /dev/null` in #( _am_result=no
*the\ am__doit\ target*) for s in GNU BSD; do
am__include=include { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
am__quote= (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
_am_result=GNU ac_status=$?
;; echo "$as_me:$LINENO: \$? = $ac_status" >&5
esac (exit $ac_status); }
# Now try BSD make style include. case $?:`cat confinc.out 2>/dev/null` in #(
if test "$am__include" = "#"; then '0:this is the am__doit target') :
echo '.include "confinc"' > confmf case $s in #(
case `$am_make -s -f confmf 2> /dev/null` in #( BSD) :
*the\ am__doit\ target*) am__include='.include' am__quote='"' ;; #(
am__include=.include *) :
am__quote="\"" am__include='include' am__quote='' ;;
_am_result=BSD esac ;; #(
*) :
;; ;;
esac esac
fi if test "$am__include" != "#"; then
_am_result="yes ($s style)"
break
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 fi
$as_echo "$_am_result" >&6; } done
rm -f confinc confmf rm -f confinc.* confmf.*
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
$as_echo "${_am_result}" >&6; }
# Check whether --enable-dependency-tracking was given. # Check whether --enable-dependency-tracking was given.
if test "${enable_dependency_tracking+set}" = set; then : if test "${enable_dependency_tracking+set}" = set; then :
@ -5175,8 +5177,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
# For better backward compatibility. To be removed once Automake 1.9.x # For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see: # dies out for good. For more background, see:
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
mkdir_p='$(MKDIR_P)' mkdir_p='$(MKDIR_P)'
# We need awk for the "check" target (and possibly the TAP driver). The # We need awk for the "check" target (and possibly the TAP driver). The
@ -5355,7 +5357,7 @@ END
Aborting the configuration process, to ensure you take notice of the issue. Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <http://www.gnu.org/software/coreutils/>. that behaves properly: <https://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@ -6089,7 +6091,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# #
# INIT-COMMANDS # INIT-COMMANDS
# #
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
_ACEOF _ACEOF
@ -6702,29 +6704,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
# Older Autoconf quotes --file arguments for eval, but not when files # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval # are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting. # if we detect the quoting.
case $CONFIG_FILES in # TODO: see whether this extra hack can be removed once we start
*\'*) eval set x "$CONFIG_FILES" ;; # requiring Autoconf 2.70 or later.
*) set x $CONFIG_FILES ;; case $CONFIG_FILES in #(
esac *\'*) :
eval set x "$CONFIG_FILES" ;; #(
*) :
set x $CONFIG_FILES ;; #(
*) :
;;
esac
shift shift
for mf # Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do do
# Strip MF so we end up with the name of the file. # Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'` am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not. # Check whether this is an Automake generated Makefile which includes
# We used to match only the files named 'Makefile.in', but # dependency-tracking related rules and includes.
# some people rename them; so instead we look at the file content. # Grep'ing the whole file directly is not great: AIX grep has a line
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000. # limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
dirpart=`$as_dirname -- "$mf" || || continue
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ am_dirpart=`$as_dirname -- "$am_mf" ||
X"$mf" : 'X\(//\)[^/]' \| \ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(/\)' \| . 2>/dev/null || X"$am_mf" : 'X\(//\)$' \| \
$as_echo X"$mf" | X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$am_mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/ s//\1/
q q
@ -6742,53 +6750,48 @@ $as_echo X"$mf" |
q q
} }
s/.*/./; q'` s/.*/./; q'`
else am_filepart=`$as_basename -- "$am_mf" ||
continue $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
fi X"$am_mf" : 'X\(//\)$' \| \
# Extract the definition of DEPDIR, am__include, and am__quote X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
# from the Makefile without running 'make'. $as_echo X/"$am_mf" |
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` sed '/^.*\/\([^/][^/]*\)\/*$/{
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`$as_dirname -- "$file" ||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
X"$file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/ s//\1/
q q
} }
/^X\(\/\/\)[^/].*/{ /^X\/\(\/\/\)$/{
s//\1/ s//\1/
q q
} }
/^X\(\/\/\)$/{ /^X\/\(\/\).*/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/ s//\1/
q q
} }
s/.*/./; q'` s/.*/./; q'`
as_dir=$dirpart/$fdir; as_fn_mkdir_p { echo "$as_me:$LINENO: cd "$am_dirpart" \
# echo "creating $dirpart/$file" && sed -e '/# am--include-marker/d' "$am_filepart" \
echo '# dummy' > "$dirpart/$file" | $MAKE -f - am--depfiles" >&5
done (cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } || am_rc=$?
done done
if test $am_rc -ne 0; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).
See \`config.log' for more details" "$LINENO" 5; }
fi
{ am_dirpart=; unset am_dirpart;}
{ am_filepart=; unset am_filepart;}
{ am_mf=; unset am_mf;}
{ am_rc=; unset am_rc;}
rm -f conftest-deps.mk
} }
;; ;;
@ -7554,7 +7557,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# #
# INIT-COMMANDS # INIT-COMMANDS
# #
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
_ACEOF _ACEOF
@ -8168,29 +8171,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
# Older Autoconf quotes --file arguments for eval, but not when files # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval # are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting. # if we detect the quoting.
case $CONFIG_FILES in # TODO: see whether this extra hack can be removed once we start
*\'*) eval set x "$CONFIG_FILES" ;; # requiring Autoconf 2.70 or later.
*) set x $CONFIG_FILES ;; case $CONFIG_FILES in #(
esac *\'*) :
eval set x "$CONFIG_FILES" ;; #(
*) :
set x $CONFIG_FILES ;; #(
*) :
;;
esac
shift shift
for mf # Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do do
# Strip MF so we end up with the name of the file. # Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'` am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not. # Check whether this is an Automake generated Makefile which includes
# We used to match only the files named 'Makefile.in', but # dependency-tracking related rules and includes.
# some people rename them; so instead we look at the file content. # Grep'ing the whole file directly is not great: AIX grep has a line
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000. # limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
dirpart=`$as_dirname -- "$mf" || || continue
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ am_dirpart=`$as_dirname -- "$am_mf" ||
X"$mf" : 'X\(//\)[^/]' \| \ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(/\)' \| . 2>/dev/null || X"$am_mf" : 'X\(//\)$' \| \
$as_echo X"$mf" | X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$am_mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/ s//\1/
q q
@ -8208,53 +8217,48 @@ $as_echo X"$mf" |
q q
} }
s/.*/./; q'` s/.*/./; q'`
else am_filepart=`$as_basename -- "$am_mf" ||
continue $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
fi X"$am_mf" : 'X\(//\)$' \| \
# Extract the definition of DEPDIR, am__include, and am__quote X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
# from the Makefile without running 'make'. $as_echo X/"$am_mf" |
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` sed '/^.*\/\([^/][^/]*\)\/*$/{
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`$as_dirname -- "$file" ||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
X"$file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/ s//\1/
q q
} }
/^X\(\/\/\)[^/].*/{ /^X\/\(\/\/\)$/{
s//\1/ s//\1/
q q
} }
/^X\(\/\/\)$/{ /^X\/\(\/\).*/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/ s//\1/
q q
} }
s/.*/./; q'` s/.*/./; q'`
as_dir=$dirpart/$fdir; as_fn_mkdir_p { echo "$as_me:$LINENO: cd "$am_dirpart" \
# echo "creating $dirpart/$file" && sed -e '/# am--include-marker/d' "$am_filepart" \
echo '# dummy' > "$dirpart/$file" | $MAKE -f - am--depfiles" >&5
done (cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } || am_rc=$?
done done
if test $am_rc -ne 0; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).
See \`config.log' for more details" "$LINENO" 5; }
fi
{ am_dirpart=; unset am_dirpart;}
{ am_filepart=; unset am_filepart;}
{ am_mf=; unset am_mf;}
{ am_rc=; unset am_rc;}
rm -f conftest-deps.mk
} }
;; ;;
@ -9024,7 +9028,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# #
# INIT-COMMANDS # INIT-COMMANDS
# #
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
_ACEOF _ACEOF
@ -9639,29 +9643,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
# Older Autoconf quotes --file arguments for eval, but not when files # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval # are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting. # if we detect the quoting.
case $CONFIG_FILES in # TODO: see whether this extra hack can be removed once we start
*\'*) eval set x "$CONFIG_FILES" ;; # requiring Autoconf 2.70 or later.
*) set x $CONFIG_FILES ;; case $CONFIG_FILES in #(
esac *\'*) :
eval set x "$CONFIG_FILES" ;; #(
*) :
set x $CONFIG_FILES ;; #(
*) :
;;
esac
shift shift
for mf # Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do do
# Strip MF so we end up with the name of the file. # Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'` am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not. # Check whether this is an Automake generated Makefile which includes
# We used to match only the files named 'Makefile.in', but # dependency-tracking related rules and includes.
# some people rename them; so instead we look at the file content. # Grep'ing the whole file directly is not great: AIX grep has a line
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000. # limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
dirpart=`$as_dirname -- "$mf" || || continue
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ am_dirpart=`$as_dirname -- "$am_mf" ||
X"$mf" : 'X\(//\)[^/]' \| \ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(/\)' \| . 2>/dev/null || X"$am_mf" : 'X\(//\)$' \| \
$as_echo X"$mf" | X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$am_mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/ s//\1/
q q
@ -9679,53 +9689,48 @@ $as_echo X"$mf" |
q q
} }
s/.*/./; q'` s/.*/./; q'`
else am_filepart=`$as_basename -- "$am_mf" ||
continue $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
fi X"$am_mf" : 'X\(//\)$' \| \
# Extract the definition of DEPDIR, am__include, and am__quote X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
# from the Makefile without running 'make'. $as_echo X/"$am_mf" |
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` sed '/^.*\/\([^/][^/]*\)\/*$/{
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`$as_dirname -- "$file" ||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
X"$file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/ s//\1/
q q
} }
/^X\(\/\/\)[^/].*/{ /^X\/\(\/\/\)$/{
s//\1/ s//\1/
q q
} }
/^X\(\/\/\)$/{ /^X\/\(\/\).*/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/ s//\1/
q q
} }
s/.*/./; q'` s/.*/./; q'`
as_dir=$dirpart/$fdir; as_fn_mkdir_p { echo "$as_me:$LINENO: cd "$am_dirpart" \
# echo "creating $dirpart/$file" && sed -e '/# am--include-marker/d' "$am_filepart" \
echo '# dummy' > "$dirpart/$file" | $MAKE -f - am--depfiles" >&5
done (cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } || am_rc=$?
done done
if test $am_rc -ne 0; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).
See \`config.log' for more details" "$LINENO" 5; }
fi
{ am_dirpart=; unset am_dirpart;}
{ am_filepart=; unset am_filepart;}
{ am_mf=; unset am_mf;}
{ am_rc=; unset am_rc;}
rm -f conftest-deps.mk
} }
;; ;;
@ -10499,7 +10504,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# #
# INIT-COMMANDS # INIT-COMMANDS
# #
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
_ACEOF _ACEOF
@ -11115,29 +11120,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
# Older Autoconf quotes --file arguments for eval, but not when files # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval # are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting. # if we detect the quoting.
case $CONFIG_FILES in # TODO: see whether this extra hack can be removed once we start
*\'*) eval set x "$CONFIG_FILES" ;; # requiring Autoconf 2.70 or later.
*) set x $CONFIG_FILES ;; case $CONFIG_FILES in #(
esac *\'*) :
eval set x "$CONFIG_FILES" ;; #(
*) :
set x $CONFIG_FILES ;; #(
*) :
;;
esac
shift shift
for mf # Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do do
# Strip MF so we end up with the name of the file. # Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'` am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not. # Check whether this is an Automake generated Makefile which includes
# We used to match only the files named 'Makefile.in', but # dependency-tracking related rules and includes.
# some people rename them; so instead we look at the file content. # Grep'ing the whole file directly is not great: AIX grep has a line
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000. # limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
dirpart=`$as_dirname -- "$mf" || || continue
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ am_dirpart=`$as_dirname -- "$am_mf" ||
X"$mf" : 'X\(//\)[^/]' \| \ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(/\)' \| . 2>/dev/null || X"$am_mf" : 'X\(//\)$' \| \
$as_echo X"$mf" | X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$am_mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/ s//\1/
q q
@ -11155,53 +11166,48 @@ $as_echo X"$mf" |
q q
} }
s/.*/./; q'` s/.*/./; q'`
else am_filepart=`$as_basename -- "$am_mf" ||
continue $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
fi X"$am_mf" : 'X\(//\)$' \| \
# Extract the definition of DEPDIR, am__include, and am__quote X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
# from the Makefile without running 'make'. $as_echo X/"$am_mf" |
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` sed '/^.*\/\([^/][^/]*\)\/*$/{
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`$as_dirname -- "$file" ||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
X"$file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/ s//\1/
q q
} }
/^X\(\/\/\)[^/].*/{ /^X\/\(\/\/\)$/{
s//\1/ s//\1/
q q
} }
/^X\(\/\/\)$/{ /^X\/\(\/\).*/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/ s//\1/
q q
} }
s/.*/./; q'` s/.*/./; q'`
as_dir=$dirpart/$fdir; as_fn_mkdir_p { echo "$as_me:$LINENO: cd "$am_dirpart" \
# echo "creating $dirpart/$file" && sed -e '/# am--include-marker/d' "$am_filepart" \
echo '# dummy' > "$dirpart/$file" | $MAKE -f - am--depfiles" >&5
done (cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } || am_rc=$?
done done
if test $am_rc -ne 0; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).
See \`config.log' for more details" "$LINENO" 5; }
fi
{ am_dirpart=; unset am_dirpart;}
{ am_filepart=; unset am_filepart;}
{ am_mf=; unset am_mf;}
{ am_rc=; unset am_rc;}
rm -f conftest-deps.mk
} }
;; ;;
@ -11979,7 +11985,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# #
# INIT-COMMANDS # INIT-COMMANDS
# #
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
_ACEOF _ACEOF
@ -12596,29 +12602,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
# Older Autoconf quotes --file arguments for eval, but not when files # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval # are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting. # if we detect the quoting.
case $CONFIG_FILES in # TODO: see whether this extra hack can be removed once we start
*\'*) eval set x "$CONFIG_FILES" ;; # requiring Autoconf 2.70 or later.
*) set x $CONFIG_FILES ;; case $CONFIG_FILES in #(
esac *\'*) :
eval set x "$CONFIG_FILES" ;; #(
*) :
set x $CONFIG_FILES ;; #(
*) :
;;
esac
shift shift
for mf # Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do do
# Strip MF so we end up with the name of the file. # Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'` am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not. # Check whether this is an Automake generated Makefile which includes
# We used to match only the files named 'Makefile.in', but # dependency-tracking related rules and includes.
# some people rename them; so instead we look at the file content. # Grep'ing the whole file directly is not great: AIX grep has a line
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000. # limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
dirpart=`$as_dirname -- "$mf" || || continue
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ am_dirpart=`$as_dirname -- "$am_mf" ||
X"$mf" : 'X\(//\)[^/]' \| \ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(/\)' \| . 2>/dev/null || X"$am_mf" : 'X\(//\)$' \| \
$as_echo X"$mf" | X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$am_mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/ s//\1/
q q
@ -12636,53 +12648,48 @@ $as_echo X"$mf" |
q q
} }
s/.*/./; q'` s/.*/./; q'`
else am_filepart=`$as_basename -- "$am_mf" ||
continue $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
fi X"$am_mf" : 'X\(//\)$' \| \
# Extract the definition of DEPDIR, am__include, and am__quote X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
# from the Makefile without running 'make'. $as_echo X/"$am_mf" |
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` sed '/^.*\/\([^/][^/]*\)\/*$/{
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`$as_dirname -- "$file" ||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
X"$file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/ s//\1/
q q
} }
/^X\(\/\/\)[^/].*/{ /^X\/\(\/\/\)$/{
s//\1/ s//\1/
q q
} }
/^X\(\/\/\)$/{ /^X\/\(\/\).*/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/ s//\1/
q q
} }
s/.*/./; q'` s/.*/./; q'`
as_dir=$dirpart/$fdir; as_fn_mkdir_p { echo "$as_me:$LINENO: cd "$am_dirpart" \
# echo "creating $dirpart/$file" && sed -e '/# am--include-marker/d' "$am_filepart" \
echo '# dummy' > "$dirpart/$file" | $MAKE -f - am--depfiles" >&5
done (cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } || am_rc=$?
done done
if test $am_rc -ne 0; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).
See \`config.log' for more details" "$LINENO" 5; }
fi
{ am_dirpart=; unset am_dirpart;}
{ am_filepart=; unset am_filepart;}
{ am_mf=; unset am_mf;}
{ am_rc=; unset am_rc;}
rm -f conftest-deps.mk
} }
;; ;;

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# install - install a program, script, or datafile # install - install a program, script, or datafile
scriptversion=2014-09-12.12; # UTC scriptversion=2018-03-11.20; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was # This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the # later released in X11R6 (xc/config/util/install.sh) with the
@ -271,15 +271,18 @@ do
fi fi
dst=$dst_arg dst=$dst_arg
# If destination is a directory, append the input filename; won't work # If destination is a directory, append the input filename.
# if double slashes aren't ignored.
if test -d "$dst"; then if test -d "$dst"; then
if test "$is_target_a_directory" = never; then if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2 echo "$0: $dst_arg: Is a directory" >&2
exit 1 exit 1
fi fi
dstdir=$dst dstdir=$dst
dst=$dstdir/`basename "$src"` dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0 dstdir_status=0
else else
dstdir=`dirname "$dst"` dstdir=`dirname "$dst"`
@ -288,6 +291,11 @@ do
fi fi
fi fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false obsolete_mkdir_used=false
if test $dstdir_status != 0; then if test $dstdir_status != 0; then
@ -324,14 +332,16 @@ do
# is incompatible with FreeBSD 'install' when (umask & 300) != 0. # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;; ;;
*) *)
# $RANDOM is not portable (e.g. dash); use it when possible to # Note that $RANDOM variable is not portable (e.g. dash); Use it
# lower collision chance # here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
# As "mkdir -p" follows symlinks and we work in /tmp possibly; so # Because "mkdir -p" follows existing symlinks and we likely work
# create the $tmpdir first (and fail if unsuccessful) to make sure # directly in world-writeable /tmp, make sure that the '$tmpdir'
# that nobody tries to guess the $tmpdir name. # directory is successfully created first before we actually test
# 'mkdir -p' feature.
if (umask $mkdir_umask && if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" && $mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
@ -434,8 +444,8 @@ do
else else
# Make a couple of temp file names in the proper directory. # Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_ dsttmp=${dstdirslash}_inst.$$_
rmtmp=$dstdir/_rm.$$_ rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit. # Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
@ -500,9 +510,9 @@ do
done done
# Local variables: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC" # time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC" # time-stamp-end: "; # UTC"
# End: # End:

16
missing
View File

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Common wrapper for a few potentially missing GNU programs. # Common wrapper for a few potentially missing GNU programs.
scriptversion=2013-10-28.13; # UTC scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2014 Free Software Foundation, Inc. # Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC
# GNU General Public License for more details. # GNU General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
@ -101,9 +101,9 @@ else
exit $st exit $st
fi fi
perl_URL=http://www.perl.org/ perl_URL=https://www.perl.org/
flex_URL=http://flex.sourceforge.net/ flex_URL=https://github.com/westes/flex
gnu_software_URL=http://www.gnu.org/software gnu_software_URL=https://www.gnu.org/software
program_details () program_details ()
{ {
@ -207,9 +207,9 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \
exit $st exit $st
# Local variables: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC" # time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC" # time-stamp-end: "; # UTC"
# End: # End:

View File

@ -98,18 +98,11 @@ INC += -I$(PS_DIR)/include
# CFLAGS for DPDK-related compilation # CFLAGS for DPDK-related compilation
ifeq ($(DPDK), 1) ifeq ($(DPDK), 1)
# !!! FROM UPSTREAM
include $(RTE_SDK)/mk/rte.vars.mk include $(RTE_SDK)/mk/rte.vars.mk
CFLAGS+=@CFLAGS@ CFLAGS+=@CFLAGS@
ifeq ($(ENFORCE_RX_IDLE), 1) ifeq ($(ENFORCE_RX_IDLE), 1)
INC += -DENFORCE_RX_IDLE -DRX_IDLE_THRESH=@RX_IDLE_THRESH@ INC += -DENFORCE_RX_IDLE -DRX_IDLE_THRESH=@RX_IDLE_THRESH@
endif endif
# !!! NEEDED FOR DPDK-17.08, MIGHT NEED TO UNCOMMENT LATER
#DPDK_MACHINE_FLAGS = $(shell cat @DPDKLIBPATH@/include/cflags.txt)
#INC += ${DPDK_MACHINE_FLAGS} -I${DPDK_INC} -include $(DPDK_INC)/rte_config.h
else else
INC += -DDISABLE_DPDK INC += -DDISABLE_DPDK
endif endif

View File

@ -12,234 +12,249 @@
#include "ccp.h" #include "ccp.h"
#include "libccp/ccp.h" #include "libccp/ccp.h"
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
static inline void
static inline void get_stream_from_ccp( get_stream_from_ccp(tcp_stream **stream, struct ccp_connection *conn)
tcp_stream **stream, {
struct ccp_connection *conn *stream = (tcp_stream *) ccp_get_impl(conn);
) {
*stream = (tcp_stream *) ccp_get_impl(conn);
} }
/*----------------------------------------------------------------------------*/
static inline void get_mtcp_from_ccp( static inline void
mtcp_manager_t *mtcp get_mtcp_from_ccp(mtcp_manager_t *mtcp)
) { {
*mtcp = (mtcp_manager_t) ccp_get_global_impl(); *mtcp = (mtcp_manager_t) ccp_get_global_impl();
} }
/*----------------------------------------------------------------------------*/
/* Function handlers passed to libccp */ /* Function handlers passed to libccp */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
static void _dp_set_cwnd(struct ccp_datapath *dp, struct ccp_connection *conn, uint32_t cwnd) { static void
tcp_stream *stream; _dp_set_cwnd(struct ccp_datapath *dp, struct ccp_connection *conn, uint32_t cwnd)
get_stream_from_ccp(&stream, conn); {
uint32_t new_cwnd = MAX(cwnd, TCP_INIT_CWND * stream->sndvar->mss); tcp_stream *stream;
get_stream_from_ccp(&stream, conn);
uint32_t new_cwnd = MAX(cwnd, TCP_INIT_CWND * stream->sndvar->mss);
// (time_ms) (rtt) (curr_cwnd_pkts) (new_cwnd_pkts) (ssthresh) // (time_ms) (rtt) (curr_cwnd_pkts) (new_cwnd_pkts) (ssthresh)
if (cwnd != stream->sndvar->cwnd) { if (cwnd != stream->sndvar->cwnd) {
CCP_PROBE("%lu %d %d->%d (ss=%d)\n", CCP_PROBE("%lu %d %d->%d (ss=%d)\n",
now_usecs() / 1000, now_usecs() / 1000,
stream->rcvvar->srtt * 125, stream->rcvvar->srtt * 125,
stream->sndvar->cwnd / stream->sndvar->mss, stream->sndvar->cwnd / stream->sndvar->mss,
new_cwnd / stream->sndvar->mss, new_cwnd / stream->sndvar->mss,
stream->sndvar->ssthresh / stream->sndvar->mss stream->sndvar->ssthresh / stream->sndvar->mss
); );
} }
stream->sndvar->cwnd = new_cwnd; stream->sndvar->cwnd = new_cwnd;
} }
/*----------------------------------------------------------------------------*/
static void _dp_set_rate_abs(struct ccp_datapath *dp, struct ccp_connection *conn, uint32_t rate) { static void
tcp_stream *stream; _dp_set_rate_abs(struct ccp_datapath *dp, struct ccp_connection *conn, uint32_t rate)
get_stream_from_ccp(&stream, conn); {
tcp_stream *stream;
get_stream_from_ccp(&stream, conn);
#if PACING_ENABLED || RATE_LIMIT_ENABLED #if PACING_ENABLED || RATE_LIMIT_ENABLED
#if RATE_LIMIT_ENABLED #if RATE_LIMIT_ENABLED
stream->bucket->rate = rate; stream->bucket->rate = rate;
#endif #endif
#if PACING_ENABLED #if PACING_ENABLED
stream->pacer->rate_bps = rate; stream->pacer->rate_bps = rate;
#endif #endif
#else #else
TRACE_ERROR("unable to set rate, both PACING and RATE_LIMIT are disabled. enable one to use rates.\n"); TRACE_ERROR("unable to set rate, both PACING and RATE_LIMIT are disabled."
" Enable one to use rates.\n");
#endif #endif
} }
/*----------------------------------------------------------------------------*/
static void _dp_set_rate_rel(struct ccp_datapath *dp, struct ccp_connection *conn, uint32_t factor) { static void
tcp_stream *stream; _dp_set_rate_rel(struct ccp_datapath *dp, struct ccp_connection *conn, uint32_t factor)
get_stream_from_ccp(&stream, conn); {
tcp_stream *stream;
get_stream_from_ccp(&stream, conn);
#if PACING_ENABLED || RATE_LIMIT_ENABLED #if PACING_ENABLED || RATE_LIMIT_ENABLED
#if RATE_LIMIT_ENABLED #if RATE_LIMIT_ENABLED
stream->bucket->rate *= (factor / 100); stream->bucket->rate *= (factor / 100);
#endif
#if PACING_ENABLED
stream->pacer->rate_bps *= (factor / 100);
#endif
#else
TRACE_ERROR("unable to set rate, both PACING and RATE_LIMIT are disabled. enable one to use rates.\n");
#endif #endif
#if PACING_ENABLED
stream->pacer->rate_bps *= (factor / 100);
#endif
#else
TRACE_ERROR("unable to set rate, both PACING and RATE_LIMIT are disabled."
" Enable one to use rates.\n");
#endif
} }
/*----------------------------------------------------------------------------*/
int
_dp_send_msg(struct ccp_datapath *dp, struct ccp_connection *conn, char *msg, int msg_size)
{
mtcp_manager_t mtcp;
get_mtcp_from_ccp(&mtcp);
int _dp_send_msg(struct ccp_datapath *dp, struct ccp_connection *conn, char *msg, int msg_size) { int ret = send(mtcp->to_ccp, msg, msg_size, 0);
mtcp_manager_t mtcp; if (ret < 0) {
get_mtcp_from_ccp(&mtcp); TRACE_ERROR("failed to send msg to ccp: %s\n", strerror(errno));
}
int ret = send(mtcp->to_ccp, msg, msg_size, 0); return ret;
if (ret < 0) {
TRACE_ERROR("failed to send msg to ccp: %s\n", strerror(errno));
}
return ret;
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Connect to CCP process via unix sockets */ /* Connect to CCP process via unix sockets */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void setup_ccp_connection(mtcp_manager_t mtcp) { void
mtcp_thread_context_t ctx = mtcp->ctx; setup_ccp_connection(mtcp_manager_t mtcp)
// TODO do we need a socket per core? {
int cpu = ctx->cpu; mtcp_thread_context_t ctx = mtcp->ctx;
//char cpu_str[2] = ""; // TODO do we need a socket per core?
int recv_sock; int cpu = ctx->cpu;
int path_len; //char cpu_str[2] = "";
int ret; int recv_sock;
struct sockaddr_un local; int path_len;
int ret;
struct sockaddr_un local;
// Make sure unix socket path exists // Make sure unix socket path exists
ret = mkdir(CCP_UNIX_BASE, 0755); ret = mkdir(CCP_UNIX_BASE, 0755);
if (ret < 0 && errno != EEXIST) { if (ret < 0 && errno != EEXIST) {
TRACE_ERROR("failed to create path for ccp unix socket (%d): %s\n", ret, strerror(errno)); TRACE_ERROR("Failed to create path for ccp unix socket (%d): %s\n",
} ret, strerror(errno));
ret = mkdir(CCP_UNIX_BASE CCP_ID, 0755); }
if (ret < 0 && errno != EEXIST) { ret = mkdir(CCP_UNIX_BASE CCP_ID, 0755);
TRACE_ERROR("failed to create path for ccp unix socket (%d): %s\n", ret, strerror(errno)); if (ret < 0 && errno != EEXIST) {
} TRACE_ERROR("Failed to create path for ccp unix socket (%d): %s\n",
if ((recv_sock = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) { ret, strerror(errno));
TRACE_ERROR("failed to create unix recv socket for ccp comm\n"); }
exit(-1); if ((recv_sock = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
} TRACE_ERROR("Failed to create unix recv socket for ccp comm\n");
local.sun_family = AF_UNIX; exit(EXIT_FAILURE);
strcpy(local.sun_path, FROM_CCP_PATH); }
unlink(local.sun_path); local.sun_family = AF_UNIX;
path_len = strlen(local.sun_path) + sizeof(local.sun_family); strcpy(local.sun_path, FROM_CCP_PATH);
if (bind(recv_sock, (struct sockaddr *)&local, path_len) == -1) { unlink(local.sun_path);
TRACE_ERROR("(cpu %d) failed to bind to unix://%s because %s\n", cpu, FROM_CCP_PATH, strerror(errno)); path_len = strlen(local.sun_path) + sizeof(local.sun_family);
exit(-1); if (bind(recv_sock, (struct sockaddr *)&local, path_len) == -1) {
} TRACE_ERROR("(Cpu %d) failed to bind to unix://%s because %s\n",
mtcp->from_ccp = recv_sock; cpu, FROM_CCP_PATH, strerror(errno));
exit(EXIT_FAILURE);
}
mtcp->from_ccp = recv_sock;
struct ccp_datapath dp = { struct ccp_datapath dp = {
.set_cwnd = &_dp_set_cwnd, .set_cwnd = &_dp_set_cwnd,
.set_rate_abs = &_dp_set_rate_abs, .set_rate_abs = &_dp_set_rate_abs,
.set_rate_rel = &_dp_set_rate_rel, .set_rate_rel = &_dp_set_rate_rel,
.send_msg = &_dp_send_msg, .send_msg = &_dp_send_msg,
.now = &now_usecs, .now = &now_usecs,
.since_usecs = &time_since_usecs, .since_usecs = &time_since_usecs,
.after_usecs = &time_after_usecs, .after_usecs = &time_after_usecs,
.impl = mtcp .impl = mtcp
}; };
if (ccp_init(&dp) < 0) {
TRACE_ERROR("failed to initialize ccp connection map\n");
exit(-1);
}
if (ccp_init(&dp) < 0) {
TRACE_ERROR("Failed to initialize ccp connection map\n");
exit(EXIT_FAILURE);
}
} }
/*----------------------------------------------------------------------------*/
void setup_ccp_send_socket(mtcp_manager_t mtcp) { void
int send_sock; setup_ccp_send_socket(mtcp_manager_t mtcp)
int path_len; {
struct sockaddr_un remote; int send_sock;
if ((send_sock = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) { int path_len;
TRACE_ERROR("failed to create unix send socket for ccp comm\n"); struct sockaddr_un remote;
exit(-1); if ((send_sock = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
} TRACE_ERROR("failed to create unix send socket for ccp comm\n");
remote.sun_family = AF_UNIX; exit(EXIT_FAILURE);
strcpy(remote.sun_path, TO_CCP_PATH);//TODO:CCP }
path_len = strlen(remote.sun_path) + sizeof(remote.sun_family); remote.sun_family = AF_UNIX;
if (connect(send_sock, (struct sockaddr *)&remote, path_len) == -1) { strcpy(remote.sun_path, TO_CCP_PATH);//TODO:CCP
TRACE_ERROR("failed to connect to unix://%s because %s\n", TO_CCP_PATH, strerror(errno)); path_len = strlen(remote.sun_path) + sizeof(remote.sun_family);
exit(-1); if (connect(send_sock, (struct sockaddr *)&remote, path_len) == -1) {
} TRACE_ERROR("failed to connect to unix://%s because %s\n", TO_CCP_PATH, strerror(errno));
mtcp->to_ccp = send_sock; exit(EXIT_FAILURE);
}
mtcp->to_ccp = send_sock;
} }
/*----------------------------------------------------------------------------*/
void destroy_ccp_connection(mtcp_manager_t mtcp) { void
ccp_free(); destroy_ccp_connection(mtcp_manager_t mtcp)
close(mtcp->from_ccp); {
close(mtcp->to_ccp); ccp_free();
close(mtcp->from_ccp);
close(mtcp->to_ccp);
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Should be called when a new connection is created */ /* Should be called when a new connection is created */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void ccp_create(mtcp_manager_t mtcp, tcp_stream *stream) { void
ccp_create(mtcp_manager_t mtcp, tcp_stream *stream)
struct ccp_datapath_info info = { {
.init_cwnd = TCP_INIT_CWND, // TODO maybe multiply by mss? struct ccp_datapath_info info = {
.mss = stream->sndvar->mss, .init_cwnd = TCP_INIT_CWND, // TODO maybe multiply by mss?
.src_ip = stream->saddr, .mss = stream->sndvar->mss,
.src_port = stream->sport, .src_ip = stream->saddr,
.dst_ip = stream->daddr, .src_port = stream->sport,
.dst_port = stream->dport, .dst_ip = stream->daddr,
.congAlg = "reno" .dst_port = stream->dport,
}; .congAlg = "reno"
};
stream->ccp_conn = ccp_connection_start((void *) stream, &info);
if (stream->ccp_conn == NULL) {
TRACE_ERROR("failed to initialize ccp_connection")
} else {
TRACE_CCP("ccp.create(%d)\n", dp->index);
}
stream->ccp_conn = ccp_connection_start((void *) stream, &info);
if (stream->ccp_conn == NULL) {
TRACE_ERROR("failed to initialize ccp_connection")
} else {
TRACE_CCP("ccp.create(%d)\n", dp->index);
}
} }
/* Should be called on each ACK */ /* Should be called on each ACK */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
uint32_t last_drop_t = 0; uint32_t last_drop_t = 0;
void ccp_cong_control(mtcp_manager_t mtcp, tcp_stream *stream, void
uint32_t ack, uint64_t bytes_delivered, uint64_t packets_delivered) ccp_cong_control(mtcp_manager_t mtcp, tcp_stream *stream,
uint32_t ack, uint64_t bytes_delivered, uint64_t packets_delivered)
{ {
uint64_t rin = bytes_delivered, //* S_TO_US, // TODO:CCP divide by snd_int_us uint64_t rin = bytes_delivered, //* S_TO_US, // TODO:CCP divide by snd_int_us
rout = bytes_delivered; // * S_TO_US; // TODO:CCP divide by rcv_int_us rout = bytes_delivered; // * S_TO_US; // TODO:CCP divide by rcv_int_us
struct ccp_connection *conn = stream->ccp_conn; struct ccp_connection *conn = stream->ccp_conn;
struct ccp_primitives *mmt = &conn->prims; struct ccp_primitives *mmt = &conn->prims;
//log_cwnd_rtt(stream); //log_cwnd_rtt(stream);
mmt->bytes_acked = bytes_delivered; mmt->bytes_acked = bytes_delivered;
mmt->packets_acked = packets_delivered; mmt->packets_acked = packets_delivered;
mmt->snd_cwnd = stream->sndvar->cwnd; mmt->snd_cwnd = stream->sndvar->cwnd;
mmt->rtt_sample_us = stream->rcvvar->srtt * 125; mmt->rtt_sample_us = stream->rcvvar->srtt * 125;
mmt->bytes_in_flight = 0; // TODO mmt->bytes_in_flight = 0; // TODO
mmt->packets_in_flight = 0; // TODO mmt->packets_in_flight = 0; // TODO
mmt->rate_outgoing = rin; mmt->rate_outgoing = rin;
mmt->rate_incoming = rout; mmt->rate_incoming = rout;
#if TCP_OPT_SACK_ENABLED #if TCP_OPT_SACK_ENABLED
mmt->bytes_misordered = stream->rcvvar->sacked_pkts * 1448; mmt->bytes_misordered = stream->rcvvar->sacked_pkts * 1448;
mmt->packets_misordered = stream->rcvvar->sacked_pkts; mmt->packets_misordered = stream->rcvvar->sacked_pkts;
#endif #endif
/* /*
if (last_drop_t == 0 || _dp_since_usecs(last_drop_t) > 25000) { if (last_drop_t == 0 || _dp_since_usecs(last_drop_t) > 25000) {
mmt->lost_pkts_sample = 0; mmt->lost_pkts_sample = 0;
last_drop_t = now_usecs(); last_drop_t = now_usecs();
} }
*/ */
//fprintf(stderr, "mmt: %u %u\n", conn->prims.packets_misordered, conn->prims.lost_pkts_sample); //fprintf(stderr, "mmt: %u %u\n", conn->prims.packets_misordered, conn->prims.lost_pkts_sample);
if (conn != NULL) { if (conn != NULL) {
//fprintf(stderr, " lost_pkts=%u\n", mmt->lost_pkts_sample); //fprintf(stderr, " lost_pkts=%u\n", mmt->lost_pkts_sample);
ccp_invoke(conn); ccp_invoke(conn);
conn->prims.was_timeout = false; conn->prims.was_timeout = false;
conn->prims.bytes_misordered = 0; conn->prims.bytes_misordered = 0;
conn->prims.packets_misordered = 0; conn->prims.packets_misordered = 0;
conn->prims.lost_pkts_sample = 0; conn->prims.lost_pkts_sample = 0;
#if TCP_OPT_SACK_ENABLED #if TCP_OPT_SACK_ENABLED
stream->rcvvar->sacked_pkts = 0; stream->rcvvar->sacked_pkts = 0;
#endif #endif
} else { } else {
TRACE_ERROR("ccp_connection not initialized\n") TRACE_ERROR("ccp_connection not initialized\n");
}
}
} }
#if TCP_OPT_SACK_ENABLED #if TCP_OPT_SACK_ENABLED
@ -250,62 +265,63 @@ uint32_t last_tri_dupack_seq = 0;
/* Should be called for any other connection event other than ACK */ /* Should be called for any other connection event other than ACK */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void ccp_record_event(mtcp_manager_t mtcp, tcp_stream *stream, uint8_t event_type, uint32_t val) { void
ccp_record_event(mtcp_manager_t mtcp, tcp_stream *stream, uint8_t event_type, uint32_t val)
{
#ifdef DBGCCP #ifdef DBGCCP
unsigned long now = (unsigned long)(now_usecs()); unsigned long now = (unsigned long)(now_usecs());
#endif #endif
int i; int i;
switch(event_type) { switch(event_type) {
case EVENT_DUPACK: case EVENT_DUPACK:
#if TCP_OPT_SACK_ENABLED #if TCP_OPT_SACK_ENABLED
#else #else
// use num dupacks as a proxy for sacked // use num dupacks as a proxy for sacked
stream->ccp_conn->prims.bytes_misordered += val; stream->ccp_conn->prims.bytes_misordered += val;
stream->ccp_conn->prims.packets_misordered++; stream->ccp_conn->prims.packets_misordered++;
#endif #endif
break; break;
case EVENT_TRI_DUPACK: case EVENT_TRI_DUPACK:
#if TCP_OPT_SACK_ENABLED #if TCP_OPT_SACK_ENABLED
if (val > window_edge_at_last_loss) { if (val > window_edge_at_last_loss) {
TRACE_CCP("%lu tridup ack=%u\n", TRACE_CCP("%lu tridup ack=%u\n",
now / 1000, now / 1000,
val - stream->sndvar->iss val - stream->sndvar->iss
); );
for (i=0; i < MAX_SACK_ENTRY; i++) { for (i = 0; i < MAX_SACK_ENTRY; i++) {
window_edge_at_last_loss = MAX( window_edge_at_last_loss = MAX(
window_edge_at_last_loss, window_edge_at_last_loss,
stream->rcvvar->sack_table[i].right_edge stream->rcvvar->sack_table[i].right_edge
); );
} }
last_tri_dupack_seq = val; last_tri_dupack_seq = val;
last_loss = now_usecs(); last_loss = now_usecs();
stream->ccp_conn->prims.lost_pkts_sample++; stream->ccp_conn->prims.lost_pkts_sample++;
} }
#else #else
// only count as a loss if we haven't already seen 3 dupacks for // only count as a loss if we haven't already seen 3 dupacks for
// this seq number // this seq number
if (last_tri_dupack_seq != val) { if (last_tri_dupack_seq != val) {
TRACE_CCP("%lu tridup ack=%d\n", TRACE_CCP("%lu tridup ack=%d\n",
now / 1000, now / 1000,
val// - stream->sndvar->iss val// - stream->sndvar->iss
); );
stream->ccp_conn->prims.lost_pkts_sample++; stream->ccp_conn->prims.lost_pkts_sample++;
last_tri_dupack_seq = val; last_tri_dupack_seq = val;
} }
#endif #endif
break; break;
case EVENT_TIMEOUT: case EVENT_TIMEOUT:
//stream->ccp_conn->prims.was_timeout = true; //stream->ccp_conn->prims.was_timeout = true;
break; break;
case EVENT_ECN: case EVENT_ECN:
TRACE_ERROR("ecn is not currently supported!\n"); TRACE_ERROR("ecn is not currently supported!\n");
break; break;
default: default:
TRACE_ERROR("unknown record event type %d!\n", event_type); TRACE_ERROR("unknown record event type %d!\n", event_type);
break; break;
} }
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
#endif #endif

View File

@ -1,49 +1,55 @@
#include "clock.h" #include "clock.h"
/*----------------------------------------------------------------------------*/
uint64_t init_time_ns = 0; uint64_t init_time_ns = 0;
uint32_t last_print = 0; uint32_t last_print = 0;
/*----------------------------------------------------------------------------*/
uint64_t
now_usecs()
{
struct timespec now;
uint64_t now_ns, now_us;
uint64_t now_usecs() { clock_gettime(CLOCK_MONOTONIC, &now);
struct timespec now;
uint64_t now_ns, now_us;
clock_gettime(CLOCK_MONOTONIC, &now); now_ns = (1000000000L * now.tv_sec) + now.tv_nsec;
if (init_time_ns == 0) {
init_time_ns = now_ns;
}
now_ns = (1000000000L * now.tv_sec) + now.tv_nsec; now_us = ((now_ns - init_time_ns) / 1000) & 0xffffffff;
if (init_time_ns == 0) { return now_us;
init_time_ns = now_ns;
}
now_us = ((now_ns - init_time_ns) / 1000) & 0xffffffff;
return now_us;
} }
/*----------------------------------------------------------------------------*/
uint64_t time_since_usecs(uint64_t then) { uint64_t
return now_usecs() - then; time_since_usecs(uint64_t then) {
return now_usecs() - then;
} }
/*----------------------------------------------------------------------------*/
uint64_t time_after_usecs(uint64_t usecs) { uint64_t
return now_usecs() + usecs; time_after_usecs(uint64_t usecs) {
return now_usecs() + usecs;
} }
/*----------------------------------------------------------------------------*/
#define SAMPLE_FREQ_US 10000 #define SAMPLE_FREQ_US 10000
void log_cwnd_rtt(void *vs) { void
tcp_stream *stream = (tcp_stream *)vs; log_cwnd_rtt(void *vs) {
unsigned long now = (unsigned long)(now_usecs()); tcp_stream *stream = (tcp_stream *)vs;
if (time_since_usecs(last_print) > SAMPLE_FREQ_US) { unsigned long now = (unsigned long)(now_usecs());
fprintf(stderr, "%lu %d %d/%d\n", if (time_since_usecs(last_print) > SAMPLE_FREQ_US) {
now / 1000, fprintf(stderr, "%lu %d %d/%d\n",
stream->rcvvar->srtt * 125, now / 1000,
stream->sndvar->cwnd / stream->sndvar->mss, stream->rcvvar->srtt * 125,
stream->sndvar->peer_wnd / stream->sndvar->mss stream->sndvar->cwnd / stream->sndvar->mss,
); stream->sndvar->peer_wnd / stream->sndvar->mss
);
#if RATE_LIMIT_ENABLED #if RATE_LIMIT_ENABLED
PrintBucket(stream->bucket); PrintBucket(stream->bucket);
#endif #endif
#if PACING_ENABLED #if PACING_ENABLED
PrintPacer(stream->pacer); PrintPacer(stream->pacer);
#endif #endif
last_print = now; last_print = now;
} }
} }
/*----------------------------------------------------------------------------*/

View File

@ -38,7 +38,7 @@ struct mtcp_config CONFIG = {
.tcp_timewait = TCP_TIMEWAIT, .tcp_timewait = TCP_TIMEWAIT,
.num_mem_ch = 0, .num_mem_ch = 0,
#if USE_CCP #if USE_CCP
.cc = "reno\n", .cc = "reno\n",
#endif #endif
#ifdef ENABLE_ONVM #ifdef ENABLE_ONVM
.onvm_inst = (uint16_t) -1, .onvm_inst = (uint16_t) -1,

View File

@ -8,7 +8,8 @@
#include "logger.h" #include "logger.h"
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void flush_log_data(mtcp_manager_t mtcp) void
flush_log_data(mtcp_manager_t mtcp)
{ {
int ret = 0; int ret = 0;
if (mtcp->w_buffer) { if (mtcp->w_buffer) {

View File

@ -63,6 +63,7 @@
// off for production use // off for production use
// #define DBGCCP // ccp debug messages // #define DBGCCP // ccp debug messages
// #define PROBECCP // print all cwnd changes, similar to tcpprobe output // #define PROBECCP // print all cwnd changes, similar to tcpprobe output
#define CC_NAME 20
#endif #endif
#define LOCK_STREAM_QUEUE FALSE #define LOCK_STREAM_QUEUE FALSE
@ -190,7 +191,7 @@ struct mtcp_config
uint16_t onvm_dest; uint16_t onvm_dest;
#endif #endif
#if USE_CCP #if USE_CCP
char cc[1024]; char cc[CC_NAME];
#endif #endif
}; };
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/

View File

@ -1,88 +1,106 @@
#include "pacing.h" #include "pacing.h"
#include "clock.h" #include "clock.h"
/*----------------------------------------------------------------------------*/
#if RATE_LIMIT_ENABLED #if RATE_LIMIT_ENABLED
token_bucket *NewTokenBucket() { token_bucket *
token_bucket *bucket; NewTokenBucket()
bucket = malloc(sizeof(token_bucket)); {
if (bucket) { token_bucket *bucket;
fprintf(stderr, "created bucket!\n"); bucket = malloc(sizeof(token_bucket));
} if (bucket == NULL)
bucket->rate = 0; return NULL;
bucket->burst = 14480;
bucket->tokens = bucket->burst; bucket->rate = 0;
bucket->last_fill_t = now_usecs(); bucket->burst = 14480;
return bucket; bucket->tokens = bucket->burst;
bucket->last_fill_t = now_usecs();
return bucket;
} }
/*----------------------------------------------------------------------------*/
void _refill_bucket(token_bucket *bucket) { void
uint32_t elapsed = time_since_usecs(bucket->last_fill_t); _refill_bucket(token_bucket *bucket)
double new_tokens = (bucket->rate / 1000000.0) * elapsed; {
double prev_tokens = bucket->tokens; uint32_t elapsed = time_since_usecs(bucket->last_fill_t);
bucket->tokens = MIN(bucket->burst, bucket->tokens + new_tokens); double new_tokens = (bucket->rate / 1000000.0) * elapsed;
if (bucket->tokens > prev_tokens) { double prev_tokens = bucket->tokens;
bucket->last_fill_t = now_usecs(); bucket->tokens = MIN(bucket->burst, bucket->tokens + new_tokens);
} else { if (bucket->tokens > prev_tokens) {
//fprintf(stderr, "elapsed=%lu new=%f\n", time_since_usecs(bucket->last_fill_t), new_tokens); bucket->last_fill_t = now_usecs();
} } else {
//fprintf(stderr, "elapsed=%lu new=%f\n", time_since_usecs(bucket->last_fill_t), new_tokens);
}
} }
/*----------------------------------------------------------------------------*/
int
SufficientTokens(token_bucket *bucket, uint64_t new_bits)
{
double new_bytes = (new_bits / 8.0);
int SufficientTokens(token_bucket *bucket, uint64_t new_bits) { //fprintf(stderr, "checking for %ld tokens\n", new_bits);
double new_bytes = (new_bits / 8.0);
//fprintf(stderr, "checking for %ld tokens\n", new_bits); _refill_bucket(bucket);
_refill_bucket(bucket); if (bucket->tokens >= new_bytes) {
bucket->tokens -= new_bytes;
return 0;
}
if (bucket->tokens >= new_bytes) { return -1;
bucket->tokens -= new_bytes;
return 0;
}
return -1;
} }
/*----------------------------------------------------------------------------*/
void PrintBucket(token_bucket *bucket) { void
fprintf(stderr, "[rate=%.3f tokens=%f last=%u]\n", PrintBucket(token_bucket *bucket)
bucket->rate / 1000000.0, {
bucket->tokens, fprintf(stderr, "[rate=%.3f tokens=%f last=%u]\n",
bucket->last_fill_t); bucket->rate / 1000000.0,
bucket->tokens,
bucket->last_fill_t);
} }
#endif /*----------------------------------------------------------------------------*/
#endif /* !RATE_LIMIT_ENABLED */
#if PACING_ENABLED #if PACING_ENABLED
packet_pacer *NewPacketPacer() { /*----------------------------------------------------------------------------*/
packet_pacer *pacer; packet_pacer *
pacer = malloc(sizeof(packet_pacer)); NewPacketPacer()
pacer->rate_bps = 0; {
pacer->extra_packets = 1; packet_pacer *pacer;
pacer->next_send_time = 0; pacer = malloc(sizeof(packet_pacer));
return pacer; if (pacer == NULL)
return NULL;
pacer->rate_bps = 0;
pacer->extra_packets = 1;
pacer->next_send_time = 0;
return pacer;
} }
/*----------------------------------------------------------------------------*/
#define PACKET_SIZE 1500 #define PACKET_SIZE 1500
int CanSendNow(packet_pacer *pacer) { int
if (pacer->rate_bps == 0) { CanSendNow(packet_pacer *pacer)
return TRUE; {
} if (pacer->rate_bps == 0) {
return TRUE;
}
uint32_t now = now_usecs(); uint32_t now = now_usecs();
if (now >= pacer->next_send_time) { if (now >= pacer->next_send_time) {
pacer->next_send_time = now + (int)(PACKET_SIZE / (pacer->rate_bps / 8000000.0)); pacer->next_send_time = now + (int)(PACKET_SIZE / (pacer->rate_bps / 8000000.0));
pacer->extra_packets = 1; pacer->extra_packets = 1;
//fprintf(stderr, "now=%u, next=%u\n", now, pacer->next_send_time); //fprintf(stderr, "now=%u, next=%u\n", now, pacer->next_send_time);
return TRUE; return TRUE;
} else if (pacer->extra_packets) { } else if (pacer->extra_packets) {
pacer->extra_packets--; pacer->extra_packets--;
return TRUE; return TRUE;
} else { } else {
return FALSE; return FALSE;
} }
} }
/*----------------------------------------------------------------------------*/
void PrintPacer(packet_pacer *pacer) { void
//fprintf(stderr, "[rate=%u next_time=%u]\n", pacer->rate_bps, pacer->next_send_time); PrintPacer(packet_pacer *pacer)
{
//fprintf(stderr, "[rate=%u next_time=%u]\n", pacer->rate_bps, pacer->next_send_time);
} }
/*----------------------------------------------------------------------------*/
#endif #endif /* !PACING_ENABLED */

View File

@ -386,7 +386,8 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts,
if (cur_stream->rcvvar->dup_acks + 1 > cur_stream->rcvvar->dup_acks) { if (cur_stream->rcvvar->dup_acks + 1 > cur_stream->rcvvar->dup_acks) {
cur_stream->rcvvar->dup_acks++; cur_stream->rcvvar->dup_acks++;
#if USE_CCP #if USE_CCP
ccp_record_event(mtcp, cur_stream, EVENT_DUPACK, (cur_stream->snd_nxt - ack_seq)); ccp_record_event(mtcp, cur_stream, EVENT_DUPACK,
(cur_stream->snd_nxt - ack_seq));
#endif #endif
} }
dup = TRUE; dup = TRUE;
@ -395,15 +396,20 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts,
} }
if (!dup) { if (!dup) {
if (cur_stream->rcvvar->dup_acks >= 3) { if (cur_stream->rcvvar->dup_acks >= 3) {
TRACE_DBG("passed dup_acks, ack=%u, snd_nxt=%u, last_ack=%u len=%u wl2=%u peer_wnd=%u right=%u\n", ack_seq-sndvar->iss, cur_stream->snd_nxt-sndvar->iss, cur_stream->rcvvar->last_ack_seq-sndvar->iss, payloadlen, cur_stream->rcvvar->snd_wl2-sndvar->iss, sndvar->peer_wnd / sndvar->mss, right_wnd_edge - sndvar->iss); TRACE_DBG("passed dup_acks, ack=%u, snd_nxt=%u, last_ack=%u len=%u wl2=%u peer_wnd=%u right=%u\n",
ack_seq-sndvar->iss, cur_stream->snd_nxt-sndvar->iss, cur_stream->rcvvar->last_ack_seq-sndvar->iss,
payloadlen, cur_stream->rcvvar->snd_wl2-sndvar->iss, sndvar->peer_wnd / sndvar->mss,
right_wnd_edge - sndvar->iss);
} }
cur_stream->rcvvar->dup_acks = 0; cur_stream->rcvvar->dup_acks = 0;
cur_stream->rcvvar->last_ack_seq = ack_seq; cur_stream->rcvvar->last_ack_seq = ack_seq;
} }
if(cur_stream->wait_for_acks) { if(cur_stream->wait_for_acks) {
TRACE_DBG("got ack, but waiting to send... ack=%u, snd_next=%u cwnd=%u\n", ack_seq-sndvar->iss, cur_stream->snd_nxt-sndvar->iss, sndvar->cwnd / sndvar->mss); TRACE_DBG("got ack, but waiting to send... ack=%u, snd_next=%u cwnd=%u\n",
} ack_seq-sndvar->iss, cur_stream->snd_nxt-sndvar->iss,
sndvar->cwnd / sndvar->mss);
}
/* Fast retransmission */ /* Fast retransmission */
if (dup && cur_stream->rcvvar->dup_acks == 3) { if (dup && cur_stream->rcvvar->dup_acks == 3) {
@ -427,10 +433,6 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts,
"ack_seq: %u, snd_una: %u\n", "ack_seq: %u, snd_una: %u\n",
ack_seq, sndvar->snd_una); ack_seq, sndvar->snd_una);
} }
//cur_stream->snd_nxt = ack_seq;
//cur_stream->wait_for_acks = TRUE;
//cur_stream->seq_at_last_loss = ack_seq;
sndvar->missing_seq = ack_seq; sndvar->missing_seq = ack_seq;
} }
@ -471,7 +473,8 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts,
#if RECOVERY_AFTER_LOSS #if RECOVERY_AFTER_LOSS
/* updating snd_nxt (when recovered from loss) */ /* updating snd_nxt (when recovered from loss) */
if (TCP_SEQ_GT(ack_seq, cur_stream->snd_nxt) || (cur_stream->wait_for_acks && TCP_SEQ_GT(ack_seq, cur_stream->seq_at_last_loss) if (TCP_SEQ_GT(ack_seq, cur_stream->snd_nxt) ||
(cur_stream->wait_for_acks && TCP_SEQ_GT(ack_seq, cur_stream->seq_at_last_loss)
#if TCP_OPT_SACK_ENABLED #if TCP_OPT_SACK_ENABLED
&& cur_stream->rcvvar->sacked_pkts == 0 && cur_stream->rcvvar->sacked_pkts == 0
#endif #endif

View File

@ -496,7 +496,8 @@ FlushTCPSendingBuffer(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_
len = sndvar->sndbuf->len - (seq - sndvar->sndbuf->head_seq); len = sndvar->sndbuf->len - (seq - sndvar->sndbuf->head_seq);
// Without this, mm continually drops packets (not sure why, bursting?) -> mtcp sees lots of losses -> throughput dies // Without this, mm continually drops packets (not sure why, bursting?) -> mtcp sees lots of losses -> throughput dies
if(cur_stream->wait_for_acks && TCP_SEQ_GT(cur_stream->snd_nxt, cur_stream->rcvvar->last_ack_seq)) { if(cur_stream->wait_for_acks &&
TCP_SEQ_GT(cur_stream->snd_nxt, cur_stream->rcvvar->last_ack_seq)) {
goto out; goto out;
} }
@ -530,7 +531,7 @@ FlushTCPSendingBuffer(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_
#if TCP_OPT_SACK_ENABLED #if TCP_OPT_SACK_ENABLED
if (SeqIsSacked(cur_stream, seq)) { if (SeqIsSacked(cur_stream, seq)) {
//fprintf(stderr, "!! SKIPPING %u\n", seq - sndvar->iss); TRACE_DBG("!! SKIPPING %u\n", seq - sndvar->iss);
cur_stream->snd_nxt += len; cur_stream->snd_nxt += len;
continue; continue;
} }

View File

@ -373,10 +373,10 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type,
stream->bucket = NewTokenBucket(); stream->bucket = NewTokenBucket();
#endif #endif
#if PACING_ENABLED #if PACING_ENABLED
stream->pacer = NewPacketPacer(); stream->pacer = NewPacketPacer();
#endif #endif
#if USE_CCP #if USE_CCP
ccp_create(mtcp, stream); ccp_create(mtcp, stream);
#endif #endif
UNUSED(da); UNUSED(da);

View File

@ -92,91 +92,97 @@ ParseTCPTimestamp(tcp_stream *cur_stream,
} }
#if TCP_OPT_SACK_ENABLED #if TCP_OPT_SACK_ENABLED
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
int SeqIsSacked(tcp_stream *cur_stream, uint32_t seq) { int
uint8_t i; SeqIsSacked(tcp_stream *cur_stream, uint32_t seq)
uint32_t left, right; {
for (i=0; i < MAX_SACK_ENTRY; i++) { uint8_t i;
left = cur_stream->rcvvar->sack_table[i].left_edge; uint32_t left, right;
right = cur_stream->rcvvar->sack_table[i].right_edge; for (i = 0; i < MAX_SACK_ENTRY; i++) {
if (seq >= left && seq < right) { left = cur_stream->rcvvar->sack_table[i].left_edge;
//fprintf(stderr, "Found seq=%u in (%u,%u)\n", seq - cur_stream->sndvar->iss, left - cur_stream->sndvar->iss, right - cur_stream->sndvar->iss); right = cur_stream->rcvvar->sack_table[i].right_edge;
return TRUE; if (seq >= left && seq < right) {
} //fprintf(stderr, "Found seq=%u in (%u,%u)\n", seq - cur_stream->sndvar->iss, left - cur_stream->sndvar->iss, right - cur_stream->sndvar->iss);
} return TRUE;
return FALSE; }
}
return FALSE;
} }
/*----------------------------------------------------------------------------*/
void
_update_sack_table(tcp_stream *cur_stream, uint32_t left_edge, uint32_t right_edge)
{
uint8_t i, j;
uint32_t newly_sacked = 0;
long int ld, rd, lrd, rld;
for (i = 0; i < MAX_SACK_ENTRY; i++) {
ld = (long int) left_edge - cur_stream->rcvvar->sack_table[i].left_edge;
rd = (long int) right_edge - cur_stream->rcvvar->sack_table[i].right_edge;
// if block already in table, don't need to do anything
if (ld == 0 && rd == 0) {
return;
}
void _update_sack_table(tcp_stream *cur_stream, uint32_t left_edge, uint32_t right_edge) { lrd = (long int) left_edge - cur_stream->rcvvar->sack_table[i].right_edge;
uint8_t i, j; rld = (long int) right_edge - cur_stream->rcvvar->sack_table[i].left_edge;
uint32_t newly_sacked = 0;
long int ld, rd, lrd, rld;
for (i=0; i < MAX_SACK_ENTRY; i++) {
ld = (long int) left_edge - cur_stream->rcvvar->sack_table[i].left_edge;
rd = (long int) right_edge - cur_stream->rcvvar->sack_table[i].right_edge;
// if block already in table, don't need to do anything
if (ld == 0 && rd == 0) {
return;
}
lrd = (long int) left_edge - cur_stream->rcvvar->sack_table[i].right_edge; // if block does not overlap i at all, skip
rld = (long int) right_edge - cur_stream->rcvvar->sack_table[i].left_edge; if (lrd > 0 || rld < 0) {
continue;
}
// if block does not overlap i at all, skip // left_edge is further left than i.left_edge
if (lrd > 0 || rld < 0) { if (ld < 0) {
continue; newly_sacked += (-ld);
} // expand i to account for this extra space, and merge with any
// blocks whose right_edge = i.left (i.e. blocks are touching)
cur_stream->rcvvar->sack_table[i].left_edge = left_edge;
for (j=0; j < MAX_SACK_ENTRY; j++) {
if (cur_stream->rcvvar->sack_table[j].right_edge == left_edge) {
cur_stream->rcvvar->sack_table[i].left_edge = cur_stream->rcvvar->sack_table[j].right_edge;
cur_stream->rcvvar->sack_table[j].left_edge = 0;
cur_stream->rcvvar->sack_table[j].right_edge = 0;
break;
}
}
}
// right edge is further right than i.right_edge
if (rd > 0) {
newly_sacked += rd;
// expand i to account for this extra space, and merge with any
// blocks whose left_edge = i.right (i.e. blocks are touching)
cur_stream->rcvvar->sack_table[i].right_edge = right_edge;
for (j=0; j < MAX_SACK_ENTRY; j++) {
if (cur_stream->rcvvar->sack_table[j].left_edge == right_edge) {
cur_stream->rcvvar->sack_table[i].right_edge = cur_stream->rcvvar->sack_table[j].left_edge;
cur_stream->rcvvar->sack_table[j].left_edge = 0;
cur_stream->rcvvar->sack_table[j].right_edge = 0;
break;
}
}
}
}
if (newly_sacked == 0) {
cur_stream->rcvvar->sack_table
[cur_stream->rcvvar->sacks].left_edge = left_edge;
cur_stream->rcvvar->sack_table
[cur_stream->rcvvar->sacks].right_edge = right_edge;
cur_stream->rcvvar->sacks++;
newly_sacked = (right_edge - left_edge);
}
// left_edge is further left than i.left_edge //fprintf(stderr, "SACK (%u,%u)->%u/%u\n", left_edge, right_edge, newly_sacked, newly_sacked / 1448);
if (ld < 0) { cur_stream->rcvvar->sacked_pkts += (newly_sacked / cur_stream->sndvar->mss);
newly_sacked += (-ld);
// expand i to account for this extra space, and merge with any
// blocks whose right_edge = i.left (i.e. blocks are touching)
cur_stream->rcvvar->sack_table[i].left_edge = left_edge;
for (j=0; j < MAX_SACK_ENTRY; j++) {
if (cur_stream->rcvvar->sack_table[j].right_edge == left_edge) {
cur_stream->rcvvar->sack_table[i].left_edge = cur_stream->rcvvar->sack_table[j].right_edge;
cur_stream->rcvvar->sack_table[j].left_edge = 0;
cur_stream->rcvvar->sack_table[j].right_edge = 0;
break;
}
}
}
// right edge is further right than i.right_edge
if (rd > 0) {
newly_sacked += rd;
// expand i to account for this extra space, and merge with any
// blocks whose left_edge = i.right (i.e. blocks are touching)
cur_stream->rcvvar->sack_table[i].right_edge = right_edge;
for (j=0; j < MAX_SACK_ENTRY; j++) {
if (cur_stream->rcvvar->sack_table[j].left_edge == right_edge) {
cur_stream->rcvvar->sack_table[i].right_edge = cur_stream->rcvvar->sack_table[j].left_edge;
cur_stream->rcvvar->sack_table[j].left_edge = 0;
cur_stream->rcvvar->sack_table[j].right_edge = 0;
break;
}
}
}
}
if (newly_sacked == 0) {
cur_stream->rcvvar->sack_table
[cur_stream->rcvvar->sacks].left_edge = left_edge;
cur_stream->rcvvar->sack_table
[cur_stream->rcvvar->sacks].right_edge = right_edge;
cur_stream->rcvvar->sacks++;
newly_sacked = (right_edge - left_edge);
}
//fprintf(stderr, "SACK (%u,%u)->%u/%u\n", left_edge, right_edge, newly_sacked, newly_sacked / 1448); return;
cur_stream->rcvvar->sacked_pkts += (newly_sacked / cur_stream->sndvar->mss);
return;
} }
/*----------------------------------------------------------------------------*/
int GenerateSACKOption(tcp_stream *cur_stream, uint8_t *tcpopt) { int
// TODO GenerateSACKOption(tcp_stream *cur_stream, uint8_t *tcpopt)
{
// TODO
return 0; return 0;
} }
/*----------------------------------------------------------------------------*/
void void
ParseSACKOption(tcp_stream *cur_stream, ParseSACKOption(tcp_stream *cur_stream,
uint32_t ack_seq, uint8_t *tcpopt, int len) uint32_t ack_seq, uint8_t *tcpopt, int len)