pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/benchmarks/nttcp handle SO_LINGER portably.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4afc759e6dda
branches:  trunk
changeset: 397058:4afc759e6dda
user:      christos <christos%pkgsrc.org@localhost>
date:      Sat Jun 15 15:01:02 2019 +0000

description:
handle SO_LINGER portably.

diffstat:

 benchmarks/nttcp/Makefile         |   4 +-
 benchmarks/nttcp/distinfo         |   4 +-
 benchmarks/nttcp/patches/patch-ab |  45 ++++++++++++++++++++++++++++----------
 3 files changed, 37 insertions(+), 16 deletions(-)

diffs (138 lines):

diff -r 4b154edd84b0 -r 4afc759e6dda benchmarks/nttcp/Makefile
--- a/benchmarks/nttcp/Makefile Sat Jun 15 12:52:39 2019 +0000
+++ b/benchmarks/nttcp/Makefile Sat Jun 15 15:01:02 2019 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.13 2016/02/25 11:09:50 jperkin Exp $
+# $NetBSD: Makefile,v 1.14 2019/06/15 15:01:02 christos Exp $
 
 DISTNAME=      nttcp-1.47
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    benchmarks net
 MASTER_SITES=  http://www.sfr-fresh.com/unix/privat/
 
diff -r 4b154edd84b0 -r 4afc759e6dda benchmarks/nttcp/distinfo
--- a/benchmarks/nttcp/distinfo Sat Jun 15 12:52:39 2019 +0000
+++ b/benchmarks/nttcp/distinfo Sat Jun 15 15:01:02 2019 +0000
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.8 2015/11/03 00:25:51 agc Exp $
+$NetBSD: distinfo,v 1.9 2019/06/15 15:01:02 christos Exp $
 
 SHA1 (nttcp-1.47.tar.gz) = 28de7d65074e7546babdfa42b3b88fd8baa2be88
 RMD160 (nttcp-1.47.tar.gz) = 54b14062e84660b8d7982f702f94689cdce91d29
 SHA512 (nttcp-1.47.tar.gz) = eb0a5aa0633555a6e4c3834e99666cd0e00d41da5d82fdfd2644a9f59727236f1b24fbe810272cf9cfb96d76361b028bcf57025008570dbd6b0d761df5cce625
 Size (nttcp-1.47.tar.gz) = 25693 bytes
 SHA1 (patch-aa) = 98f93947b4d1e650ad371756463377a7c54704a3
-SHA1 (patch-ab) = c8fe3e59cf06c91719ffd00affaff26547e53e59
+SHA1 (patch-ab) = d7f28d6d4652c39fafb0674f489b3ecc4406b21a
 SHA1 (patch-ac) = 5e7d4e81311c37187f72ff0ca54601c07fb90f17
 SHA1 (patch-ad) = fd369f9173933a4c56d188377d2e55fa43c9e032
diff -r 4b154edd84b0 -r 4afc759e6dda benchmarks/nttcp/patches/patch-ab
--- a/benchmarks/nttcp/patches/patch-ab Sat Jun 15 12:52:39 2019 +0000
+++ b/benchmarks/nttcp/patches/patch-ab Sat Jun 15 15:01:02 2019 +0000
@@ -1,8 +1,12 @@
-$NetBSD: patch-ab,v 1.3 2006/05/12 03:07:14 simonb Exp $
+$NetBSD: patch-ab,v 1.4 2019/06/15 15:01:03 christos Exp $
 
