diff options
author | Mathieu Arnold <mat@FreeBSD.org> | 2016-06-20 16:23:28 +0000 |
---|---|---|
committer | Mathieu Arnold <mat@FreeBSD.org> | 2016-06-20 16:23:28 +0000 |
commit | 7ae7b018ccf7760013f368fcb83aad9ecd8982a8 (patch) | |
tree | e83ee6693050a76e305a95a376451aa583df151e /benchmarks | |
parent | a35ba13770957a577275c3575d979457605f2aff (diff) | |
download | ports-7ae7b018ccf7760013f368fcb83aad9ecd8982a8.tar.gz ports-7ae7b018ccf7760013f368fcb83aad9ecd8982a8.zip |
Notes
Diffstat (limited to 'benchmarks')
-rw-r--r-- | benchmarks/himenobench/Makefile | 3 | ||||
-rw-r--r-- | benchmarks/himenobench/files/patch-himenobmtxp__l.f | 18 | ||||
-rw-r--r-- | benchmarks/himenobench/files/patch-himenobmtxp__m.f | 18 | ||||
-rw-r--r-- | benchmarks/himenobench/files/patch-himenobmtxp__s.f | 18 | ||||
-rw-r--r-- | benchmarks/himenobench/files/patch-himenobmtxp__xl.f | 18 | ||||
-rw-r--r-- | benchmarks/himenobench/files/patch-himenobmtxps.c | 32 | ||||
-rw-r--r-- | benchmarks/netio/Makefile | 4 | ||||
-rw-r--r-- | benchmarks/netio/files/patch-Makefile | 22 | ||||
-rw-r--r-- | benchmarks/netio/files/patch-netio.c | 440 |
9 files changed, 287 insertions, 286 deletions
diff --git a/benchmarks/himenobench/Makefile b/benchmarks/himenobench/Makefile index fbe39defe14f..a639be3fe742 100644 --- a/benchmarks/himenobench/Makefile +++ b/benchmarks/himenobench/Makefile @@ -19,7 +19,8 @@ LICENSE= LGPL20 # (or later) EXTRACT_DEPENDS= lha:archivers/lha -USES= fortran zip +USES= dos2unix fortran zip +DOS2UNIX_GLOB= *.c *.f NO_WRKSUBDIR= yes diff --git a/benchmarks/himenobench/files/patch-himenobmtxp__l.f b/benchmarks/himenobench/files/patch-himenobmtxp__l.f index 6605b98cc49b..855e8bff2f52 100644 --- a/benchmarks/himenobench/files/patch-himenobmtxp__l.f +++ b/benchmarks/himenobench/files/patch-himenobmtxp__l.f @@ -1,10 +1,10 @@ ---- himenobmtxp_l.f.orig 2002-01-07 04:54:46 UTC +--- himenobmtxp_l.f.orig 2016-06-20 13:01:22 UTC +++ himenobmtxp_l.f -@@ -39,7 +39,6 @@ C -------------------
- C "use portlib" statement on the next line is for Visual fortran
- C to use UNIX libraries. Please remove it if your system is UNIX.
- C -------------------
-- use portlib
- IMPLICIT REAL*4(a-h,o-z)
- C
- PARAMETER (mimax=513,mjmax=257,mkmax=257)
+@@ -39,7 +39,6 @@ C ------------------- + C "use portlib" statement on the next line is for Visual fortran + C to use UNIX libraries. Please remove it if your system is UNIX. + C ------------------- +- use portlib + IMPLICIT REAL*4(a-h,o-z) + C + PARAMETER (mimax=513,mjmax=257,mkmax=257) diff --git a/benchmarks/himenobench/files/patch-himenobmtxp__m.f b/benchmarks/himenobench/files/patch-himenobmtxp__m.f index 7aaf759c4d14..97ddd3f1a023 100644 --- a/benchmarks/himenobench/files/patch-himenobmtxp__m.f +++ b/benchmarks/himenobench/files/patch-himenobmtxp__m.f @@ -1,10 +1,10 @@ ---- himenobmtxp_m.f.orig 2002-01-07 04:54:48 UTC +--- himenobmtxp_m.f.orig 2016-06-20 13:01:22 UTC +++ himenobmtxp_m.f -@@ -39,7 +39,6 @@ C -------------------
- C "use portlib" statement on the next line is for Visual fortran
- C to use UNIX libraries. Please remove it if your system is UNIX.
- C -------------------
-- use portlib
- IMPLICIT REAL*4(a-h,o-z)
- C
- C PARAMETER (mimax=513,mjmax=257,mkmax=257)
+@@ -39,7 +39,6 @@ C ------------------- + C "use portlib" statement on the next line is for Visual fortran + C to use UNIX libraries. Please remove it if your system is UNIX. + C ------------------- +- use portlib + IMPLICIT REAL*4(a-h,o-z) + C + C PARAMETER (mimax=513,mjmax=257,mkmax=257) diff --git a/benchmarks/himenobench/files/patch-himenobmtxp__s.f b/benchmarks/himenobench/files/patch-himenobmtxp__s.f index 60ffa1510c0b..cea8df8726fa 100644 --- a/benchmarks/himenobench/files/patch-himenobmtxp__s.f +++ b/benchmarks/himenobench/files/patch-himenobmtxp__s.f @@ -1,10 +1,10 @@ ---- himenobmtxp_s.f.orig 2001-12-17 07:45:16 UTC +--- himenobmtxp_s.f.orig 2016-06-20 13:01:22 UTC +++ himenobmtxp_s.f -@@ -39,7 +39,6 @@ C -------------------
- C "use portlib" statement on the next line is for Visual fortran
- C to use UNIX libraries. Please remove it if your system is UNIX.
- C -------------------
-- use portlib
- IMPLICIT REAL*4(a-h,o-z)
- C
- C PARAMETER (mimax=513,mjmax=257,mkmax=257)
+@@ -39,7 +39,6 @@ C ------------------- + C "use portlib" statement on the next line is for Visual fortran + C to use UNIX libraries. Please remove it if your system is UNIX. + C ------------------- +- use portlib + IMPLICIT REAL*4(a-h,o-z) + C + C PARAMETER (mimax=513,mjmax=257,mkmax=257) diff --git a/benchmarks/himenobench/files/patch-himenobmtxp__xl.f b/benchmarks/himenobench/files/patch-himenobmtxp__xl.f index 3125952c1d5e..f71a582d45ec 100644 --- a/benchmarks/himenobench/files/patch-himenobmtxp__xl.f +++ b/benchmarks/himenobench/files/patch-himenobmtxp__xl.f @@ -1,10 +1,10 @@ ---- himenobmtxp_xl.f.orig 2002-01-07 04:54:42 UTC +--- himenobmtxp_xl.f.orig 2016-06-20 13:01:22 UTC +++ himenobmtxp_xl.f -@@ -39,7 +39,6 @@ C -------------------
- C "use portlib" statement on the next line is for Visual fortran
- C to use UNIX libraries. Please remove it if your system is UNIX.
- C -------------------
-- use portlib
- IMPLICIT REAL*4(a-h,o-z)
- C
- PARAMETER (mimax=1025,mjmax=513,mkmax=513)
+@@ -39,7 +39,6 @@ C ------------------- + C "use portlib" statement on the next line is for Visual fortran + C to use UNIX libraries. Please remove it if your system is UNIX. + C ------------------- +- use portlib + IMPLICIT REAL*4(a-h,o-z) + C + PARAMETER (mimax=1025,mjmax=513,mkmax=513) diff --git a/benchmarks/himenobench/files/patch-himenobmtxps.c b/benchmarks/himenobench/files/patch-himenobmtxps.c index 175cf050112d..b00ab89328ae 100644 --- a/benchmarks/himenobench/files/patch-himenobmtxps.c +++ b/benchmarks/himenobench/files/patch-himenobmtxps.c @@ -1,18 +1,18 @@ ---- himenobmtxps.c.orig 2002-02-21 00:27:48 UTC +--- himenobmtxps.c.orig 2016-06-20 13:01:22 UTC +++ himenobmtxps.c @@ -37,6 +37,7 @@ - ********************************************************************/
-
- #include <stdio.h>
-+#include <sys/time.h>
-
- #ifdef SSMALL
- #define MIMAX 33
-@@ -245,7 +246,6 @@ mflops(int nn,double cpu,double flop)
- double
- second()
- {
--#include <sys/time.h>
-
- struct timeval tm;
- double t ;
+ ********************************************************************/ + + #include <stdio.h> ++#include <sys/time.h> + + #ifdef SSMALL + #define MIMAX 33 +@@ -245,7 +246,6 @@ mflops(int nn,double cpu,double flop) + double + second() + { +-#include <sys/time.h> + + struct timeval tm; + double t ; diff --git a/benchmarks/netio/Makefile b/benchmarks/netio/Makefile index 9f31a8092a35..02848c9c6336 100644 --- a/benchmarks/netio/Makefile +++ b/benchmarks/netio/Makefile @@ -11,8 +11,8 @@ MAINTAINER= arved@FreeBSD.org COMMENT= Network benchmark WRKSRC= ${WRKDIR} -USES= gmake zip -PATCH_ARGS= -d ${PATCH_WRKSRC} -N -s -E ${PATCH_STRIP} -l +USES= dos2unix gmake zip +DOS2UNIX_FILES= Makefile netio.c PLIST_FILES= bin/netio CFLAGS+= -DUNIX -DSOCKLEN_T diff --git a/benchmarks/netio/files/patch-Makefile b/benchmarks/netio/files/patch-Makefile index 364e94f9146c..5341e76d056f 100644 --- a/benchmarks/netio/files/patch-Makefile +++ b/benchmarks/netio/files/patch-Makefile @@ -1,11 +1,11 @@ ---- Makefile.orig Sat Sep 2 13:27:40 2006 -+++ Makefile Sat Sep 2 13:29:30 2006 -@@ -96,7 +96,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
+--- Makefile.orig 2016-06-20 13:21:43 UTC ++++ Makefile +@@ -102,7 +102,7 @@ netio$X: netio$O getopt$O + + .SUFFIXES: .c $O + .c$O: +- $(CC) $(CFLAGS) $(INC) -c $*.c ++ $(CC) $(OUT) $@ $(CFLAGS) $(INC) -c $*.c + + netio$O: netio.c getopt.h + getopt$O: getopt.c getopt.h diff --git a/benchmarks/netio/files/patch-netio.c b/benchmarks/netio/files/patch-netio.c index 2648f1222dd1..bf3c2e703ee2 100644 --- a/benchmarks/netio/files/patch-netio.c +++ b/benchmarks/netio/files/patch-netio.c @@ -1,335 +1,335 @@ ---- netio.c.orig 2012-11-22 17:47:38.000000000 +0100 -+++ netio.c 2015-03-23 11:52:42.000000000 +0100 -@@ -136,6 +136,7 @@ - #include <ctype.h>
- #include <signal.h>
- #if defined(UNIX) || defined(DJGPP)
+--- netio.c.orig 2016-06-20 13:21:43 UTC ++++ netio.c +@@ -136,6 +136,7 @@ static char *rcsrev = "$Revision: 1.32 $ + #include <ctype.h> + #include <signal.h> + #if defined(UNIX) || defined(DJGPP) +#include <arpa/inet.h> - #include <sys/time.h>
- #include <unistd.h>
- #include <errno.h>
-@@ -546,7 +547,7 @@ -
- int recv_data(int socket, void *buffer, size_t size, int flags)
- {
-- size_t rc = recv(socket, buffer, size, flags);
+ #include <sys/time.h> + #include <unistd.h> + #include <errno.h> +@@ -546,7 +547,7 @@ int send_data(int socket, void *buffer, + + int recv_data(int socket, void *buffer, size_t size, int flags) + { +- size_t rc = recv(socket, buffer, size, flags); + ssize_t rc = recv(socket, buffer, size, flags); -
- if (rc < 0)
- {
-@@ -563,8 +564,13 @@ - const int sobufsize = 131072;
- int nPort = DEFAULTPORT;
- int nAuxPort = DEFAULTPORT + 1;
+ + if (rc < 0) + { +@@ -563,8 +564,13 @@ int recv_data(int socket, void *buffer, + const int sobufsize = 131072; + int nPort = DEFAULTPORT; + int nAuxPort = DEFAULTPORT + 1; +#ifdef USE_IPV6 +struct in6_addr addr_server; +struct in6_addr addr_local; +#else - struct in_addr addr_server;
- struct in_addr addr_local;
+ struct in_addr addr_server; + struct in_addr addr_local; +#endif -
- int udpsocket, udpd;
- unsigned long nUDPCount;
-@@ -577,7 +583,11 @@ - TIMER nTimer;
- long nTime;
- long long nData;
+ + int udpsocket, udpd; + unsigned long nUDPCount; +@@ -577,7 +583,11 @@ THREAD TCP_Server(void *arg) + TIMER nTimer; + long nTime; + long long nData; +#ifdef USE_IPV6 + struct sockaddr_in6 sa_server, sa_client; +#else - struct sockaddr_in sa_server, sa_client;
+ struct sockaddr_in sa_server, sa_client; +#endif - int server, client;
- socklen_type length;
- struct timeval tv;
-@@ -591,7 +601,11 @@ - return THREADRESULT;
- }
-
+ int server, client; + socklen_type length; + struct timeval tv; +@@ -591,7 +601,11 @@ THREAD TCP_Server(void *arg) + return THREADRESULT; + } + +#ifdef USE_IPV6 + if ((server = socket(PF_INET6, SOCK_STREAM, 0)) < 0) +#else - if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0)
+ if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0) +#endif - {
- psock_errno("socket()");
- free(cBuffer);
-@@ -601,9 +615,15 @@ - setsockopt(server, SOL_SOCKET, SO_RCVBUF, (char *) &sobufsize, sizeof(sobufsize));
- setsockopt(server, SOL_SOCKET, SO_SNDBUF, (char *) &sobufsize, sizeof(sobufsize));
-
+ { + psock_errno("socket()"); + free(cBuffer); +@@ -601,9 +615,15 @@ THREAD TCP_Server(void *arg) + setsockopt(server, SOL_SOCKET, SO_RCVBUF, (char *) &sobufsize, sizeof(sobufsize)); + setsockopt(server, SOL_SOCKET, SO_SNDBUF, (char *) &sobufsize, sizeof(sobufsize)); + +#ifdef USE_IPV6 + sa_server.sin6_family = AF_INET6; + sa_server.sin6_port = htons(nPort); + sa_server.sin6_addr = addr_local; +#else - sa_server.sin_family = AF_INET;
- sa_server.sin_port = htons(nPort);
- sa_server.sin_addr = addr_local;
+ sa_server.sin_family = AF_INET; + sa_server.sin_port = htons(nPort); + sa_server.sin_addr = addr_local; +#endif -
- if (bind(server, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0)
- {
-@@ -753,7 +773,11 @@ - long nTime;
- long long nData;
- int i;
+ + if (bind(server, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0) + { +@@ -753,7 +773,11 @@ void TCP_Bench(void *arg) + long nTime; + long long nData; + int i; +#ifdef USE_IPV6 + struct sockaddr_in6 sa_server, sa_client; +#else - struct sockaddr_in sa_server, sa_client;
+ struct sockaddr_in sa_server, sa_client; +#endif - int server;
- int rc;
- int nByte;
-@@ -764,7 +788,11 @@ - return;
- }
-
+ int server; + int rc; + int nByte; +@@ -764,7 +788,11 @@ void TCP_Bench(void *arg) + return; + } + +#ifdef USE_IPV6 + if ((server = socket(PF_INET6, SOCK_STREAM, 0)) < 0) +#else - if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0)
+ if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0) +#endif - {
- psock_errno("socket()");
- free(cBuffer);
-@@ -774,21 +802,33 @@ - setsockopt(server, SOL_SOCKET, SO_RCVBUF, (char *) &sobufsize, sizeof(sobufsize));
- setsockopt(server, SOL_SOCKET, SO_SNDBUF, (char *) &sobufsize, sizeof(sobufsize));
-
+ { + psock_errno("socket()"); + free(cBuffer); +@@ -774,21 +802,33 @@ void TCP_Bench(void *arg) + setsockopt(server, SOL_SOCKET, SO_RCVBUF, (char *) &sobufsize, sizeof(sobufsize)); + setsockopt(server, SOL_SOCKET, SO_SNDBUF, (char *) &sobufsize, sizeof(sobufsize)); + +#ifdef USE_IPV6 + sa_client.sin6_family = AF_INET6; + sa_client.sin6_port = htons(0); + sa_client.sin6_addr = addr_local; +#else - sa_client.sin_family = AF_INET;
- sa_client.sin_port = htons(0);
- sa_client.sin_addr = addr_local;
+ sa_client.sin_family = AF_INET; + sa_client.sin_port = htons(0); + sa_client.sin_addr = addr_local; +#endif -
- if (bind(server, (struct sockaddr *) &sa_client, sizeof(sa_client)) < 0)
- {
- psock_errno("bind()");
- soclose(server);
- free(cBuffer);
-- return THREADRESULT;
+ + if (bind(server, (struct sockaddr *) &sa_client, sizeof(sa_client)) < 0) + { + psock_errno("bind()"); + soclose(server); + free(cBuffer); +- return THREADRESULT; + return; - }
-
+ } + +#ifdef USE_IPV6 + sa_server.sin6_family = AF_INET6; + sa_server.sin6_port = htons(nPort); + sa_server.sin6_addr = addr_server; +#else - sa_server.sin_family = AF_INET;
- sa_server.sin_port = htons(nPort);
- sa_server.sin_addr = addr_server;
+ sa_server.sin_family = AF_INET; + sa_server.sin_port = htons(nPort); + sa_server.sin_addr = addr_server; +#endif -
- if (connect(server, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0)
- {
-@@ -911,7 +951,11 @@ - THREAD UDP_Receiver(void *arg)
- {
- char *cBuffer;
+ + if (connect(server, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0) + { +@@ -911,7 +951,11 @@ void TCP_Bench(void *arg) + THREAD UDP_Receiver(void *arg) + { + char *cBuffer; +#ifdef USE_IPV6 + struct sockaddr_in6 sa_server, sa_client; +#else - struct sockaddr_in sa_server, sa_client;
+ struct sockaddr_in sa_server, sa_client; +#endif - int rc;
- socklen_type nBytes;
-
-@@ -921,7 +965,11 @@ - return THREADRESULT;
- }
-
+ int rc; + socklen_type nBytes; + +@@ -921,7 +965,11 @@ THREAD UDP_Receiver(void *arg) + return THREADRESULT; + } + +#ifdef USE_IPV6 + if ((udpsocket = socket(PF_INET6, SOCK_DGRAM, 0)) < 0) +#else - if ((udpsocket = socket(PF_INET, SOCK_DGRAM, 0)) < 0)
+ if ((udpsocket = socket(PF_INET, SOCK_DGRAM, 0)) < 0) +#endif - {
- psock_errno("socket(DGRAM)");
- free(cBuffer);
-@@ -931,9 +979,15 @@ - setsockopt(udpsocket, SOL_SOCKET, SO_RCVBUF, (char *) &sobufsize, sizeof(sobufsize));
- setsockopt(udpsocket, SOL_SOCKET, SO_SNDBUF, (char *) &sobufsize, sizeof(sobufsize));
-
+ { + psock_errno("socket(DGRAM)"); + free(cBuffer); +@@ -931,9 +979,15 @@ THREAD UDP_Receiver(void *arg) + setsockopt(udpsocket, SOL_SOCKET, SO_RCVBUF, (char *) &sobufsize, sizeof(sobufsize)); + setsockopt(udpsocket, SOL_SOCKET, SO_SNDBUF, (char *) &sobufsize, sizeof(sobufsize)); + +#ifdef USE_IPV6 + sa_server.sin6_family = AF_INET6; + sa_server.sin6_port = htons(nAuxPort); + sa_server.sin6_addr = addr_local; +#else - sa_server.sin_family = AF_INET;
- sa_server.sin_port = htons(nAuxPort);
- sa_server.sin_addr = addr_local;
+ sa_server.sin_family = AF_INET; + sa_server.sin_port = htons(nAuxPort); + sa_server.sin_addr = addr_local; +#endif -
- if (bind(udpsocket, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0)
- {
-@@ -973,7 +1027,11 @@ - TIMER nTimer;
- long nTime;
- long long nData;
+ + if (bind(udpsocket, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0) + { +@@ -973,7 +1027,11 @@ THREAD UDP_Server(void *arg) + TIMER nTimer; + long nTime; + long long nData; +#ifdef USE_IPV6 + struct sockaddr_in6 sa_server, sa_client; +#else - struct sockaddr_in sa_server, sa_client;
+ struct sockaddr_in sa_server, sa_client; +#endif - int server, client;
- struct timeval tv;
- fd_set fds;
-@@ -986,7 +1044,11 @@ - return THREADRESULT;
- }
-
+ int server, client; + struct timeval tv; + fd_set fds; +@@ -986,7 +1044,11 @@ THREAD UDP_Server(void *arg) + return THREADRESULT; + } + +#ifdef USE_IPV6 + if ((server = socket(PF_INET6, SOCK_STREAM, 0)) < 0) +#else - if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0)
+ if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0) +#endif - {
- psock_errno("socket(STREAM)");
- free(cBuffer);
-@@ -996,9 +1058,15 @@ - setsockopt(server, SOL_SOCKET, SO_RCVBUF, (char *) &sobufsize, sizeof(sobufsize));
- setsockopt(server, SOL_SOCKET, SO_SNDBUF, (char *) &sobufsize, sizeof(sobufsize));
-
+ { + psock_errno("socket(STREAM)"); + free(cBuffer); +@@ -996,9 +1058,15 @@ THREAD UDP_Server(void *arg) + setsockopt(server, SOL_SOCKET, SO_RCVBUF, (char *) &sobufsize, sizeof(sobufsize)); + setsockopt(server, SOL_SOCKET, SO_SNDBUF, (char *) &sobufsize, sizeof(sobufsize)); + +#ifdef USE_IPV6 + sa_server.sin6_family = AF_INET6; + sa_server.sin6_port = htons(nAuxPort); + sa_server.sin6_addr = addr_local; +#else - sa_server.sin_family = AF_INET;
- sa_server.sin_port = htons(nAuxPort);
- sa_server.sin_addr = addr_local;
+ sa_server.sin_family = AF_INET; + sa_server.sin_port = htons(nAuxPort); + sa_server.sin_addr = addr_local; +#endif -
- if (bind(server, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0)
- {
-@@ -1044,7 +1112,11 @@ - printf("UDP connection established ... ");
- fflush(stdout);
-
+ + if (bind(server, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0) + { +@@ -1044,7 +1112,11 @@ THREAD UDP_Server(void *arg) + printf("UDP connection established ... "); + fflush(stdout); + +#ifdef USE_IPV6 + sa_client.sin6_port = htons(nAuxPort); +#else - sa_client.sin_port = htons(nAuxPort);
+ sa_client.sin_port = htons(nAuxPort); +#endif -
- for (;;)
- {
-@@ -1160,7 +1232,11 @@ - long nResult;
- long long nData;
- int i;
+ + for (;;) + { +@@ -1160,7 +1232,11 @@ void UDP_Bench(void *arg) + long nResult; + long long nData; + int i; +#ifdef USE_IPV6 + struct sockaddr_in6 sa_server, sa_client; +#else - struct sockaddr_in sa_server, sa_client;
+ struct sockaddr_in sa_server, sa_client; +#endif - int server;
- int rc, nByte;
-
-@@ -1170,7 +1246,11 @@ - return;
- }
-
+ int server; + int rc, nByte; + +@@ -1170,7 +1246,11 @@ void UDP_Bench(void *arg) + return; + } + +#ifdef USE_IPV6 + if ((server = socket(PF_INET6, SOCK_STREAM, 0)) < 0) +#else - if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0)
+ if ((server = socket(PF_INET, SOCK_STREAM, 0)) < 0) +#endif - {
- psock_errno("socket()");
- free(cBuffer);
-@@ -1180,21 +1260,33 @@ - setsockopt(server, SOL_SOCKET, SO_RCVBUF, (char *) &sobufsize, sizeof(sobufsize));
- setsockopt(server, SOL_SOCKET, SO_SNDBUF, (char *) &sobufsize, sizeof(sobufsize));
-
+ { + psock_errno("socket()"); + free(cBuffer); +@@ -1180,21 +1260,33 @@ void UDP_Bench(void *arg) + setsockopt(server, SOL_SOCKET, SO_RCVBUF, (char *) &sobufsize, sizeof(sobufsize)); + setsockopt(server, SOL_SOCKET, SO_SNDBUF, (char *) &sobufsize, sizeof(sobufsize)); + +#ifdef USE_IPV6 + sa_client.sin6_family = AF_INET6; + sa_client.sin6_port = htons(0); + sa_client.sin6_addr = addr_local; +#else - sa_client.sin_family = AF_INET;
- sa_client.sin_port = htons(0);
- sa_client.sin_addr = addr_local;
+ sa_client.sin_family = AF_INET; + sa_client.sin_port = htons(0); + sa_client.sin_addr = addr_local; +#endif -
- if (bind(server, (struct sockaddr *) &sa_client, sizeof(sa_client)) < 0)
- {
- psock_errno("bind(STREAM)");
- soclose(server);
- free(cBuffer);
-- return THREADRESULT;
+ + if (bind(server, (struct sockaddr *) &sa_client, sizeof(sa_client)) < 0) + { + psock_errno("bind(STREAM)"); + soclose(server); + free(cBuffer); +- return THREADRESULT; + return; - }
-
+ } + +#ifdef USE_IPV6 + sa_server.sin6_family = AF_INET6; + sa_server.sin6_port = htons(nAuxPort); + sa_server.sin6_addr = addr_server; +#else - sa_server.sin_family = AF_INET;
- sa_server.sin_port = htons(nAuxPort);
- sa_server.sin_addr = addr_server;
+ sa_server.sin_family = AF_INET; + sa_server.sin_port = htons(nAuxPort); + sa_server.sin_addr = addr_server; +#endif -
- if (connect(server, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0)
- {
-@@ -1425,17 +1517,29 @@ - return psock_errno("sock_init()"), 1;
-
- if (szLocal == 0)
+ + if (connect(server, (struct sockaddr *) &sa_server, sizeof(sa_server)) < 0) + { +@@ -1425,17 +1517,29 @@ int main(int argc, char **argv) + return psock_errno("sock_init()"), 1; + + if (szLocal == 0) +#ifdef USE_IPV6 + addr_local = in6addr_any; +#else - addr_local.s_addr = INADDR_ANY;
+ addr_local.s_addr = INADDR_ANY; +#endif - else
- {
- if (isdigit(*szLocal))
+ else + { + if (isdigit(*szLocal)) +#ifdef USE_IPV6 + inet_pton(AF_INET6, szLocal, &addr_local); +#else - addr_local.s_addr = inet_addr(szLocal);
+ addr_local.s_addr = inet_addr(szLocal); +#endif - else
- {
- if ((host = gethostbyname(szLocal)) == NULL)
- return psock_errno("gethostbyname()"), 1;
-
+ else + { + if ((host = gethostbyname(szLocal)) == NULL) + return psock_errno("gethostbyname()"), 1; + +#ifdef USE_IPV6 + addr_local = * (struct in6_addr *) (host->h_addr); +#else - addr_local = * (struct in_addr *) (host->h_addr);
+ addr_local = * (struct in_addr *) (host->h_addr); +#endif - }
- }
-
-@@ -1445,13 +1549,21 @@ - usage();
-
- if (isdigit(*argv[optind]))
+ } + } + +@@ -1445,13 +1549,21 @@ int main(int argc, char **argv) + usage(); + + if (isdigit(*argv[optind])) +#ifdef USE_IPV6 + inet_pton(AF_INET6, argv[optind], &addr_server); +#else - addr_server.s_addr = inet_addr(argv[optind]);
+ addr_server.s_addr = inet_addr(argv[optind]); +#endif - else
- {
- if ((host = gethostbyname(argv[optind])) == NULL)
- return psock_errno("gethostbyname()"), 1;
-
+ else + { + if ((host = gethostbyname(argv[optind])) == NULL) + return psock_errno("gethostbyname()"), 1; + +#ifdef USE_IPV6 + addr_server = * (struct in6_addr *) (host->h_addr); +#else - addr_server = * (struct in_addr *) (host->h_addr);
+ addr_server = * (struct in_addr *) (host->h_addr); +#endif - }
- }
- }
+ } + } + } |