[net.sources] speeding up 2.9

scw@cepu.UUCP (10/03/84)

*<eat that, bug>
    This is a reinstallation of the cpu.speedup patch (from the news
package) as applied to the 2.9BSD uucico.  This patch will also fix the
problem of very slow transfers that happen when using 2.9BSD uucico.

My sources tell me that the 2.9 and 4.2 BSD uucico packages are identical,
except for the sleep(1) bug. So the second patch may be applicable
there as well.

    Two files are affected by this patch: condevs.c and pk1.c. One of the
patches to pk1.c must be applied in order to have uucico run at some reasonable
rate.

    The patches to condevs.c were applied liberally, there may be extra
'linebaud= dev.D-speed;' lines where line speed is being changed for
strange reasons.

I'd like to thank Dr. Stan Sted (cepu!ucla-an!stan) and Kyle Henrickson
(cepu!ucla-ci!kyle) for acting as Guinea Pigs in this manner (but then they
got faster uucp Xfers out of it)<scw>
I'd also like to thank :
ihnp4!ut-sally!harvard!wjh12!sob, trwrb!wlbr!jm, and ihnp4!harvard!tardis!ddl
For the valuable inputs and pointers that they gave me.

diffs follow:

You must apply one or the other of these patches to pk1.c
This is patch #1 a minimal patch to fix the slowness problem (Not for 4.2)
*** pk1.c.O	Mon Oct  1 17:03:08 1984
--- pk1.c.B	Wed Jul 20 17:00:06 1983
***************
***************
*** 370,379
  			alarm(0);
  			return(-1);
  		}
  		PKASSERT(ret > 0, "PKCGET READ", "", ret);
  		b += ret;
  	}
  	alarm(0);
  	return(0);
  }


--- 370,379 -----
  			alarm(0);
  			return(-1);
  		}
  		PKASSERT(ret > 0, "PKCGET READ", "", ret);
  		b += ret;
-  		sleep(1);
  	}
  	alarm(0);
  	return(0);
  }

This SET of patches (to pk1.c and condevs.c) will add the cpu.speedup
feature to 2.9BSD uucico. It should also be applicable to 4.2BSD.

*** pk1.c	Mon Oct  1 17:06:10 1984
--- pk1.c.B	Wed Jul 20 17:00:06 1983
***************
*** 354,364
  int fn, n;
  register char *b;
  {
  	register int nchars, ret;
  
- 	extern int linebaud; /* CPU SPEED  --- SWS 10/1/84 */
  	if (setjmp(Getjbuf)) {
  		Ntimeout++;
  		PKDEBUG(4, "alarm %d\n", Ntimeout);
  		return(-1);
  	}

--- 354,363 -----
  int fn, n;
  register char *b;
  {
  	register int nchars, ret;
  
  	if (setjmp(Getjbuf)) {
  		Ntimeout++;
  		PKDEBUG(4, "alarm %d\n", Ntimeout);
  		return(-1);
  	}
***************
*** 363,373
  		return(-1);
  	}
  	signal(SIGALRM, cgalarm);
  
  	alarm(PKTIME);
! 	for (nchars = 0; nchars < n; ) { /* SWS */
  		ret = read(fn, b, n - nchars);
  		if (ret == 0) {
  			alarm(0);
  			return(-1);
  		}

--- 362,372 -----
  		return(-1);
  	}
  	signal(SIGALRM, cgalarm);
  
  	alarm(PKTIME);
! 	for (nchars = 0; nchars < n; nchars += ret) {
  		ret = read(fn, b, n - nchars);
  		if (ret == 0) {
  			alarm(0);
  			return(-1);
  		}
***************
*** 371,382
  			alarm(0);
  			return(-1);
  		}
  		PKASSERT(ret > 0, "PKCGET READ", "", ret);
  		b += ret;
- 		nchars += ret; /* SWS */
- 		if (( nchars < n) && (linebaud > 0) && (linebaud < 4800))
  		sleep(1);
  	}
  	alarm(0);
  	return(0);
  }

--- 370,379 -----
  			alarm(0);
  			return(-1);
  		}
  		PKASSERT(ret > 0, "PKCGET READ", "", ret);
  		b += ret;
  		sleep(1);
  	}
  	alarm(0);
  	return(0);
  }

*** condevs.c	Mon Oct  1 16:53:49 1984
--- condevs.BSD2.9	Tue Jul 26 15:10:59 1983
***************
*** 44,49
  int nulldev(), nodev(), Acuopn(), diropn(), dircls();
  
- int linebaud;
- 
  #ifdef DATAKIT
  int dkopn();

--- 44,47 -----
  int nulldev(), nodev(), Acuopn(), diropn(), dircls();
  
  #ifdef DATAKIT
  int dkopn();