---- nttcp.c.orig       2000-12-18 21:16:54.000000000 +1100
-+++ nttcp.c
-@@ -136,9 +136,9 @@ void syslog(int priority, const char *me
+1. handle SIGCLD portably
+2. define a large enough value for SO_LINGER that does not fail
+3. add a runtime option -U <seconds>
+
+--- nttcp.c.orig       2000-12-18 05:16:54.000000000 -0500
++++ nttcp.c    2019-06-15 10:56:28.798775017 -0400
+@@ -136,9 +136,9 @@
  #endif /* aix */ 
  
  /*====================================================================*/
@@ -14,7 +18,7 @@
  
  /*====================================================================*/
  #if defined(BSD42)
-@@ -268,6 +268,7 @@ Usage: nttcp [local options] host [remot
+@@ -268,6 +268,7 @@
  \t-n# number of source bufs written to network (default 2048)\n\
  \t-u  use UDP instead of TCP\n\
  \t-g#us       gap in micro seconds between UDP packets (default 0s)\n\
@@ -22,7 +26,24 @@
  \t-d  set SO_DEBUG in sockopt\n\
  \t-D  don't buffer TCP writes (sets TCP_NODELAY socket option)\n\
  \t-w# set the send buffer space to #kilobytes, which is\n\
-@@ -346,6 +347,7 @@ typedef struct {
+@@ -310,9 +311,15 @@
+       setitimer(ITIMER_REAL, &itval, Nil(struct itimerval))
+ #define       Suspend(msec)   SetItVal(msec); pause()
+ 
++/*
++ * we use 32767 (9 hours) because this is the largest implementation-specific
++ * value that we can since on the BSD's the kernel linger value is
++ * unsigned short, on opensolaris is int, and on linux is unsigned long
++ * scaled by HZ.
++ */
+ struct linger Ling = {
+       1,              /* option on */
+-      1000000         /* linger time, for our control connection */
++      32767           /* linger time, for our control connection */
+ };
+ 
+ /* global variables needed by StartTimer, StopTimer */
+@@ -346,6 +353,7 @@
      int FixedDataSize;                /* if>0: calc BufCnt/BufLen from this */
      int Window,       SndWin, RcvWin; /* TCP window sizes */
      int       Verbose;                /* ==1: more diagnostics */
@@ -30,7 +51,7 @@
      char *MulticastChannel;   /* we send multicast traffic */
      short MulticastPort;      
      int GapLength;            /* Gap length between packets */
-@@ -496,6 +498,13 @@ void StartTimer() {
+@@ -496,6 +504,13 @@
      SysCalls=0;
  }
  
@@ -44,7 +65,7 @@
  void StopTimer(double *cput, double *realt) {
      /* delivers in cput:  the amount of cpu time in seconds
       *          in realt: the real time in seconds
-@@ -878,6 +887,7 @@ void InitOptions(Options *opt) {
+@@ -878,6 +893,7 @@
      opt->Verbose=0;           /* ==1: more diagnostics */
      opt->GapLength=0;         /* no delay, send as fast as possible */
      opt->inetd= 0;            /* ==1: run in inetd mode */
@@ -52,7 +73,7 @@
      opt->Service= GetService();       /* the service-port to listen to */
      opt->MulticastChannel= NULL;
      opt->MulticastPort= 0;
-@@ -1013,6 +1023,10 @@ void ParseOptions(int *ac, char **av[], 
+@@ -1013,6 +1029,10 @@
  #endif /*MULTICAST*/
            break;
          }
@@ -63,7 +84,7 @@
          default: {
            strcpy(MsgBuf, "unknown option: ");
            strncat(MsgBuf, argv[0], sizeof(MsgBuf)-strlen(MsgBuf)-1);
-@@ -1427,6 +1441,10 @@ int main(int argc, char *argv[]) {
+@@ -1427,6 +1447,10 @@
            sprintf(OptBuf, "-g%d", opt.GapLength);
            StrVecAppend(RemOpt, OptBuf);
        }
@@ -74,7 +95,7 @@
        if (opt.MulticastChannel) {
            sprintf(OptBuf, "-m%s:%d",
              opt.MulticastChannel, opt.MulticastPort);
-@@ -1781,9 +1799,17 @@ int main(int argc, char *argv[]) {
+@@ -1781,9 +1805,17 @@
            else
                Pattern(buf, opt.BufLen);
            StartTimer();
@@ -93,7 +114,7 @@
            }
            StopTimer(&cput, &realt);
            opt.GapLength= 0;
-@@ -1797,9 +1823,17 @@ int main(int argc, char *argv[]) {
+@@ -1797,9 +1829,17 @@
            nBytes= 0;
            nBuffer= 0;
            StartTimer();



Home | Main Index | Thread Index | Old Index