[comp.bugs.4bsd] Gross bug in sys/kern_clock.c

ray@maxwell.physics.purdue.edu (Ray Moody) (03/13/89)

Index:	sys/sys/kern_clock.c

Description:
	Some variable names are messed up in sys/sys/kern_clock.c

Repeat-By:
	Inspection, mainly.

	We noticed this bug in our system when our clocks started loosing about
	half an hour every day.  (No, I don't happen to know the magic numbers
	to give adjtime() to cause this.)

Fix:
*** /tmp/,RCSt1007315	Mon Mar 13 10:52:35 1989
--- /tmp/,RCSt2007315	Mon Mar 13 10:52:36 1989
***************
*** 78,84
  	register struct proc *p;
  	register int s;
  	int needsoft = 0;
! 	extern int tickdelta, tickadj;
  
  #ifdef is68k
  	lbolt++;				/* ISI: SYSV */

--- 78,84 -----
  	register struct proc *p;
  	register int s;
  	int needsoft = 0;
! 	extern int tickdelta, timedelta;
  
  #ifdef is68k
  	lbolt++;				/* ISI: SYSV */
***************
*** 202,208
  	 * so we don't keep the relatively high clock interrupt
  	 * priority any longer than necessary.
  	 */
! 	if (tickdelta == 0)
  		BUMPTIME(&time, tick)
  	else {
  		register delta;

--- 202,208 -----
  	 * so we don't keep the relatively high clock interrupt
  	 * priority any longer than necessary.
  	 */
! 	if (timedelta == 0)
  		BUMPTIME(&time, tick)
  	else {
  		register delta;
***************
*** 207,215
  	else {
  		register delta;
  
! 		if (tickdelta < 0) {
! 			delta = tick - tickadj;
! 			tickdelta += tickadj;
  		} else {
  			delta = tick + tickadj;
  			tickdelta -= tickadj;

--- 207,215 -----
  	else {
  		register delta;
  
! 		if (timedelta < 0) {
! 			delta = tick - tickdelta;
! 			timedelta += tickdelta;
  		} else {
  			delta = tick + tickdelta;
  			timedelta -= tickdelta;
***************
*** 211,218
  			delta = tick - tickadj;
  			tickdelta += tickadj;
  		} else {
! 			delta = tick + tickadj;
! 			tickdelta -= tickadj;
  		}
  		BUMPTIME(&time, delta);
  /* KLUDGE SUN NFS code  ????

--- 211,218 -----
  			delta = tick - tickdelta;
  			timedelta += tickdelta;
  		} else {
! 			delta = tick + tickdelta;
! 			timedelta -= tickdelta;
  		}
  		BUMPTIME(&time, delta);
  /* KLUDGE SUN NFS code  ????

chris@mimsy.UUCP (Chris Torek) (03/15/89)

In article <2040@pur-phy> ray@maxwell.physics.purdue.edu (Ray Moody) writes:
>  #ifdef is68k

This line is not found in 4BSD.  (Not 4.0, nor 4.1, nor 4.2, nor 4.3, nor
4.3-tahoe.)

An `index' line indicating the operating system version and, if the
system is from a vendor that repackages 4BSD, the vendor, is helpful
in avoiding confusion.

Incidentally, 4.3BSD-tahoe, at least, does not have the bug.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

ray@maxwell.physics.purdue.edu (Ray Moody) (03/16/89)

In article <2040@pur-phy> ray@maxwell.physics.purdue.edu (Ray Moody) writes:
>  #ifdef is68k

In article <16396@mimsy.UUCP>, chris@mimsy (Chris Torek) writes:
>This line is not found in 4BSD.  (Not 4.0, nor 4.1, nor 4.2, nor 4.3, nor
>4.3-tahoe.)
>
>An `index' line indicating the operating system version and, if the
>system is from a vendor that repackages 4BSD, the vendor, is helpful
>in avoiding confusion.

    This bug was in Integrated Solutions Incorporated's version of 4.3BSD.

    It has been my experience that almost every bug we have is persent in one
or more versions of Sun's UNIX, and many of our bugs are also in generic
4.3BSD.

								Ray