Subject: NTP inclusion change?
To: None <tech-kern@netbsd.org>
From: Ben Harris <bjh21@cam.ac.uk>
List: tech-kern
Date: 07/31/2000 11:33:41
I'd like some opinions on the following proposed change, which isn't quite
in my field.

The purpose of this change is to get rid of the stub kern_ntptime.o that's
built if you don't turn on "options NTP", since it appears to be
redundant.  The only semantic change here should be that processes calling
ntp_gettime() will now get a SIGSYS in addition to its returning ENOSYS.  
As far as I can see, sysctl_ntptime() isn't used unless NTP is defined
anyway, so losing that is safe.

Comments?

[ I've excluded the files that just change as a consequence of changing
  syscalls.master ]

Index: sys/conf/files
===================================================================
RCS file: /cvsroot/syssrc/sys/conf/files,v
retrieving revision 1.378
diff -u -r1.378 files
--- files	2000/07/25 22:41:58	1.378
+++ files	2000/07/30 13:03:30
@@ -695,7 +695,7 @@
 file kern/kern_lkm.c			lkm
 file kern/kern_lock.c
 file kern/kern_malloc.c
-file kern/kern_ntptime.c
+file kern/kern_ntptime.c		ntp
 file kern/kern_physio.c
 file kern/kern_proc.c
 file kern/kern_prot.c
Index: sys/kern/syscalls.master
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/syscalls.master,v
retrieving revision 1.101
diff -u -r1.101 syscalls.master
--- syscalls.master	2000/04/21 16:15:39	1.101
+++ syscalls.master	2000/07/30 13:03:29
@@ -36,6 +36,7 @@
 
 #include "opt_ktrace.h"
 #include "opt_nfsserver.h"
+#include "opt_ntp.h"
 #include "opt_compat_netbsd.h"
 #include "opt_sysv.h"
 #include "opt_compat_43.h"
@@ -339,8 +340,13 @@
 			    size_t nbyte, int pad, off_t offset); }
 174	STD		{ ssize_t sys_pwrite(int fd, const void *buf, \
 			    size_t nbyte, int pad, off_t offset); }
+#if defined(NTP) || !defined(_KERNEL)
 175	STD		{ int sys_ntp_gettime(struct ntptimeval *ntvp); }
 176	STD		{ int sys_ntp_adjtime(struct timex *tp); }
+#else
+175	EXCL		ntp_gettime
+176	EXCL		ntp_adjtime
+#endif
 177	UNIMPL
 178	UNIMPL
 179	UNIMPL
Index: sys/kern/kern_ntptime.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/kern_ntptime.c,v
retrieving revision 1.12
diff -u -r1.12 kern_ntptime.c
--- kern_ntptime.c	2000/06/27 17:41:23	1.12
+++ kern_ntptime.c	2000/07/30 13:03:29
@@ -66,8 +66,6 @@
 #include <uvm/uvm_extern.h>
 #include <sys/sysctl.h>
 
-#ifdef NTP
-
 /*
  * The following variables are used by the hardclock() routine in the
  * kern_clock.c module and are described in that module. 
@@ -370,40 +368,3 @@
 	return (sysctl_rdstruct(where, sizep, NULL, &ntv, sizeof(ntv)));
 }
 
-#else /* !NTP */
-
-/*
- * For kernels configured without the NTP option, emulate the behavior
- * of a kernel with no NTP support (i.e., sys_nosys()). On systems
- * where kernel  NTP support appears present when xntpd is compiled,
- * (e.g., sys/timex.h is present),  xntpd relies on getting a SIGSYS
- * signal in response to an ntp_adjtime() syscal, to inform xntpd that
- * NTP support is not really present, and xntpd should fall back to
- * using a user-level phase-locked loop to discipline the clock.
- */
-int
-sys_ntp_gettime(p, v, retval)
-	struct proc *p;
-	void *v;
-	register_t *retval;
-{
-	return(ENOSYS);
-}
-
-int
-sys_ntp_adjtime(p, v, retval)
-	struct proc *p;
-	void *v;
-	register_t *retval;
-{
-	return(sys_nosys(p, v, retval));
-}
-
-int
-sysctl_ntptime(where, sizep)
-	void *where;
-	size_t *sizep;
-{
-	return (ENOSYS);
-}
-#endif /* NTP */

Brought to you bythe campaign to make NetBSD boot in four megabytes.

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/arm26               <URL:http://www.netbsd.org/Ports/arm26/>