***************
*** 198,202
  	fflush(stdout);
  	fixline(dcr, dev.D_speed);
- 	linebaud = dev.D_speed;	/* SWS 10/1/84 */
  	strcpy(devSel, dev.D_line);	/* for latter unlock */
  	CU_end = dircls;

--- 196,199 -----
  	fflush(stdout);
  	fixline(dcr, dev.D_speed);
  	strcpy(devSel, dev.D_line);	/* for latter unlock */
  	CU_end = dircls;
***************
*** 416,420
  	speed = atoi(fdig(flds[F_CLASS]));
  	fixline(dh, speed);
- 	linebaud = speed;		/* SWS 10/1/84 */
  	sleep(1);
  

--- 413,416 -----
  	speed = atoi(fdig(flds[F_CLASS]));
  	fixline(dh, speed);
  	sleep(1);
  
***************
*** 636,640
  	fflush(stdout);
  	fixline(dcf, dev->D_speed);
- 	linebaud = dev-> D_speed;
  	DEBUG(4, "Fork Stat %o\n", lt);
  	if (lt != 0) {

--- 632,635 -----
  	fflush(stdout);
  	fixline(dcf, dev->D_speed);
  	DEBUG(4, "Fork Stat %o\n", lt);
  	if (lt != 0) {
***************
*** 717,721
  	sprintf(dcname, "/dev/%s", dev->D_line);
  	fixline(dnf, dev->D_speed);
- 	linebaud = dev -> D_speed;
  	sprintf(phone, "\02%s", ph);
  	DEBUG(4, "dc - %s, ", dcname);

--- 712,715 -----
  	sprintf(dcname, "/dev/%s", dev->D_line);
  	fixline(dnf, dev->D_speed);
  	sprintf(phone, "\02%s", ph);
  	DEBUG(4, "dc - %s, ", dcname);
***************
*** 787,791
  	fflush(stdout);
  	fixline(dcf, dev->D_speed);
- 	linebaud = dev -> D_speed;
  	DEBUG(4, "Fork Stat %o\n", lt);
  	if (lt != 0) {

--- 781,784 -----
  	fflush(stdout);
  	fixline(dcf, dev->D_speed);
  	DEBUG(4, "Fork Stat %o\n", lt);
  	if (lt != 0) {
***************
*** 859,863
  	if (dh >= 0) {
  		fixline(dh, dev->D_speed);
- 		linebaud = dev -> D_speed;
  #ifdef HAYSTONE
  		write(dh, "\rATDT", 5);

--- 852,855 -----
  	if (dh >= 0) {
  		fixline(dh, dev->D_speed);
  #ifdef HAYSTONE
  		write(dh, "\rATDT", 5);
***************
*** 988,992
  	next_fd = -1;
  	fixline(dnf, dev->D_speed);
- 	linebaud = dev ->D_speed;
  	DEBUG(4, "Hayes port - %s, ", dcname);
  

--- 980,983 -----
  	next_fd = -1;
  	fixline(dnf, dev->D_speed);
  	DEBUG(4, "Hayes port - %s, ", dcname);
  
***************
*** 1101,1105
  	/* modem is open */
  	fixline(dh, dev->D_speed);
- 	linebaud = dev ->D_speed;
  
  	/* translate - to % and = to & for VenTel */

--- 1092,1095 -----
  	/* modem is open */
  	fixline(dh, dev->D_speed);
  
  	/* translate - to % and = to & for VenTel */
***************
*** 1279,1283
  		}
  	fixline(dh, dev->D_speed);
- 	linebaud = dev -> D_speed;
  
  /* translate - to K for Vadic */

--- 1269,1272 -----
  		}
  	fixline(dh, dev->D_speed);
  
  /* translate - to K for Vadic */
***************
*** 1408,1412
  	}
  	fixline(va, dev->D_speed);
- 	linebaud = dev ->D_speed;
  
  	p_chwrite(va, STX);	/* access adaptor */

--- 1397,1400 -----
  	}
  	fixline(va, dev->D_speed);
  
  	p_chwrite(va, STX);	/* access adaptor */
***************
*** 1474,1478
  	}
  	fixline(i, dev->D_speed);
- 	linebaud = dev -> D_speed;
  	goto ret;
  failret:

--- 1462,1465 -----
  	}
  	fixline(i, dev->D_speed);
  	goto ret;
  failret:




-- 
Stephen C. Woods (VA Wadsworth Med Ctr./UCLA Dept. of Neurology)
uucp:	{ {ihnp4, uiucdcs}!bradley, hao, trwrb, sdcrdcf}!cepu!scw
ARPA: cepu!scw@ucla-cs location: N 34 3' 9.1" W 118 27' 4.3"