🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pe.cust.sources
Article #12

uucp speedup, part 2 - uucico changes

#12
From: Steve Davies
Date: Mon, 15 Apr 1985 15:49
132 lines
3688 bytes
These are the changes to uucp to fix the problem of uucp eating up all
the cpu cycles.  The changes are to function pkcget in file pk1.c, and
to fixline in conn.c .  The line numbers for pk1 are wrong.. the ones for
conn.c should be correct.  These are context diffs using the 2.4 uucp
sources.  The changes for anyone running Berkley 4.2 uucp should be almost
identical.  After making these changes, remake uucico.

*** conn.c.v7	Fri Mar 22 17:48:48 1985
--- conn.c	Fri Mar 22 17:50:14 1985
***************
*** 568,573
   *	return codes:  none
   */
  
  fixline(tty, spwant)
  int tty, spwant;
  {

--- 568,575 -----
   *	return codes:  none
   */
  
+ int linebaudrate = 1200;				/* PKSPEEDUP */
+ 
  fixline(tty, spwant)
  int tty, spwant;
  {
***************
*** 590,595
  	ASSERT(ret >= 0, "RETURN FROM STTY %d", ret);
  	ioctl(tty, TIOCHPCL, 0);
  	ioctl(tty, TIOCEXCL, 0);
  	return;
  }
  

--- 592,598 -----
  	ASSERT(ret >= 0, "RETURN FROM STTY %d", ret);
  	ioctl(tty, TIOCHPCL, 0);
  	ioctl(tty, TIOCEXCL, 0);
+ 	linebaudrate = spwant;				/* PKSPEEDUP */
  	return;
  }
  

*** pk1.c.v7	Fri Mar 22 16:53:26 1985
--- pk1.c	Fri Mar 22 17:04:00 1985
***************
*** 12,17
  jmp_buf Getjbuf;
  cgalarm() { longjmp(Getjbuf, 1); }
  
  pkcget(fn, b, n)
  int fn, n;
  char *b;

--- 12,26 -----
  jmp_buf Getjbuf;
  cgalarm() { longjmp(Getjbuf, 1); }
  
+ extern int linebaudrate;				/* PKSPEEDUP */
+ #define MAXNAP ((64*HZ*10)/1200) /* dont sleep for more than 1 packet at 1200 */
+ /* The above is just paranoia; there should never be more than 63 bytes
+  * unread after the first read returns. (the 1200 should really be linebaudrate
+  * but I am assuming the the expression is computed at compile time and
+  * if replace 1200 with linebaudrate, then it would have to be done at run-time
+  * and we all know how horribly long divides take...)
+  */						/* PSKPEEDUP */
+ 
  pkcget(fn, b, n)
  int fn, n;
  char *b;
***************
*** 17,22
  char *b;
  {
  	int nchars, ret;
  
  	if (setjmp(Getjbuf)) {
  		Ntimeout++;

--- 20,26 -----
  char *b;
  {
  	int nchars, ret;
+ 	register int catnap;				/* PKSPEEDUP */
  
  	if (setjmp(Getjbuf)) {
  		Ntimeout++;
***************
*** 25,31
  	}
  	signal(SIGALRM, cgalarm);
  
! 	for (nchars = 0; nchars < n; nchars += ret) {
  		alarm(PKTIME);
  		ret = read(fn, b, n - nchars);
  		if (ret == 0) {

--- 29,35 -----
  	}
  	signal(SIGALRM, cgalarm);
  
! 	for (nchars = 0; nchars < n; ) {		/* PKSPEEDUP */
  		alarm(PKTIME);
  		ret = read(fn, b, n - nchars);
  		if (ret == 0) {
***************
*** 34,39
  		}
  		PKASSERT(ret > 0, "PKCGET READ %d", ret);
  		b += ret;
  	}
  	alarm(0);
  	return(0);

--- 38,52 -----
  		}
  		PKASSERT(ret > 0, "PKCGET READ %d", ret);
  		b += ret;
+ 
+ 		nchars += ret;				/* PKSPEEDUP */
+ 		if (nchars+1 < n && linebaudrate > 0)	/* PKSPEEDUP */
+ 			
+ 			if ((catnap = ((n-nchars) * HZ * 10)/linebaudrate) < MAXNAP) /* PKSPEEDUP */
+ 				nap(catnap); 		/* PKSPEEDUP */
+ 			else 				/* PKSPEEDUP */
+ 				nap(MAXNAP); 		/* PKSPEEDUP */
+ 
  	}
  	alarm(0);
  	return(0);
Technical Details
Message-ID: <822@peora.UUCP>
Path: arc1-ca.pugleaf.net!lsuc!per!pesnta!peora!srd
References: <821@peora.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10.2 9/18/84; site lsuc.UUCP
Posting-Version: version B 2.10.2 9/18/84; site peora.UUCP
Path: arc1-ca.pugleaf.net!lsuc!per!pesnta!peora!srd
From: srd@peora.UUCP (Steve Davies)
Newsgroups: pe.cust.sources
Subject: uucp speedup, part 2 - uucico changes
Message-ID: <822@peora.UUCP>
Date: 15 Apr 85 15:49:27 GMT
Date-Received: 16 Apr 85 03:59:15 GMT
References: <821@peora.UUCP>
Distribution: pe.cust
Organization: Perkin-Elmer SDC, Orlando, Fl.
Lines: 132