diff --git a/tpws/BSDmakefile b/tpws/BSDmakefile index cc108cb..2d0c883 100644 --- a/tpws/BSDmakefile +++ b/tpws/BSDmakefile @@ -1,6 +1,6 @@ CC ?= cc CFLAGS += -std=gnu99 -s -O3 -Wno-logical-op-parentheses -LIBS = -lz +LIBS = -lz -lpthread SRC_FILES = *.c all: tpws diff --git a/tpws/Makefile b/tpws/Makefile index 3b9728a..51d5030 100644 --- a/tpws/Makefile +++ b/tpws/Makefile @@ -1,7 +1,7 @@ CC ?= gcc CFLAGS += -std=gnu99 -Wno-logical-op-parentheses -O3 CFLAGS_BSD = -Wno-address-of-packed-member -Wno-switch -LIBS = -lz +LIBS = -lz -lpthread SRC_FILES = *.c all: tpws diff --git a/tpws/params.h b/tpws/params.h index 1acdba2..8b608e8 100644 --- a/tpws/params.h +++ b/tpws/params.h @@ -6,6 +6,7 @@ #include #include #include +#include "tpws.h" #include "pools.h" #define HOSTLIST_AUTO_FAIL_THRESHOLD_DEFAULT 3 @@ -81,7 +82,7 @@ struct params_s #if defined(BSD) bool pf_enable; #endif -#ifdef __linux__ +#ifdef SPLICE_PRESENT bool nosplice; #endif }; diff --git a/tpws/tpws.c b/tpws/tpws.c index f4f644c..22f17da 100644 --- a/tpws/tpws.c +++ b/tpws/tpws.c @@ -144,7 +144,7 @@ static void exithelp(void) " --local-sndbuf=\n" " --remote-rcvbuf=\n" " --remote-sndbuf=\n" -#ifdef __linux__ +#ifdef SPLICE_PRESENT " --nosplice\t\t\t\t; do not use splice to transfer data between sockets\n" #endif " --skip-nodelay\t\t\t\t; do not set TCP_NODELAY option for outgoing connections (incompatible with split options)\n" @@ -336,7 +336,9 @@ void parse_params(int argc, char *argv[]) #elif defined(__linux__) { "mss",required_argument,0,0 },// optidx=53 { "mss-pf",required_argument,0,0 },// optidx=54 +#ifdef SPLICE_PRESENT { "nosplice",no_argument,0,0 },// optidx=55 +#endif #endif { "hostlist-auto-retrans-threshold",optional_argument,0,0}, // ignored. for nfqws command line compatibility { NULL,0,NULL,0 } @@ -777,9 +779,11 @@ void parse_params(int argc, char *argv[]) exit_clean(1); } break; +#ifdef SPLICE_PRESENT case 55: /* nosplice */ params.nosplice = true; break; +#endif #endif } }