diff -durN netperf-2.2alpha/makefile netperf-2.2alpha-sfile/makefile --- netperf-2.2alpha/makefile Tue Aug 15 16:57:40 2000 +++ netperf-2.2alpha-sfile/makefile Sun Feb 4 15:15:23 2001 @@ -15,8 +15,8 @@ # for the rest of the world, it is probably better to put the binaries # in /usr/local/netperf or /opt/netperf # -#NETPERF_HOME = /usr/local/netperf -NETPERF_HOME = /opt/netperf +NETPERF_HOME = /usr/local/netperf +#NETPERF_HOME = /opt/netperf # The compiler on your system might be somewhere else, and/or have # a different name. @@ -83,9 +83,16 @@ # of a DNS server. # -DHAVE_SENDFILE - Include the TCP_SENDFILE test to test the perf of # sending data using sendfile() instead of send(). +# -DLINUX_SENDF - Needed to have Linux sendfile working. Must +# have -DHAVE_SENDFILE set +# -DLINUX_HACK -- for the netserver on Linux to use MSG_TRUNC +# +# +# LOG_FILE=DEBUG_LOG_FILE="\"/tmp/netperf.debug\"" -CFLAGS = -Ae -O -D$(LOG_FILE) -DUSE_PSTAT -DHAVE_SENDFILE +#CFLAGS = -Ae -O -D$(LOG_FILE) -DUSE_PSTAT -DHAVE_SENDFILE +CFLAGS = -DHAVE_SENDFILE -DLINUX_SENDF -DLINUX_HACK # Some platforms, and some options, require additional libraries. # you can add to the "LIBS =" line to accomplish this. if you find @@ -156,10 +163,10 @@ all: netperf netserver netperf: $(NETPERF_OBJS) - $(CC) -o $@ $(NETPERF_OBJS) $(LIBS) + $(CC) -o $@ $(NETPERF_OBJS) $(LIBS) $(SCFLAGS) netserver: $(NETSERVER_OBJS) - $(CC) -o $@ $(NETSERVER_OBJS) $(LIBS) + $(CC) -o $@ $(NETSERVER_OBJS) $(LIBS) $(RCFLAGS) netperf.o: netperf.c netsh.h makefile diff -durN netperf-2.2alpha/nettest_bsd.c netperf-2.2alpha-sfile/nettest_bsd.c --- netperf-2.2alpha/nettest_bsd.c Tue Aug 15 16:57:40 2000 +++ netperf-2.2alpha-sfile/nettest_bsd.c Sun Feb 4 14:49:14 2001 @@ -48,7 +48,9 @@ #else /* NOSTDLIBH */ #include #endif /* NOSTDLIBH */ - +#ifdef LINUX_SENDF +#include +#endif #ifndef WIN32 #include #include @@ -1731,6 +1733,7 @@ gettimeofday(&time_one,NULL); #endif /* HISTOGRAM */ +#ifndef LINUX_SENDF /* you can look at netlib.h for a description of the fields we are passing to sendfile(). 08/2000 */ if ((len=sendfile(send_socket, @@ -1739,6 +1742,25 @@ send_ring->length, send_ring->hdtrl, send_ring->flags)) != send_size) { +#else +#ifndef TCP_CORK +#define TCP_CORK 3 +#endif + { + struct protoent *p; + int on = 1; + p = getprotobyname("tcp"); + if( p && setsockopt(send_socket, p->p_proto, TCP_CORK, &on, sizeof(on)) < 0) { + perror("setsockopt: TCP_CORK"); + exit(1); + } + } + + if ((len=sendfile(send_socket, + send_ring->fildes, + (off_t *)&send_ring->offset, + send_ring->length)) != send_size) { +#endif /* the test was interrupted, must be the end of test. the send_tcp_stream code has some WIN32 ifdefs that we do not need here. */ @@ -2382,7 +2404,11 @@ bytes_received = 0; receive_calls = 0; +#ifdef LINUX_HACK + while ((len = recv(s_data, recv_ring->buffer_ptr, recv_size, MSG_TRUNC)) != 0) { +#else while ((len = recv(s_data, recv_ring->buffer_ptr, recv_size, 0)) != 0) { +#endif #ifdef WIN32 if (len == SOCKET_ERROR ){ netperf_response.content.serv_errno = WSAGetLastError();