Subject: kern/2140: Typos in NTP support for kern_clock.c
To: None <gnats-bugs@NetBSD.ORG>
From: Simon Burge <simonb@telstra.com.au>
List: netbsd-bugs
Date: 02/28/1996 11:21:56
>Number:         2140
>Category:       kern
>Synopsis:       Typos(?) prevent kernel from building with NTP support
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 27 19:50:02 1996
>Last-Modified:
>Originator:     Simon Burge
>Organization:
	Telstra Corp.
>Release:        -current from Feb 28 (Australian Time)
>Environment:

System: NetBSD mona 1.1A NetBSD 1.1A (MONA) #0: Thu Feb 8 10:08:46 EST 1996 simonb@mona:/usr/src/sys/arch/pmax/compile/MONA pmax


>Description:
	
>How-To-Repeat:
	Add "options NTP" to your config file, and try and build a
	kernel.
>Fix:
	The logic for the all the #if's seems a little awkward,
	and certainly doesn't compile (with HZ=1024).  This diff
	works for me:

*** kern_clock.c.01	Tue Feb 27 23:26:00 1996
--- kern_clock.c	Wed Feb 28 10:53:34 1996
***************
*** 274,293 ****
   */
  #if HZ == 64 || HZ == 60 /* Precision timekeeping does not support 48 Hz */
  # define SHIFT_HZ 6		/* log2(hz) */
! #if HZ == 128 || HZ == 100  HZ == 96
  # define SHIFT_HZ 7		/* log2(hz) */
! #else
! #if HZ == 256 /* || !defined(HZ)*/
  # define SHIFT_HZ 8		/* log2(hz) (default) */
! #else
! #if HZ == 1024
  # define SHIFT_HZ 10
  #else
  #error HZ is not a supported value. Please change HZ in your kernel config file
! #endif /* 1024Hz */
! #endif /* 256Hz */
! #endif /* 128HZ or 100Hz or 96Hz*/
! #endif /* 64Hz or 60Hz or 48Hz*/
  /*
   * End of SHIFT_HZ computation
   */
--- 274,288 ----
   */
  #if HZ == 64 || HZ == 60 /* Precision timekeeping does not support 48 Hz */
  # define SHIFT_HZ 6		/* log2(hz) */
! #elif HZ == 128 || HZ == 100 || HZ == 96
  # define SHIFT_HZ 7		/* log2(hz) */
! #elif HZ == 256 /* || !defined(HZ)*/
  # define SHIFT_HZ 8		/* log2(hz) (default) */
! #elif HZ == 1024
  # define SHIFT_HZ 10
  #else
  #error HZ is not a supported value. Please change HZ in your kernel config file
! #endif
  /*
   * End of SHIFT_HZ computation
   */
>Audit-Trail:
>Unformatted: