Author: des
Date: Tue Jan 28 14:32:04 2014
New Revision: 261234
URL: http://svnweb.freebsd.org/changeset/base/261234

Log:
  Increase the default (and minimum) buffer size from 4 kB to 16 kB.  Also,
  propagate the buffer size to libc, which uses a 1 kB buffer by default,
  negating any hypothetical benefit of increasing fetch(1)'s buffer size.
  
  MFC after:    3 days

Modified:
  head/usr.bin/fetch/fetch.1
  head/usr.bin/fetch/fetch.c

Modified: head/usr.bin/fetch/fetch.1
==============================================================================
--- head/usr.bin/fetch/fetch.1  Tue Jan 28 14:29:24 2014        (r261233)
+++ head/usr.bin/fetch/fetch.1  Tue Jan 28 14:32:04 2014        (r261234)
@@ -1,5 +1,5 @@
 .\"-
-.\" Copyright (c) 2000-2013 Dag-Erling Smørgrav
+.\" Copyright (c) 2000-2014 Dag-Erling Smørgrav
 .\" Copyright (c) 2013 Michael Gmelin <[email protected]>
 .\" All rights reserved.
 .\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 30, 2013
+.Dd January 28, 2014
 .Dt FETCH 1
 .Os
 .Sh NAME
@@ -118,7 +118,7 @@ Automatically retry the transfer upon so
 Allow SSL version 2 when negotiating the connection.
 .It Fl B Ar bytes , Fl -buffer-size= Ns Ar bytes
 Specify the read buffer size in bytes.
-The default is 4096 bytes.
+The default is 16,384 bytes.
 Attempts to set a buffer size lower than this will be silently
 ignored.
 The number of reads actually performed is reported at verbosity level

Modified: head/usr.bin/fetch/fetch.c
==============================================================================
--- head/usr.bin/fetch/fetch.c  Tue Jan 28 14:29:24 2014        (r261233)
+++ head/usr.bin/fetch/fetch.c  Tue Jan 28 14:32:04 2014        (r261234)
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
 
 #include <fetch.h>
 
-#define MINBUFSIZE     4096
+#define MINBUFSIZE     16384
 #define TIMEOUT                120
 
 /* Option flags */
@@ -716,6 +716,7 @@ fetch(char *URL, const char *path)
        sigalrm = siginfo = sigint = 0;
 
        /* suck in the data */
+       setvbuf(f, NULL, _IOFBF, B_size);
        signal(SIGINFO, sig_handler);
        while (!sigint) {
                if (us.size != -1 && us.size - count < B_size &&
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to