aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/netio
diff options
context:
space:
mode:
authorTilman Keskinoz <arved@FreeBSD.org>2005-12-03 21:30:21 +0000
committerTilman Keskinoz <arved@FreeBSD.org>2005-12-03 21:30:21 +0000
commite4c6f4a207b6affe16322ec99a356b5c44be4fb4 (patch)
tree2985280b3f8aa587ce9ad5b285a8ae00c902bd5b /benchmarks/netio
parentb7e91940cc124f501b762bc08eac4ea292284f4b (diff)
downloadports-e4c6f4a207b6affe16322ec99a356b5c44be4fb4.tar.gz
ports-e4c6f4a207b6affe16322ec99a356b5c44be4fb4.zip
Notes
Diffstat (limited to 'benchmarks/netio')
-rw-r--r--benchmarks/netio/Makefile17
-rw-r--r--benchmarks/netio/files/patch-Makefile27
-rw-r--r--benchmarks/netio/files/patch-netio.c180
3 files changed, 222 insertions, 2 deletions
diff --git a/benchmarks/netio/Makefile b/benchmarks/netio/Makefile
index 572e7deb043a..4e3215bbd969 100644
--- a/benchmarks/netio/Makefile
+++ b/benchmarks/netio/Makefile
@@ -6,7 +6,8 @@
PORTNAME= netio
PORTVERSION= 1.14
-CATEGORIES= benchmarks net
+PORTREVISION= 1
+CATEGORIES= benchmarks net ipv6
MASTER_SITES= http://www.netfuse.de/techarea/netio/
DISTNAME= netio114
@@ -17,13 +18,25 @@ WRKSRC= ${WRKDIR}
USE_ZIP= yes
USE_REINPLACE= yes
USE_GMAKE= yes
-ALL_TARGET= unix
PLIST_FILES= bin/netio
+.if defined(WITH_IPV6)
+PLIST_FILES+= bin/netio6
+.endif
+
post-patch:
${REINPLACE_CMD} -e "s,-lsocket,," ${WRKSRC}/Makefile
+do-build:
+ cd ${WRKSRC} && ${GMAKE} unix
+.if defined(WITH_IPV6)
+ cd ${WRKSRC} && ${GMAKE} unix6
+.endif
+
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/netio ${PREFIX}/bin
+.if defined(WITH_IPV6)
+ ${INSTALL_PROGRAM} ${WRKSRC}/netio6 ${PREFIX}/bin
+.endif
.include <bsd.port.mk>
diff --git a/benchmarks/netio/files/patch-Makefile b/benchmarks/netio/files/patch-Makefile
new file mode 100644
index 000000000000..0527087fff19
--- /dev/null
+++ b/benchmarks/netio/files/patch-Makefile
@@ -0,0 +1,27 @@
+--- Makefile.orig Thu Apr 19 14:21:19 2001
++++ Makefile Sat Dec 3 15:19:39 2005
+@@ -57,9 +57,15 @@
+ unix:
+ $(MAKE) all CC="gcc" O=.o X= \
+ CFLAGS="-DUNIX -O" LFLAGS="-s" LIBS="-lsocket" OUT=-o
++unix6:
++ $(MAKE) all CC="gcc" O=.6o X=6 \
++ CFLAGS="-DUNIX -O -DUSE_IPV6" LFLAGS="-lsocket" LIBS="" OUT=-o
+ unix-debug:
+ $(MAKE) all CC="gcc -g" O=.o X= \
+ CFLAGS="-DUNIX" LFLAGS="" LIBS="-lsocket" OUT=-o
++unix6-debug:
++ $(MAKE) all CC="gcc -g" O=.6o X=6 \
++ CFLAGS="-DUNIX -DUSE_IPV6" LFLAGS="-lsocket" LIBS="" OUT=-o
+ watt32:
+ $(MAKE) all CC="gcc -g -O2" O=.o X=.exe OUT=-o \
+ CFLAGS="-DWATT32 -I../../inc" LIBS="../../lib/libwatt.a"
+@@ -73,7 +79,7 @@
+
+ .SUFFIXES: .c $O
+ .c$O:
+- $(CC) $(CFLAGS) $(INC) -c $*.c
++ $(CC) $(OUT) $@ $(CFLAGS) $(INC) -c $*.c
+
+ netio$O: netio.c netbios.h getopt.h
+ netbios$O: netbios.c netbios.h
diff --git a/benchmarks/netio/files/patch-netio.c b/benchmarks/netio/files/patch-netio.c
new file mode 100644
index 000000000000..41cc0a95ec2f
--- /dev/null
+++ b/benchmarks/netio/files/patch-netio.c
@@ -0,0 +1,180 @@
+--- netio.c.orig Thu Apr 19 14:21:02 2001
++++ netio.c Sat Dec 3 16:14:21 2005
+@@ -477,14 +477,22 @@
+
+ /* TCP/IP code */
+
+-int nPort = 0x494F; /* "IO" */
++int nPort = 0x494F; /* "IO" */
++#ifdef USE_IPV6
++struct in6_addr addr_server;
++#else
+ struct in_addr addr_server;
++#endif
+
+ void TcpIpServer(void *arg)
+ {
+ char *cBuffer;
+- int bQuit = 0;
+- struct sockaddr_in sa_server, sa_client;
++ int bQuit = 0;
++#ifdef USE_IPV6
++ struct sockaddr_in6 sa_server, sa_client;
++#else
++ struct sockaddr_in sa_server, sa_client;
++#endif
+ int server, client, length;
+ struct timeval tv;
+ fd_set fds;
+@@ -495,17 +503,27 @@
+ perror("malloc()");
+ return;
+ }
+-
+- if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0)
++
++#ifdef USE_IPV6
++ if ((server = socket(PF_INET6, SOCK_STREAM, 0)) < 0)
++#else
++ if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0)
++#endif
+ {
+ psock_errno("socket()");
+ free(cBuffer);
+ return;
+ }
+-
+- sa_server.sin_family = AF_INET;
++
++#ifdef USE_IPV6
++ sa_server.sin6_family = AF_INET6;
++ sa_server.sin6_port = htons(nPort);
++ sa_server.sin6_addr = in6addr_any;
++#else
++ sa_server.sin_family = AF_INET;
+ sa_server.sin_port = htons(nPort);
+ sa_server.sin_addr.s_addr = INADDR_ANY;
++#endif
+
+ if (bind(server, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0)
+ {
+@@ -524,8 +542,12 @@
+ }
+
+ for (;;)
+- {
++ {
++#ifdef USE_IPV6
++ printf("TCP/IP server Listening (IPv6).\n");
++#else
+ printf("TCP/IP server Listening.\n");
++#endif
+
+ FD_ZERO(&fds);
+ FD_SET(server, &fds);
+@@ -575,8 +597,12 @@
+ TIMER nTimer;
+ long nTime;
+ long nData;
+- int i;
+- struct sockaddr_in sa_server;
++#ifdef USE_IPV6
++ struct sockaddr_in6 sa_client;
++#else
++ struct sockaddr_in sa_client;
++#endif
++ int i;
+ int server;
+ int rc;
+
+@@ -585,19 +611,28 @@
+ perror("malloc()");
+ return;
+ }
+-
+- sa_server.sin_family = AF_INET;
+- sa_server.sin_port = htons(nPort);
+- sa_server.sin_addr = addr_server;
+-
++
++#ifdef USE_IPV6
++ sa_client.sin6_family = AF_INET6;
++ sa_client.sin6_port = htons(nPort);
++ sa_client.sin6_addr = addr_server;
++#else
++ sa_client.sin_family = AF_INET;
++ sa_client.sin_port = htons(nPort);
++ sa_client.sin_addr = addr_server;
++#endif
++
++#ifdef USE_IPV6
++ if ((server = socket(PF_INET6, SOCK_STREAM, 0)) < 0)
++#else
+ if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0)
++#endif
+ {
+ psock_errno("socket()");
+ free(cBuffer);
+ return;
+- }
+-
+- if (connect(server, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0)
++ }
++ if (connect(server, (struct sockaddr *) &sa_client, sizeof(sa_client)) < 0)
+ {
+ psock_errno("connect()");
+ soclose(server);
+@@ -664,13 +699,17 @@
+ {
+ printf(
+ #ifndef USE_NETBIOS
++#ifdef USE_IPV6
++ "\nUsage: netio6 [-s] [-p <port>] [<server>]\n"
++#else
+ "\nUsage: netio [-s] [-p <port>] [<server>]\n"
++#endif
+ "\n\t-s\t\trun server side of benchmark (otherwise run client)"
+ "\n\t-p <port>\tuse this port instead of the default (%d)"
+ "\n\t<server>\tif the client side of the benchmark is running,"
+ "\n\t\t\ta server host name is required\n"
+-#else
+- "\nUsage: netio [-s] [-t | -n] [-p <port>] [-a <adapter>] [<server>]\n"
++#else
++ "\nUsage: netio [-s] [-t | -n] [-p <port>] [-a <adapter>] [<server>]\n"
+ "\n\t-s\trun server side of benchmark (otherwise run client)"
+ "\n\t-t\tuse TCP/IP protocol for benchmark"
+ "\n\t-p <port>\tuse this port for TCP/IP (default is %d)"
+@@ -766,14 +805,28 @@
+ if (optind == argc)
+ usage();
+
+- if (isdigit(*argv[optind]))
+- addr_server.s_addr = inet_addr(argv[optind]);
++ if (isdigit(*argv[optind])
++#ifdef USE_IPV6
++ || *argv[optind] == ':')
++ inet_pton(AF_INET6, argv[optind], &addr_server);
++#else
++ )
++ addr_server.s_addr = inet_addr(argv[optind]);
++#endif
+ else
+- {
+- if ((host = gethostbyname(argv[optind])) == NULL)
++ {
++#ifdef USE_IPV6
++ if ((host = gethostbyname2(argv[optind], AF_INET6)) == NULL)
++#else
++ if ((host = gethostbyname(argv[optind])) == NULL)
++#endif
+ return psock_errno("gethostbyname()"), 1;
+
+- addr_server = * (struct in_addr *) (host->h_addr);
++#ifdef USE_IPV6
++ addr_server = * (struct in6_addr *) (host->h_addr);
++#else
++ addr_server = * (struct in_addr *) (host->h_addr);
++#endif
+ }
+ }
+ }