FreeBSD Bugzilla – Attachment 86339 Details for
Bug 122755
Update port: benchmarks/netpipe to 3.7.1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 24.87 KB, created by
tkato432
on 2008-04-14 19:10:02 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
tkato432
Created:
2008-04-14 19:10:02 UTC
Size:
24.87 KB
patch
obsolete
>diff -urN /usr/ports/benchmarks/netpipe/Makefile benchmarks/netpipe/Makefile >--- /usr/ports/benchmarks/netpipe/Makefile 2008-04-11 00:25:57.000000000 +0900 >+++ benchmarks/netpipe/Makefile 2008-04-13 03:27:53.000000000 +0900 >@@ -5,37 +5,35 @@ > # $FreeBSD: ports/benchmarks/netpipe/Makefile,v 1.15 2008/04/10 08:55:49 jkoshy Exp $ > > PORTNAME= NetPIPE >-PORTVERSION= 3.6.2 >+PORTVERSION= 3.7.1 > CATEGORIES= benchmarks net >-MASTER_SITES= http://www.scl.ameslab.gov/Projects/Netpipe/code/ \ >- ${MASTER_SITE_LOCAL} >-MASTER_SITE_SUBDIR= jkoshy >-DISTNAME= ${PORTNAME}_${PORTVERSION} >+MASTER_SITES= http://www.scl.ameslab.gov/Projects/Netpipe/code/ > > MAINTAINER= ports@FreeBSD.org > COMMENT= A self-scaling network benchmark > >-WRKSRC= ${WRKDIR}/${PORTNAME}_${PORTVERSION} >-MAKEFILE= makefile >- > # The default port builds and installs only the TCP version of > # netpipe(1). The sources support many other variants. > >-ALL_TARGET= tcp tcp6 >-.if !defined(NOPORTDOCS) > MAN1= netpipe.1 >-MANCOMPRESSED= no >-DOCS= README netpipe_paper.ps >-.endif >+PORTDOCS= README netpipe_paper.ps >+PLIST_FILES= bin/NPtcp bin/NPtcp6 >+ >+DOCSDIR= ${PREFIX}/share/doc/${PORTNAME:L} >+ >+do-build: >+ cd ${WRKSRC} \ >+ && ${CC} ${CFLAGS} src/netpipe.c src/tcp.c -DTCP -o NPtcp \ >+ && ${CC} ${CFLAGS} src/netpipe.c src/tcp6.c -DTCP6 -o NPtcp6 > > do-install: > ${INSTALL_PROGRAM} ${WRKSRC}/NPtcp ${PREFIX}/bin/NPtcp > ${INSTALL_PROGRAM} ${WRKSRC}/NPtcp6 ${PREFIX}/bin/NPtcp6 >+ ${INSTALL_MAN} ${WRKSRC}/dox/netpipe.1 ${MANPREFIX}/man/man1 > .if !defined(NOPORTDOCS) >- ${MKDIR} ${PREFIX}/share/doc/netpipe >- ${INSTALL_MAN} ${WRKSRC}/dox/netpipe.1 ${PREFIX}/man/man1 >-.for doc in ${DOCS} >- ${INSTALL_DATA} ${WRKSRC}/dox/${doc} ${PREFIX}/share/doc/netpipe/${doc} >+.for doc in ${PORTDOCS} >+ @${MKDIR} ${DOCSDIR} >+ ${INSTALL_DATA} ${WRKSRC}/dox/${doc} ${DOCSDIR} > .endfor > .endif > >diff -urN /usr/ports/benchmarks/netpipe/distinfo benchmarks/netpipe/distinfo >--- /usr/ports/benchmarks/netpipe/distinfo 2006-02-14 00:03:11.000000000 +0900 >+++ benchmarks/netpipe/distinfo 2008-04-13 03:20:39.000000000 +0900 >@@ -1,3 +1,3 @@ >-MD5 (NetPIPE_3.6.2.tar.gz) = 62570140a3617eca4b15b3255d3edbe6 >-SHA256 (NetPIPE_3.6.2.tar.gz) = 2301b6fa0bd468f6e6fb036617679626795f599ea504ae282ba075ac26b66da1 >-SIZE (NetPIPE_3.6.2.tar.gz) = 369585 >+MD5 (NetPIPE-3.7.1.tar.gz) = cc458a9154f6b8c6da9fae16627beec4 >+SHA256 (NetPIPE-3.7.1.tar.gz) = b088cd917746e37bbaf86cc34fcc84cd2cbaf8060e90c2f3deeddd47f96b1a1a >+SIZE (NetPIPE-3.7.1.tar.gz) = 385521 >diff -urN /usr/ports/benchmarks/netpipe/files/patch-doc-README benchmarks/netpipe/files/patch-doc-README >--- /usr/ports/benchmarks/netpipe/files/patch-doc-README 2006-02-14 00:03:12.000000000 +0900 >+++ benchmarks/netpipe/files/patch-doc-README 1970-01-01 09:00:00.000000000 +0900 >@@ -1,49 +0,0 @@ >-Index: dox/README >-=================================================================== >-RCS file: /cvs/gnn/Personal/Code/Networking/NetPIPE/dox/README,v >-retrieving revision 1.1 >-retrieving revision 1.3 >-diff -u -r1.1 -r1.3 >---- dox/README 9 Sep 2004 08:29:35 -0000 1.1 >-+++ dox/README 27 Sep 2004 11:26:17 -0000 1.3 >-@@ -85,6 +85,7 @@ >- make shmem (1-sided library for Cray and SGI systems) >- >- make tcp >-+ make tcp6 (for IPv6 enabled systems) >- make gm (for Myrinet cards, you will need to set some paths) >- make shmem (1-sided library for Cray and SGI systems) >- make gpshmem (SHMEM interface for other machines) >-@@ -145,7 +146,10 @@ >- -2: Bi-directional communications. Transmit in both directions >- simultaneously. >- >-- TCP >-+ -P: Set the port number used by TCP to something other than >-+ default. >-+ >-+ TCP >- --- >- >- Compile NetPIPE using 'make tcp' >-@@ -157,6 +161,20 @@ >- >- local_host> nplaunch NPtcp -h remote_host [options] >- >-+ TCP6 >-+ ---- >-+ >-+ Compile NetPIPE using 'make tcp6' >-+ >-+ remote_host> NPtcp6 [options] >-+ local_host> NPtcp6 -h remote_host [options] >-+ >-+ OR >-+ >-+ local_host> nplaunch NPtcp6 -h remote_host [options] >-+ >-+ >-+ >- MPICH >- ----- >- >diff -urN /usr/ports/benchmarks/netpipe/files/patch-dox-netpipe.1 benchmarks/netpipe/files/patch-dox-netpipe.1 >--- /usr/ports/benchmarks/netpipe/files/patch-dox-netpipe.1 2006-02-14 00:03:12.000000000 +0900 >+++ benchmarks/netpipe/files/patch-dox-netpipe.1 2008-04-15 00:25:09.000000000 +0900 >@@ -1,5 +1,5 @@ >---- dox/netpipe.1.orig Wed Jul 7 01:56:25 2004 >-+++ dox/netpipe.1 Mon Feb 13 19:59:57 2006 >+--- dox/netpipe.1.orig 2007-05-11 01:29:09.000000000 +0900 >++++ dox/netpipe.1 2008-04-15 00:24:20.000000000 +0900 > @@ -26,7 +26,7 @@ > .IB E valuator > >@@ -21,29 +21,26 @@ > both systems or by using a nplaunch script. To manually start NPtcp, > the NetPIPE receiver must be > started first on the remote system using the command: >-@@ -145,7 +145,12 @@ >- .Ee >- .PP >- Any options used must be the same on both sides. >+@@ -147,7 +147,9 @@ >+ Any options used must be the same on both sides. The \-P parameter >+ can be used to override the default port number. This is helpful when >+ running several streams through a router to a single endpoint. > - >-+The \-P parameter can be used to override the default port number. >-+This is helpful when running several streams through a router to a >-+single endpoint. > +.PP > +The NPtcp6 program is launched in a similar manner. > +.PP > The nplaunch script uses ssh to launch the remote receiver > before starting the local transmitter. To use rsh, simply change > the nplaunch script. >-@@ -366,6 +371,11 @@ >- .I -p >- .I 0 >- .B . >-+.ne 3 >-+ >-+.TP >-+.BI \-P \ \fIport\fR >-+Set the port number used by the TCP and TCP6 tests to \fIport\fR. >+@@ -376,6 +378,11 @@ > .ne 3 > > .TP >++.BI \-P \ \fIport\fR >++Set the port number used by the TCP and TCP6 tests to \fIport\fR. >++.ne 3 >++ >++.TP >+ .B \-r >+ This option resets the TCP sockets after every test (TCP module only). >+ It is necessary for some streaming tests to get good measurements >diff -urN /usr/ports/benchmarks/netpipe/files/patch-makefile benchmarks/netpipe/files/patch-makefile >--- /usr/ports/benchmarks/netpipe/files/patch-makefile 2006-02-14 00:03:12.000000000 +0900 >+++ benchmarks/netpipe/files/patch-makefile 1970-01-01 09:00:00.000000000 +0900 >@@ -1,26 +0,0 @@ >---- makefile.orig Wed Nov 12 11:47:13 2003 >-+++ makefile Mon Nov 17 09:03:21 2003 >-@@ -20,8 +20,8 @@ >- # >- ######################################################################## >- >--CC = cc >--CFLAGS = -O >-+CC ?= cc >-+CFLAGS ?= -O >- SRC = ./src >- >- # For MPI, mpicc will set up the proper include and library paths >-@@ -81,7 +81,11 @@ >- >- >- tcp: $(SRC)/tcp.c $(SRC)/netpipe.c $(SRC)/netpipe.h >-- $(CC) $(CFLAGS) $(SRC)/netpipe.c $(SRC)/tcp.c -DTCP -o NPtcp -I$(SRC) >-+ $(CC) $(CFLAGS) $(SRC)/netpipe.c $(SRC)/tcp.c -DTCP -o NPtcp -I$(SRC) >-+ >-+tcp6: $(SRC)/tcp.c $(SRC)/netpipe.c $(SRC)/netpipe.h >-+ $(CC) $(CFLAGS) $(SRC)/netpipe.c $(SRC)/tcp6.c -DTCP6 \ >-+ -o NPtcp6 -I$(SRC) >- >- memcpy: $(SRC)/memcpy.c $(SRC)/netpipe.c $(SRC)/netpipe.h >- $(CC) $(CFLAGS) $(SRC)/netpipe.c $(SRC)/memcpy.c \ >diff -urN /usr/ports/benchmarks/netpipe/files/patch-src-netpipe.c benchmarks/netpipe/files/patch-src-netpipe.c >--- /usr/ports/benchmarks/netpipe/files/patch-src-netpipe.c 2006-02-14 00:03:12.000000000 +0900 >+++ benchmarks/netpipe/files/patch-src-netpipe.c 1970-01-01 09:00:00.000000000 +0900 >@@ -1,84 +0,0 @@ >-Index: src/netpipe.c >-=================================================================== >-RCS file: /cvs/gnn/Personal/Code/Networking/NetPIPE/src/netpipe.c,v >-retrieving revision 1.1 >-retrieving revision 1.2 >-diff -u -r1.1 -r1.2 >---- src/netpipe.c 9 Sep 2004 08:29:38 -0000 1.1 >-+++ src/netpipe.c 27 Sep 2004 11:26:17 -0000 1.2 >-@@ -84,7 +84,7 @@ >- args.soffset=0; /* default to no offsets */ >- args.roffset=0; >- args.syncflag=0; /* use normal mpi_send */ >-- >-+ args.port = DEFPORT; /* just in case the user doesn't set this. */ >- >- /* TCGMSG launches NPtcgmsg with a -master master_hostname >- * argument, so ignore all arguments and set them manually >-@@ -94,7 +94,7 @@ >- #if ! defined(TCGMSG) >- >- /* Parse the arguments. See Usage for description */ >-- while ((c = getopt(argc, argv, "SO:rIiPszgfaB2h:p:o:l:u:b:m:n:t:c:d:D:")) != -1) >-+ while ((c = getopt(argc, argv, "SO:rIiszgfaB2h:p:o:l:u:b:m:n:t:c:d:D:P:")) != -1) >- { >- switch(c) >- { >-@@ -322,6 +322,9 @@ >- printf("Resetting connection after every trial\n"); >- break; >- #endif >-+ case 'P': >-+ args.port = atoi(optarg); >-+ break; >- >- default: >- PrintUsage(); >-@@ -369,7 +372,6 @@ >- exit(420132); >- } >- args.nbuff = TRIALS; >-- args.port = DEFPORT; >- >- Setup(&args); >- >-@@ -994,7 +996,7 @@ >- printf("a: asynchronous receive (a.k.a. preposted receive)\n"); >- #endif >- printf("B: burst all preposts before measuring performance\n"); >--#if defined(TCP) && ! defined(INFINIBAND) >-+#if (defined(TCP) || defined(TCP6)) && ! defined(INFINIBAND) >- printf("b: specify TCP send/receive socket buffer sizes\n"); >- #endif >- >-@@ -1010,7 +1012,7 @@ >- printf(" all MPI-2 implementations\n"); >- #endif >- >--#if defined(TCP) || defined(INFINIBAND) >-+#if defined(TCP) || defined(TCP6) || defined(INFINIBAND) >- printf("h: specify hostname of the receiver <-h host>\n"); >- #endif >- >-@@ -1030,7 +1032,7 @@ >- printf("p: set the perturbation number <-p 1>\n" >- " (default = 3 Bytes, set to 0 for no perturbations)\n"); >- >--#if defined(TCP) && ! defined(INFINIBAND) >-+#if (defined(TCP) || defined(TCP6)) && ! defined(INFINIBAND) >- printf("r: reset sockets for every trial\n"); >- #endif >- >-@@ -1053,10 +1055,11 @@ >- #endif >- >- printf("2: Send data in both directions at the same time.\n"); >-+ printf("P: Set the port number to one other than the default.\n"); >- #if defined(MPI) >- printf(" May need to use -a to choose asynchronous communications for MPI/n"); >- #endif >--#if defined(TCP) && !defined(INFINIBAND) >-+#if (defined(TCP) || defined(TCP6)) && !defined(INFINIBAND) >- printf(" The maximum test size is limited by the TCP buffer size/n"); >- #endif >- printf("\n"); >diff -urN /usr/ports/benchmarks/netpipe/files/patch-src-netpipe.h benchmarks/netpipe/files/patch-src-netpipe.h >--- /usr/ports/benchmarks/netpipe/files/patch-src-netpipe.h 2006-02-14 00:03:12.000000000 +0900 >+++ benchmarks/netpipe/files/patch-src-netpipe.h 1970-01-01 09:00:00.000000000 +0900 >@@ -1,54 +0,0 @@ >-Index: src/netpipe.h >-=================================================================== >-RCS file: /cvs/gnn/Personal/Code/Networking/NetPIPE/src/netpipe.h,v >-retrieving revision 1.1.1.1 >-retrieving revision 1.2 >-diff -u -r1.1.1.1 -r1.2 >---- src/netpipe.h 9 Sep 2004 08:29:38 -0000 1.1.1.1 >-+++ src/netpipe.h 9 Sep 2004 08:35:07 -0000 1.2 >-@@ -23,6 +23,11 @@ >- #include <stdlib.h> /* malloc(3) */ >- #include <unistd.h> /* getopt, read, write, ... */ >- >-+/* Handle the case of building on MacOS X */ >-+#if defined(__APPLE__) >-+#include <stdint.h> >-+#endif >-+ >- #ifdef INFINIBAND >- #include <ib_defs.h> /* ib_mtu_t */ >- #endif >-@@ -89,6 +94,24 @@ >- }; >- #endif >- >-+#elif defined(TCP6) >-+ #include <netdb.h> >-+ #include <sys/socket.h> >-+ #include <netinet/in.h> >-+ #include <netinet/tcp.h> >-+ #include <arpa/inet.h> >-+ >-+ typedef struct protocolstruct ProtocolStruct; >-+ struct protocolstruct >-+ { >-+ struct sockaddr_in6 sin1; /* socket structure #1 */ >-+ struct sockaddr_in6 sin2; /* socket structure #2 */ >-+ int nodelay; /* Flag for TCP nodelay */ >-+ struct hostent *addr; /* Address of host */ >-+ int sndbufsz; /* Size of TCP send buffer */ >-+ int rcvbufsz; /* Size of TCP receive buffer */ >-+ }; >-+ >- #elif defined(MPI) >- typedef struct protocolstruct ProtocolStruct; >- struct protocolstruct >-@@ -197,7 +220,7 @@ >- }; >- >- #else >-- #error "One of TCP, MPI, PVM, TCGMSG, LAPI, SHMEM, ATOLL, MEMCPY, DISK must be defined during compilation" >-+ #error "One of TCP, TCP6, MPI, PVM, TCGMSG, LAPI, SHMEM, ATOLL, MEMCPY, DISK must be defined during compilation" >- >- #endif >- >diff -urN /usr/ports/benchmarks/netpipe/files/patch-src-tcp6.c benchmarks/netpipe/files/patch-src-tcp6.c >--- /usr/ports/benchmarks/netpipe/files/patch-src-tcp6.c 2006-02-14 00:03:12.000000000 +0900 >+++ benchmarks/netpipe/files/patch-src-tcp6.c 1970-01-01 09:00:00.000000000 +0900 >@@ -1,453 +0,0 @@ >-Index: src/tcp6.c >-=================================================================== >-RCS file: src/tcp6.c >-diff -N src/tcp6.c >---- /dev/null 1 Jan 1970 00:00:00 -0000 >-+++ src/tcp6.c 9 Sep 2004 08:35:07 -0000 1.1 >-@@ -0,0 +1,444 @@ >-+/*****************************************************************************/ >-+/* "NetPIPE" -- Network Protocol Independent Performance Evaluator. */ >-+/* Copyright 1997, 1998 Iowa State University Research Foundation, Inc. */ >-+/* */ >-+/* This program is free software; you can redistribute it and/or modify */ >-+/* it under the terms of the GNU General Public License as published by */ >-+/* the Free Software Foundation. You should have received a copy of the */ >-+/* GNU General Public License along with this program; if not, write to the */ >-+/* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ >-+/* */ >-+/* TCP6 extension Copyright 2004 George V. Neville-Neil and Neville-Neil */ >-+/* Consulting */ >-+/* */ >-+/* * tcp6.c ---- TCP over IPv6 calls source */ >-+/* * tcp.h ---- Include file for TCP6 calls and data structs */ >-+/*****************************************************************************/ >-+#include "netpipe.h" >-+ >-+#if defined (MPLITE) >-+#include "mplite.h" >-+#endif >-+ >-+ >-+int doing_reset = 0; >-+ >-+void Init(ArgStruct *p, int* pargc, char*** pargv) >-+{ >-+ p->reset_conn = 0; /* Default to not resetting connection */ >-+ p->prot.sndbufsz = p->prot.rcvbufsz = 0; >-+ /* The transmitter will be set using the -h host flag. */ >-+ p->tr = 0; >-+ p->rcv = 1; >-+} >-+ >-+void Setup(ArgStruct *p) >-+{ >-+ int one = 1; >-+ int sockfd = -1; >-+ /* ptr to sockaddr_in in ArgStruct */ >-+ struct sockaddr_in6 *lsin1, *lsin2; >-+ >-+ char *host; >-+ struct hostent *hp; >-+ struct protoent *proto; >-+ int send_size, recv_size, sizeofint = sizeof(int); >-+ >-+ host = p->host; /* copy ptr to hostname */ >-+ >-+ lsin1 = &(p->prot.sin1); >-+ lsin2 = &(p->prot.sin2); >-+ >-+ bzero((char *) lsin1, sizeof(*lsin1)); >-+ bzero((char *) lsin2, sizeof(*lsin2)); >-+ >-+ if ((sockfd = socket(AF_INET6, SOCK_STREAM, 0)) < 0){ >-+ printf("NetPIPE: can't open stream socket! errno=%d\n", errno); >-+ exit(-4); >-+ } >-+ >-+ if(!(proto = getprotobyname("tcp"))){ >-+ printf("NetPIPE: protocol 'tcp' unknown!\n"); >-+ exit(555); >-+ } >-+ >-+ /* Attempt to set TCP_NODELAY */ >-+ >-+ if(setsockopt(sockfd, proto->p_proto, TCP_NODELAY, &one, sizeof(one)) < 0) >-+ { >-+ printf("NetPIPE: setsockopt: TCP_NODELAY failed! errno=%d\n", errno); >-+ exit(556); >-+ } >-+ >-+ /* If requested, set the send and receive buffer sizes */ >-+ >-+ if(p->prot.sndbufsz > 0) >-+ { >-+ if(setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &(p->prot.sndbufsz), >-+ sizeof(p->prot.sndbufsz)) < 0) >-+ { >-+ printf("NetPIPE: setsockopt: SO_SNDBUF failed! errno=%d\n", errno); >-+ printf("You may have asked for a buffer larger than the system can handle\n"); >-+ exit(556); >-+ } >-+ if(setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &(p->prot.rcvbufsz), >-+ sizeof(p->prot.rcvbufsz)) < 0) >-+ { >-+ printf("NetPIPE: setsockopt: SO_RCVBUF failed! errno=%d\n", errno); >-+ printf("You may have asked for a buffer larger than the system can handle\n"); >-+ exit(556); >-+ } >-+ } >-+ getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, >-+ (char *) &send_size, (void *) &sizeofint); >-+ getsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, >-+ (char *) &recv_size, (void *) &sizeofint); >-+ >-+ if(!doing_reset) { >-+ fprintf(stderr,"Send and receive buffers are %d and %d bytes\n", >-+ send_size, recv_size); >-+ fprintf(stderr, "(A bug in Linux doubles the requested buffer sizes)\n"); >-+ } >-+ >-+ if( p->tr ) { /* Primary transmitter */ >-+ >-+ lsin1->sin6_family = AF_INET6; >-+ >-+ /* First attempt to convert the string to an IPv6 */ >-+ /* address. */ >-+ /* If the user supplied a real host name this will fail and */ >-+ /* we'll then do a name lookup. */ >-+ >-+ if (inet_pton(AF_INET6, host, &lsin1->sin6_addr) == 0) >-+ { >-+ if ((hp = gethostbyname2(host, AF_INET6)) == NULL) >-+ { >-+ printf("NetPIPE: invalid hostname '%s'\n", host); >-+ exit(-5); >-+ } >-+ >-+ if (hp->h_addrtype != AF_INET6) >-+ { >-+ printf("NetPIPE: invalid hostname '%s'\n", host); >-+ exit(-5); >-+ } >-+ bcopy(hp->h_addr, (char*) &(lsin1->sin6_addr), >-+ hp->h_length); >-+ } >-+ >-+ lsin1->sin6_port = htons(p->port); >-+ >-+ p->commfd = sockfd; >-+ >-+ } else if( p->rcv ) { /* we are the receiver */ >-+ bzero((char *) lsin1, sizeof(*lsin1)); >-+ lsin1->sin6_family = AF_INET6; >-+ lsin1->sin6_len = sizeof(*lsin1); >-+ lsin1->sin6_port = htons(p->port); >-+ /* Setting this to all 0 is the "ANY" address. */ >-+ bzero(&lsin1->sin6_addr, sizeof(lsin1->sin6_addr)); >-+ >-+ if (bind(sockfd, (struct sockaddr *) lsin1, sizeof(*lsin1)) < 0){ >-+ printf("NetPIPE: server: bind on local address failed! errno=%d", errno); >-+ exit(-6); >-+ } >-+ >-+ p->servicefd = sockfd; >-+ } >-+ p->upper = send_size + recv_size; >-+ >-+ establish(p); /* Establish connections */ >-+ >-+} >-+ >-+static int >-+readFully(int fd, void *obuf, int len) >-+{ >-+ int bytesLeft = len; >-+ char *buf = (char *) obuf; >-+ int bytesRead = 0; >-+ >-+ while (bytesLeft > 0 && >-+ (bytesRead = read(fd, (void *) buf, bytesLeft)) > 0) >-+ { >-+ bytesLeft -= bytesRead; >-+ buf += bytesRead; >-+ } >-+ if (bytesRead <= 0) return bytesRead; >-+ return len; >-+} >-+ >-+void Sync(ArgStruct *p) >-+{ >-+ char s[] = "SyncMe", response[] = " "; >-+ >-+ if (write(p->commfd, s, strlen(s)) < 0 || /* Write to nbor */ >-+ readFully(p->commfd, response, strlen(s)) < 0) /* Read from nbor */ >-+ { >-+ perror("NetPIPE: error writing or reading synchronization string"); >-+ exit(3); >-+ } >-+ if (strncmp(s, response, strlen(s))) >-+ { >-+ fprintf(stderr, "NetPIPE: Synchronization string incorrect! |%s|\n", response); >-+ exit(3); >-+ } >-+} >-+ >-+void PrepareToReceive(ArgStruct *p) >-+{ >-+ /* >-+ The Berkeley sockets interface doesn't have a method to pre-post >-+ a buffer for reception of data. >-+ */ >-+} >-+ >-+void SendData(ArgStruct *p) >-+{ >-+ int bytesWritten, bytesLeft; >-+ char *q; >-+ >-+ bytesLeft = p->bufflen; >-+ bytesWritten = 0; >-+ q = p->s_ptr; >-+ while (bytesLeft > 0 && >-+ (bytesWritten = write(p->commfd, q, bytesLeft)) > 0) >-+ { >-+ bytesLeft -= bytesWritten; >-+ q += bytesWritten; >-+ } >-+ if (bytesWritten == -1) >-+ { >-+ printf("NetPIPE: write: error encountered, errno=%d\n", errno); >-+ exit(401); >-+ } >-+} >-+ >-+void RecvData(ArgStruct *p) >-+{ >-+ int bytesLeft; >-+ int bytesRead; >-+ char *q; >-+ >-+ bytesLeft = p->bufflen; >-+ bytesRead = 0; >-+ q = p->r_ptr; >-+ while (bytesLeft > 0 && >-+ (bytesRead = read(p->commfd, q, bytesLeft)) > 0) >-+ { >-+ bytesLeft -= bytesRead; >-+ q += bytesRead; >-+ } >-+ if (bytesLeft > 0 && bytesRead == 0) >-+ { >-+ printf("NetPIPE: \"end of file\" encountered on reading from socket\n"); >-+ } >-+ else if (bytesRead == -1) >-+ { >-+ printf("NetPIPE: read: error encountered, errno=%d\n", errno); >-+ exit(401); >-+ } >-+} >-+ >-+/* uint32_t is used to insure that the integer size is the same even in tests >-+ * between 64-bit and 32-bit architectures. */ >-+ >-+void SendTime(ArgStruct *p, double *t) >-+{ >-+ uint32_t ltime, ntime; >-+ >-+ /* >-+ Multiply the number of seconds by 1e8 to get time in 0.01 microseconds >-+ and convert value to an unsigned 32-bit integer. >-+ */ >-+ ltime = (uint32_t)(*t * 1.e8); >-+ >-+ /* Send time in network order */ >-+ ntime = htonl(ltime); >-+ if (write(p->commfd, (char *)&ntime, sizeof(uint32_t)) < 0) >-+ { >-+ printf("NetPIPE: write failed in SendTime: errno=%d\n", errno); >-+ exit(301); >-+ } >-+} >-+ >-+void RecvTime(ArgStruct *p, double *t) >-+{ >-+ uint32_t ltime, ntime; >-+ int bytesRead; >-+ >-+ bytesRead = readFully(p->commfd, (void *)&ntime, sizeof(uint32_t)); >-+ if (bytesRead < 0) >-+ { >-+ printf("NetPIPE: read failed in RecvTime: errno=%d\n", errno); >-+ exit(302); >-+ } >-+ else if (bytesRead != sizeof(uint32_t)) >-+ { >-+ fprintf(stderr, "NetPIPE: partial read in RecvTime of %d bytes\n", >-+ bytesRead); >-+ exit(303); >-+ } >-+ ltime = ntohl(ntime); >-+ >-+ /* Result is ltime (in microseconds) divided by 1.0e8 to get seconds */ >-+ >-+ *t = (double)ltime / 1.0e8; >-+} >-+ >-+void SendRepeat(ArgStruct *p, int rpt) >-+{ >-+ uint32_t lrpt, nrpt; >-+ >-+ lrpt = rpt; >-+ /* Send repeat count as a long in network order */ >-+ nrpt = htonl(lrpt); >-+ if (write(p->commfd, (void *) &nrpt, sizeof(uint32_t)) < 0) >-+ { >-+ printf("NetPIPE: write failed in SendRepeat: errno=%d\n", errno); >-+ exit(304); >-+ } >-+} >-+ >-+void RecvRepeat(ArgStruct *p, int *rpt) >-+{ >-+ uint32_t lrpt, nrpt; >-+ int bytesRead; >-+ >-+ bytesRead = readFully(p->commfd, (void *)&nrpt, sizeof(uint32_t)); >-+ if (bytesRead < 0) >-+ { >-+ printf("NetPIPE: read failed in RecvRepeat: errno=%d\n", errno); >-+ exit(305); >-+ } >-+ else if (bytesRead != sizeof(uint32_t)) >-+ { >-+ fprintf(stderr, "NetPIPE: partial read in RecvRepeat of %d bytes\n", >-+ bytesRead); >-+ exit(306); >-+ } >-+ lrpt = ntohl(nrpt); >-+ >-+ *rpt = lrpt; >-+} >-+ >-+void establish(ArgStruct *p) >-+{ >-+ int one = 1; >-+ socklen_t clen; >-+ struct protoent *proto; >-+ >-+ clen = (socklen_t) sizeof(p->prot.sin2); >-+ >-+ if( p->tr ){ >-+ >-+ while( connect(p->commfd, (struct sockaddr *) &(p->prot.sin1), >-+ sizeof(p->prot.sin1)) < 0 ) { >-+ >-+ /* If we are doing a reset and we get a connection refused from >-+ * the connect() call, assume that the other node has not yet >-+ * gotten to its corresponding accept() call and keep trying until >-+ * we have success. >-+ */ >-+ if(!doing_reset || errno != ECONNREFUSED) { >-+ printf("Client: Cannot Connect! errno=%d\n",errno); >-+ exit(-10); >-+ } >-+ >-+ } >-+ >-+ } else if( p->rcv ) { >-+ >-+ /* SERVER */ >-+ listen(p->servicefd, 5); >-+ p->commfd = accept(p->servicefd, (struct sockaddr *) &(p->prot.sin2), &clen); >-+ >-+ if(p->commfd < 0){ >-+ printf("Server: Accept Failed! errno=%d\n",errno); >-+ exit(-12); >-+ } >-+ >-+ /* >-+ Attempt to set TCP_NODELAY. TCP_NODELAY may or may not be propagated >-+ to accepted sockets. >-+ */ >-+ if(!(proto = getprotobyname("tcp"))){ >-+ printf("unknown protocol!\n"); >-+ exit(555); >-+ } >-+ >-+ if(setsockopt(p->commfd, proto->p_proto, TCP_NODELAY, >-+ &one, sizeof(one)) < 0) >-+ { >-+ printf("setsockopt: TCP_NODELAY failed! errno=%d\n", errno); >-+ exit(556); >-+ } >-+ >-+ /* If requested, set the send and receive buffer sizes */ >-+ if(p->prot.sndbufsz > 0) >-+ { >-+/* printf("Send and Receive Buffers on accepted socket set to %d bytes\n",*/ >-+/* p->prot.sndbufsz);*/ >-+ if(setsockopt(p->commfd, SOL_SOCKET, SO_SNDBUF, &(p->prot.sndbufsz), >-+ sizeof(p->prot.sndbufsz)) < 0) >-+ { >-+ printf("setsockopt: SO_SNDBUF failed! errno=%d\n", errno); >-+ exit(556); >-+ } >-+ if(setsockopt(p->commfd, SOL_SOCKET, SO_RCVBUF, &(p->prot.rcvbufsz), >-+ sizeof(p->prot.rcvbufsz)) < 0) >-+ { >-+ printf("setsockopt: SO_RCVBUF failed! errno=%d\n", errno); >-+ exit(556); >-+ } >-+ } >-+ } >-+} >-+ >-+void CleanUp(ArgStruct *p) >-+{ >-+ char *quit="QUIT"; >-+ >-+ if (p->tr) { >-+ >-+ write(p->commfd,quit, 5); >-+ read(p->commfd, quit, 5); >-+ close(p->commfd); >-+ >-+ } else if( p->rcv ) { >-+ >-+ read(p->commfd,quit, 5); >-+ write(p->commfd,quit,5); >-+ close(p->commfd); >-+ close(p->servicefd); >-+ >-+ } >-+} >-+ >-+ >-+void Reset(ArgStruct *p) >-+{ >-+ >-+ /* Reset sockets */ >-+ >-+ if(p->reset_conn) { >-+ >-+ doing_reset = 1; >-+ >-+ /* Close the sockets */ >-+ >-+ CleanUp(p); >-+ >-+ /* Now open and connect new sockets */ >-+ >-+ Setup(p); >-+ >-+ } >-+ >-+} >-+ >-+void AfterAlignmentInit(ArgStruct *p) >-+{ >-+ >-+} >-+ >- >- >diff -urN /usr/ports/benchmarks/netpipe/pkg-plist benchmarks/netpipe/pkg-plist >--- /usr/ports/benchmarks/netpipe/pkg-plist 2006-02-14 00:03:11.000000000 +0900 >+++ benchmarks/netpipe/pkg-plist 1970-01-01 09:00:00.000000000 +0900 >@@ -1,5 +0,0 @@ >-bin/NPtcp >-bin/NPtcp6 >-%%PORTDOCS%%share/doc/netpipe/README >-%%PORTDOCS%%share/doc/netpipe/netpipe_paper.ps >-%%PORTDOCS%%@dirrm share/doc/netpipe
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 122755
: 86339