> I noticed the "XXX: what should this be?" w.r.t. COPY_SIZE in > sftp-client.c. I made up the following quick patch to allow a new > command-line argument, "-B" (for 'buffer' size) to specify this value. > > I haven't done any strict benchmarking yet, but -B65535 is faster than > -B8192 which is much faster than -B16. > > PS again, I am not on this list, so please CC me any replies.This feature has been added to the -current tree a week ago and was just pulled into the portable tree a few days ago. - Ben
I noticed the "XXX: what should this be?" w.r.t. COPY_SIZE in
sftp-client.c. I made up the following quick patch to allow a new
command-line argument, "-B" (for 'buffer' size) to specify
this value.
I haven't done any strict benchmarking yet, but -B65535 is faster than
-B8192 which is much faster than -B16.
PS again, I am not on this list, so please CC me any replies.
--
Michael T. Babcock
CTO, FibreSpeed Ltd. (Hosting, Security, Consultation, Database, etc)
http://www.fibrespeed.net/~mbabcock/
-------------- next part --------------
diff -p -u openssh-3.0.2p1/scp.c openssh-3.0.2p1-mtb1/scp.c
--- openssh-3.0.2p1/scp.c Sun Oct 21 20:53:59 2001
+++ openssh-3.0.2p1-mtb1/scp.c Tue Feb 5 11:18:46 2002
@@ -966,7 +966,7 @@ void
usage()
{
(void) fprintf(stderr,
- "usage: scp [-pqrvBC46] [-F config] [-S ssh] [-P port] [-c cipher]
[-i identity]\n"
+ "usage: scp [-pqrvBC46] [-B bufsize] [-F config] [-S ssh] [-P port]
[-c cipher] [-i identity]\n"
" [-o option] f1 f2\n"
" or: scp [options] f1 ... fn directory\n");
exit(1);
diff -p -u openssh-3.0.2p1/sftp-client.c openssh-3.0.2p1-mtb1/sftp-client.c
--- openssh-3.0.2p1/sftp-client.c Wed Jul 18 11:45:45 2001
+++ openssh-3.0.2p1-mtb1/sftp-client.c Tue Feb 5 11:24:12 2002
@@ -44,7 +44,9 @@ RCSID("$OpenBSD: sftp-client.c,v 1.18 20
/* How much data to read/write at at time during copies */
/* XXX: what should this be? */
-#define COPY_SIZE 8192
+/* MTB: get around the issue by using a dynamic value with the same default. */
+/* #define COPY_SIZE 8129 */
+extern unsigned int COPY_SIZE;
/* Message ID */
static u_int msg_id = 1;
@@ -870,7 +872,11 @@ do_upload(int fd_in, int fd_out, char *l
offset = 0;
for(;;) {
int len;
- char data[COPY_SIZE];
+ char *data;
+
+ if ((data = malloc(COPY_SIZE)) == NULL)
+ fatal("Couldn't allocate %ld bytes for data buffer; %s",
+ (long)COPY_SIZE, strerror(errno));
/*
* Can't use atomicio here because it returns 0 on EOF, thus losing
diff -p -u openssh-3.0.2p1/sftp.c openssh-3.0.2p1-mtb1/sftp.c
--- openssh-3.0.2p1/sftp.c Wed Sep 19 20:57:56 2001
+++ openssh-3.0.2p1-mtb1/sftp.c Tue Feb 5 11:19:25 2002
@@ -48,6 +48,7 @@ char *__progname;
char *ssh_program = _PATH_SSH_PROGRAM;
FILE* infile;
+unsigned int COPY_SIZE=8192;
static void
connect_to_server(char **args, int *in, int *out, pid_t *sshpid)
@@ -95,7 +96,7 @@ usage(void)
{
fprintf(stderr,
"usage: sftp [-1Cv] [-b batchfile] [-F config] [-o option] [-s
subsystem|path]\n"
- " [-S program] [user@]host[:file [file]]\n");
+ " [-B bufsize] [-S program] [user@]host[:file
[file]]\n");
exit(1);
}
@@ -122,8 +123,11 @@ main(int argc, char **argv)
ll = SYSLOG_LEVEL_INFO;
infile = stdin; /* Read from STDIN unless changed by -b */
- while ((ch = getopt(argc, argv, "1hvCo:s:S:b:F:")) != -1) {
+ while ((ch = getopt(argc, argv, "1hvCo:s:S:b:F:B:")) != -1) {
switch (ch) {
+ case 'B':
+ COPY_SIZE = atoi(optarg);
+ break;
case 'C':
addargs(&args, "-C");
break;
On Tue, 5 Feb 2002, Michael T. Babcock wrote:> I noticed the "XXX: what should this be?" w.r.t. COPY_SIZE in > sftp-client.c. I made up the following quick patch to allow a new > command-line argument, "-B" (for 'buffer' size) to specify this value.Already in current CVS -d
NOTE: Your patch to scp.c is incorrect. It only patches the usage()
function and SCP already has a -B option, so it can't be added
there, unless the brilliant idea that was mentioned in the scp
-1/-2 thread of having a generic option (-O?) for passing options
to the backend is added.
And yes, it's in -current.
Cheers,
Nico
On Tue, Feb 05, 2002 at 11:35:07AM -0500, Michael T. Babcock
wrote:> I noticed the "XXX: what should this be?" w.r.t. COPY_SIZE in
> sftp-client.c. I made up the following quick patch to allow a new
> command-line argument, "-B" (for 'buffer' size) to
specify this value.
>
> I haven't done any strict benchmarking yet, but -B65535 is faster than
> -B8192 which is much faster than -B16.
>
> PS again, I am not on this list, so please CC me any replies.
> --
> Michael T. Babcock
> CTO, FibreSpeed Ltd. (Hosting, Security, Consultation, Database, etc)
> http://www.fibrespeed.net/~mbabcock/
--
-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-
Visit our website at http://www.ubswarburg.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.