Home | History | Annotate | Line # | Download | only in kern
kern_ntptime.c revision 1.29.10.3
      1  1.29.10.3  christos /*	$NetBSD: kern_ntptime.c,v 1.29.10.3 2006/05/06 23:31:30 christos Exp $	*/
      2        1.1  jonathan 
      3        1.1  jonathan /******************************************************************************
      4        1.1  jonathan  *                                                                            *
      5        1.1  jonathan  * Copyright (c) David L. Mills 1993, 1994                                    *
      6        1.1  jonathan  *                                                                            *
      7        1.1  jonathan  * Permission to use, copy, modify, and distribute this software and its      *
      8        1.1  jonathan  * documentation for any purpose and without fee is hereby granted, provided  *
      9        1.1  jonathan  * that the above copyright notice appears in all copies and that both the    *
     10        1.1  jonathan  * copyright notice and this permission notice appear in supporting           *
     11        1.1  jonathan  * documentation, and that the name University of Delaware not be used in     *
     12        1.1  jonathan  * advertising or publicity pertaining to distribution of the software        *
     13        1.1  jonathan  * without specific, written prior permission.  The University of Delaware    *
     14        1.1  jonathan  * makes no representations about the suitability this software for any       *
     15        1.1  jonathan  * purpose.  It is provided "as is" without express or implied warranty.      *
     16        1.1  jonathan  *                                                                            *
     17        1.1  jonathan  ******************************************************************************/
     18        1.1  jonathan 
     19        1.1  jonathan /*
     20        1.1  jonathan  * Modification history kern_ntptime.c
     21        1.1  jonathan  *
     22        1.1  jonathan  * 24 Sep 94	David L. Mills
     23        1.1  jonathan  *	Tightened code at exits.
     24        1.1  jonathan  *
     25        1.1  jonathan  * 24 Mar 94	David L. Mills
     26        1.1  jonathan  *	Revised syscall interface to include new variables for PPS
     27        1.1  jonathan  *	time discipline.
     28        1.1  jonathan  *
     29        1.1  jonathan  * 14 Feb 94	David L. Mills
     30        1.1  jonathan  *	Added code for external clock
     31        1.1  jonathan  *
     32        1.1  jonathan  * 28 Nov 93	David L. Mills
     33        1.1  jonathan  *	Revised frequency scaling to conform with adjusted parameters
     34        1.1  jonathan  *
     35        1.1  jonathan  * 17 Sep 93	David L. Mills
     36        1.1  jonathan  *	Created file
     37        1.1  jonathan  */
     38        1.1  jonathan /*
     39        1.1  jonathan  * ntp_gettime(), ntp_adjtime() - precision time interface for SunOS
     40        1.1  jonathan  * V4.1.1 and V4.1.3
     41        1.1  jonathan  *
     42        1.1  jonathan  * These routines consitute the Network Time Protocol (NTP) interfaces
     43        1.1  jonathan  * for user and daemon application programs. The ntp_gettime() routine
     44        1.1  jonathan  * provides the time, maximum error (synch distance) and estimated error
     45        1.1  jonathan  * (dispersion) to client user application programs. The ntp_adjtime()
     46        1.1  jonathan  * routine is used by the NTP daemon to adjust the system clock to an
     47        1.1  jonathan  * externally derived time. The time offset and related variables set by
     48        1.1  jonathan  * this routine are used by hardclock() to adjust the phase and
     49        1.1  jonathan  * frequency of the phase-lock loop which controls the system clock.
     50        1.1  jonathan  */
     51       1.16     lukem 
     52       1.16     lukem #include <sys/cdefs.h>
     53  1.29.10.3  christos __KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.29.10.3 2006/05/06 23:31:30 christos Exp $");
     54       1.16     lukem 
     55        1.6  jonathan #include "opt_ntp.h"
     56        1.6  jonathan 
     57        1.1  jonathan #include <sys/param.h>
     58        1.1  jonathan #include <sys/resourcevar.h>
     59        1.1  jonathan #include <sys/systm.h>
     60        1.1  jonathan #include <sys/kernel.h>
     61        1.1  jonathan #include <sys/proc.h>
     62       1.18    simonb #include <sys/sysctl.h>
     63        1.1  jonathan #include <sys/timex.h>
     64        1.1  jonathan #include <sys/vnode.h>
     65  1.29.10.3  christos #include <sys/kauth.h>
     66        1.1  jonathan 
     67        1.1  jonathan #include <sys/mount.h>
     68       1.22   thorpej #include <sys/sa.h>
     69        1.1  jonathan #include <sys/syscallargs.h>
     70        1.1  jonathan 
     71        1.1  jonathan #include <machine/cpu.h>
     72        1.2  christos 
     73        1.4   thorpej #ifdef NTP
     74        1.1  jonathan /*
     75        1.1  jonathan  * The following variables are used by the hardclock() routine in the
     76       1.28     perry  * kern_clock.c module and are described in that module.
     77        1.1  jonathan  */
     78        1.1  jonathan extern int time_state;		/* clock state */
     79        1.1  jonathan extern int time_status;		/* clock status bits */
     80        1.1  jonathan extern long time_offset;	/* time adjustment (us) */
     81        1.1  jonathan extern long time_freq;		/* frequency offset (scaled ppm) */
     82        1.1  jonathan extern long time_maxerror;	/* maximum error (us) */
     83        1.1  jonathan extern long time_esterror;	/* estimated error (us) */
     84        1.1  jonathan extern long time_constant;	/* pll time constant */
     85        1.1  jonathan extern long time_precision;	/* clock precision (us) */
     86        1.1  jonathan extern long time_tolerance;	/* frequency tolerance (scaled ppm) */
     87       1.24  drochner extern int time_adjusted;	/* ntp might have changed the system time */
     88        1.1  jonathan 
     89        1.1  jonathan #ifdef PPS_SYNC
     90        1.1  jonathan /*
     91        1.1  jonathan  * The following variables are used only if the PPS signal discipline
     92        1.1  jonathan  * is configured in the kernel.
     93        1.1  jonathan  */
     94        1.1  jonathan extern int pps_shift;		/* interval duration (s) (shift) */
     95        1.1  jonathan extern long pps_freq;		/* pps frequency offset (scaled ppm) */
     96        1.1  jonathan extern long pps_jitter;		/* pps jitter (us) */
     97        1.1  jonathan extern long pps_stabil;		/* pps stability (scaled ppm) */
     98        1.1  jonathan extern long pps_jitcnt;		/* jitter limit exceeded */
     99        1.1  jonathan extern long pps_calcnt;		/* calibration intervals */
    100        1.1  jonathan extern long pps_errcnt;		/* calibration errors */
    101        1.1  jonathan extern long pps_stbcnt;		/* stability limit exceeded */
    102        1.1  jonathan #endif /* PPS_SYNC */
    103        1.1  jonathan 
    104        1.1  jonathan /*ARGSUSED*/
    105        1.1  jonathan /*
    106        1.1  jonathan  * ntp_gettime() - NTP user application interface
    107        1.1  jonathan  */
    108        1.1  jonathan int
    109       1.22   thorpej sys_ntp_gettime(l, v, retval)
    110       1.22   thorpej 	struct lwp *l;
    111        1.1  jonathan 	void *v;
    112        1.1  jonathan 	register_t *retval;
    113        1.1  jonathan 
    114        1.1  jonathan {
    115        1.3   thorpej 	struct sys_ntp_gettime_args /* {
    116        1.5       cgd 		syscallarg(struct ntptimeval *) ntvp;
    117        1.1  jonathan 	} */ *uap = v;
    118        1.1  jonathan 	struct timeval atv;
    119        1.1  jonathan 	struct ntptimeval ntv;
    120        1.1  jonathan 	int error = 0;
    121        1.1  jonathan 	int s;
    122        1.1  jonathan 
    123        1.5       cgd 	if (SCARG(uap, ntvp)) {
    124        1.1  jonathan 		s = splclock();
    125        1.1  jonathan #ifdef EXT_CLOCK
    126        1.1  jonathan 		/*
    127        1.1  jonathan 		 * The microtime() external clock routine returns a
    128        1.1  jonathan 		 * status code. If less than zero, we declare an error
    129        1.1  jonathan 		 * in the clock status word and return the kernel
    130        1.1  jonathan 		 * (software) time variable. While there are other
    131        1.1  jonathan 		 * places that call microtime(), this is the only place
    132        1.1  jonathan 		 * that matters from an application point of view.
    133        1.1  jonathan 		 */
    134        1.1  jonathan 		if (microtime(&atv) < 0) {
    135        1.1  jonathan 			time_status |= STA_CLOCKERR;
    136        1.1  jonathan 			ntv.time = time;
    137        1.1  jonathan 		} else
    138        1.1  jonathan 			time_status &= ~STA_CLOCKERR;
    139        1.1  jonathan #else /* EXT_CLOCK */
    140        1.1  jonathan 		microtime(&atv);
    141        1.1  jonathan #endif /* EXT_CLOCK */
    142        1.1  jonathan 		ntv.time = atv;
    143        1.1  jonathan 		ntv.maxerror = time_maxerror;
    144        1.1  jonathan 		ntv.esterror = time_esterror;
    145        1.1  jonathan 		(void) splx(s);
    146        1.1  jonathan 
    147        1.5       cgd 		error = copyout((caddr_t)&ntv, (caddr_t)SCARG(uap, ntvp),
    148        1.7     perry 		    sizeof(ntv));
    149        1.1  jonathan 	}
    150        1.1  jonathan 	if (!error) {
    151        1.1  jonathan 
    152        1.1  jonathan 		/*
    153        1.1  jonathan 		 * Status word error decode. If any of these conditions
    154        1.1  jonathan 		 * occur, an error is returned, instead of the status
    155        1.1  jonathan 		 * word. Most applications will care only about the fact
    156        1.1  jonathan 		 * the system clock may not be trusted, not about the
    157        1.1  jonathan 		 * details.
    158        1.1  jonathan 		 *
    159        1.1  jonathan 		 * Hardware or software error
    160        1.1  jonathan 		 */
    161        1.1  jonathan 		if ((time_status & (STA_UNSYNC | STA_CLOCKERR)) ||
    162        1.1  jonathan 
    163        1.1  jonathan 		/*
    164        1.1  jonathan 		 * PPS signal lost when either time or frequency
    165        1.1  jonathan 		 * synchronization requested
    166        1.1  jonathan 		 */
    167        1.1  jonathan 		    (time_status & (STA_PPSFREQ | STA_PPSTIME) &&
    168        1.1  jonathan 		    !(time_status & STA_PPSSIGNAL)) ||
    169        1.1  jonathan 
    170        1.1  jonathan 		/*
    171        1.1  jonathan 		 * PPS jitter exceeded when time synchronization
    172        1.1  jonathan 		 * requested
    173        1.1  jonathan 		 */
    174        1.1  jonathan 		    (time_status & STA_PPSTIME &&
    175        1.1  jonathan 		    time_status & STA_PPSJITTER) ||
    176        1.1  jonathan 
    177        1.1  jonathan 		/*
    178        1.1  jonathan 		 * PPS wander exceeded or calibration error when
    179        1.1  jonathan 		 * frequency synchronization requested
    180        1.1  jonathan 		 */
    181        1.1  jonathan 		    (time_status & STA_PPSFREQ &&
    182        1.1  jonathan 		    time_status & (STA_PPSWANDER | STA_PPSERROR)))
    183        1.1  jonathan 			*retval = TIME_ERROR;
    184        1.1  jonathan 		else
    185        1.1  jonathan 			*retval = (register_t)time_state;
    186        1.1  jonathan 	}
    187        1.1  jonathan 	return(error);
    188        1.1  jonathan }
    189        1.1  jonathan 
    190        1.1  jonathan /* ARGSUSED */
    191        1.1  jonathan /*
    192        1.1  jonathan  * ntp_adjtime() - NTP daemon application interface
    193        1.1  jonathan  */
    194        1.1  jonathan int
    195       1.22   thorpej sys_ntp_adjtime(l, v, retval)
    196       1.22   thorpej 	struct lwp *l;
    197        1.1  jonathan 	void *v;
    198        1.1  jonathan 	register_t *retval;
    199        1.1  jonathan {
    200        1.3   thorpej 	struct sys_ntp_adjtime_args /* {
    201        1.1  jonathan 		syscallarg(struct timex *) tp;
    202        1.1  jonathan 	} */ *uap = v;
    203       1.22   thorpej 	struct proc *p = l->l_proc;
    204        1.1  jonathan 	struct timex ntv;
    205        1.1  jonathan 	int error = 0;
    206        1.1  jonathan 
    207        1.1  jonathan 	if ((error = copyin((caddr_t)SCARG(uap, tp), (caddr_t)&ntv,
    208       1.14      manu 			sizeof(ntv))) != 0)
    209       1.14      manu 		return (error);
    210       1.14      manu 
    211  1.29.10.2      elad 	if (ntv.modes != 0 && (error = kauth_authorize_generic(p->p_cred,
    212  1.29.10.1      elad 				KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0)
    213        1.1  jonathan 		return (error);
    214        1.1  jonathan 
    215       1.21       eeh 	return (ntp_adjtime1(&ntv, v, retval));
    216       1.14      manu }
    217       1.14      manu 
    218       1.14      manu int
    219       1.15       jmc ntp_adjtime1(ntv, v, retval)
    220       1.14      manu 	struct timex *ntv;
    221       1.15       jmc 	void *v;
    222       1.14      manu 	register_t	*retval;
    223       1.14      manu {
    224       1.21       eeh 	struct sys_ntp_adjtime_args /* {
    225       1.21       eeh 		syscallarg(struct timex *) tp;
    226       1.21       eeh 	} */ *uap = v;
    227       1.14      manu 	int error = 0;
    228       1.14      manu 	int modes;
    229       1.14      manu 	int s;
    230       1.14      manu 
    231        1.1  jonathan 	/*
    232       1.28     perry 	 * Update selected clock variables. Note that there is no error
    233       1.28     perry 	 * checking here on the assumption the superuser should know
    234       1.14      manu 	 * what it is doing.
    235        1.1  jonathan 	 */
    236       1.15       jmc 	modes = ntv->modes;
    237       1.23       dsl 	if (modes != 0)
    238       1.23       dsl 		/* We need to save the system time during shutdown */
    239       1.23       dsl 		time_adjusted |= 2;
    240        1.1  jonathan 	s = splclock();
    241        1.1  jonathan 	if (modes & MOD_FREQUENCY)
    242        1.1  jonathan #ifdef PPS_SYNC
    243       1.15       jmc 		time_freq = ntv->freq - pps_freq;
    244        1.1  jonathan #else /* PPS_SYNC */
    245       1.15       jmc 		time_freq = ntv->freq;
    246        1.1  jonathan #endif /* PPS_SYNC */
    247        1.1  jonathan 	if (modes & MOD_MAXERROR)
    248       1.15       jmc 		time_maxerror = ntv->maxerror;
    249        1.1  jonathan 	if (modes & MOD_ESTERROR)
    250       1.15       jmc 		time_esterror = ntv->esterror;
    251        1.1  jonathan 	if (modes & MOD_STATUS) {
    252        1.1  jonathan 		time_status &= STA_RONLY;
    253       1.15       jmc 		time_status |= ntv->status & ~STA_RONLY;
    254        1.1  jonathan 	}
    255        1.1  jonathan 	if (modes & MOD_TIMECONST)
    256       1.15       jmc 		time_constant = ntv->constant;
    257        1.1  jonathan 	if (modes & MOD_OFFSET)
    258       1.15       jmc 		hardupdate(ntv->offset);
    259        1.1  jonathan 
    260        1.1  jonathan 	/*
    261        1.1  jonathan 	 * Retrieve all clock variables
    262        1.1  jonathan 	 */
    263        1.1  jonathan 	if (time_offset < 0)
    264       1.15       jmc 		ntv->offset = -(-time_offset >> SHIFT_UPDATE);
    265        1.1  jonathan 	else
    266       1.15       jmc 		ntv->offset = time_offset >> SHIFT_UPDATE;
    267        1.1  jonathan #ifdef PPS_SYNC
    268       1.15       jmc 	ntv->freq = time_freq + pps_freq;
    269        1.1  jonathan #else /* PPS_SYNC */
    270       1.15       jmc 	ntv->freq = time_freq;
    271        1.1  jonathan #endif /* PPS_SYNC */
    272       1.15       jmc 	ntv->maxerror = time_maxerror;
    273       1.15       jmc 	ntv->esterror = time_esterror;
    274       1.15       jmc 	ntv->status = time_status;
    275       1.15       jmc 	ntv->constant = time_constant;
    276       1.15       jmc 	ntv->precision = time_precision;
    277       1.15       jmc 	ntv->tolerance = time_tolerance;
    278        1.1  jonathan #ifdef PPS_SYNC
    279       1.15       jmc 	ntv->shift = pps_shift;
    280       1.15       jmc 	ntv->ppsfreq = pps_freq;
    281       1.15       jmc 	ntv->jitter = pps_jitter >> PPS_AVG;
    282       1.15       jmc 	ntv->stabil = pps_stabil;
    283       1.15       jmc 	ntv->calcnt = pps_calcnt;
    284       1.15       jmc 	ntv->errcnt = pps_errcnt;
    285       1.15       jmc 	ntv->jitcnt = pps_jitcnt;
    286       1.15       jmc 	ntv->stbcnt = pps_stbcnt;
    287        1.1  jonathan #endif /* PPS_SYNC */
    288        1.1  jonathan 	(void)splx(s);
    289        1.1  jonathan 
    290       1.21       eeh 	error = copyout((caddr_t)ntv, (caddr_t)SCARG(uap, tp), sizeof(*ntv));
    291        1.1  jonathan 	if (!error) {
    292        1.1  jonathan 
    293        1.1  jonathan 		/*
    294        1.1  jonathan 		 * Status word error decode. See comments in
    295        1.1  jonathan 		 * ntp_gettime() routine.
    296        1.1  jonathan 		 */
    297        1.1  jonathan 		if ((time_status & (STA_UNSYNC | STA_CLOCKERR)) ||
    298        1.1  jonathan 		    (time_status & (STA_PPSFREQ | STA_PPSTIME) &&
    299        1.1  jonathan 		    !(time_status & STA_PPSSIGNAL)) ||
    300        1.1  jonathan 		    (time_status & STA_PPSTIME &&
    301        1.1  jonathan 		    time_status & STA_PPSJITTER) ||
    302        1.1  jonathan 		    (time_status & STA_PPSFREQ &&
    303        1.1  jonathan 		    time_status & (STA_PPSWANDER | STA_PPSERROR)))
    304        1.1  jonathan 			*retval = TIME_ERROR;
    305        1.1  jonathan 		else
    306        1.1  jonathan 			*retval = (register_t)time_state;
    307        1.1  jonathan 	}
    308        1.1  jonathan 	return error;
    309        1.1  jonathan }
    310        1.1  jonathan 
    311        1.1  jonathan /*
    312        1.1  jonathan  * return information about kernel precision timekeeping
    313        1.1  jonathan  */
    314       1.25    atatat static int
    315       1.25    atatat sysctl_kern_ntptime(SYSCTLFN_ARGS)
    316        1.1  jonathan {
    317       1.25    atatat 	struct sysctlnode node;
    318        1.1  jonathan 	struct timeval atv;
    319        1.1  jonathan 	struct ntptimeval ntv;
    320        1.1  jonathan 	int s;
    321        1.1  jonathan 
    322        1.1  jonathan 	/*
    323        1.1  jonathan 	 * Construct ntp_timeval.
    324        1.1  jonathan 	 */
    325        1.1  jonathan 
    326        1.1  jonathan 	s = splclock();
    327        1.1  jonathan #ifdef EXT_CLOCK
    328        1.1  jonathan 	/*
    329        1.1  jonathan 	 * The microtime() external clock routine returns a
    330        1.1  jonathan 	 * status code. If less than zero, we declare an error
    331        1.1  jonathan 	 * in the clock status word and return the kernel
    332        1.1  jonathan 	 * (software) time variable. While there are other
    333        1.1  jonathan 	 * places that call microtime(), this is the only place
    334        1.1  jonathan 	 * that matters from an application point of view.
    335        1.1  jonathan 	 */
    336        1.1  jonathan 	if (microtime(&atv) < 0) {
    337        1.1  jonathan 		time_status |= STA_CLOCKERR;
    338        1.1  jonathan 		ntv.time = time;
    339        1.1  jonathan 	} else {
    340        1.1  jonathan 		time_status &= ~STA_CLOCKERR;
    341        1.1  jonathan 	}
    342        1.1  jonathan #else /* EXT_CLOCK */
    343        1.1  jonathan 	microtime(&atv);
    344        1.1  jonathan #endif /* EXT_CLOCK */
    345        1.1  jonathan 	ntv.time = atv;
    346        1.1  jonathan 	ntv.maxerror = time_maxerror;
    347        1.1  jonathan 	ntv.esterror = time_esterror;
    348        1.1  jonathan 	splx(s);
    349        1.1  jonathan 
    350        1.1  jonathan #ifdef notyet
    351        1.1  jonathan 	/*
    352        1.1  jonathan 	 * Status word error decode. If any of these conditions
    353        1.1  jonathan 	 * occur, an error is returned, instead of the status
    354        1.1  jonathan 	 * word. Most applications will care only about the fact
    355        1.1  jonathan 	 * the system clock may not be trusted, not about the
    356        1.1  jonathan 	 * details.
    357        1.1  jonathan 	 *
    358        1.1  jonathan 	 * Hardware or software error
    359        1.1  jonathan 	 */
    360        1.1  jonathan 	if ((time_status & (STA_UNSYNC | STA_CLOCKERR)) ||
    361        1.1  jonathan 		ntv.time_state = TIME_ERROR;
    362        1.1  jonathan 
    363        1.1  jonathan 	/*
    364        1.1  jonathan 	 * PPS signal lost when either time or frequency
    365        1.1  jonathan 	 * synchronization requested
    366        1.1  jonathan 	 */
    367        1.1  jonathan 	   (time_status & (STA_PPSFREQ | STA_PPSTIME) &&
    368        1.1  jonathan 	    !(time_status & STA_PPSSIGNAL)) ||
    369        1.1  jonathan 
    370        1.1  jonathan 	/*
    371        1.1  jonathan 	 * PPS jitter exceeded when time synchronization
    372        1.1  jonathan 	 * requested
    373        1.1  jonathan 	 */
    374        1.1  jonathan 	   (time_status & STA_PPSTIME &&
    375        1.1  jonathan 	    time_status & STA_PPSJITTER) ||
    376        1.1  jonathan 
    377        1.1  jonathan 	/*
    378        1.1  jonathan 	 * PPS wander exceeded or calibration error when
    379        1.1  jonathan 	 * frequency synchronization requested
    380        1.1  jonathan 	 */
    381        1.1  jonathan 	   (time_status & STA_PPSFREQ &&
    382        1.1  jonathan 	    time_status & (STA_PPSWANDER | STA_PPSERROR)))
    383        1.1  jonathan 		ntv.time_state = TIME_ERROR;
    384        1.1  jonathan 	else
    385        1.1  jonathan 		ntv.time_state = time_state;
    386        1.1  jonathan #endif /* notyet */
    387       1.25    atatat 
    388       1.25    atatat 	node = *rnode;
    389       1.25    atatat 	node.sysctl_data = &ntv;
    390       1.25    atatat 	node.sysctl_size = sizeof(ntv);
    391       1.25    atatat 	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
    392       1.25    atatat }
    393       1.25    atatat 
    394       1.25    atatat SYSCTL_SETUP(sysctl_kern_ntptime_setup, "sysctl kern.ntptime node setup")
    395       1.25    atatat {
    396       1.25    atatat 
    397       1.26    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    398       1.26    atatat 		       CTLFLAG_PERMANENT,
    399       1.25    atatat 		       CTLTYPE_NODE, "kern", NULL,
    400       1.25    atatat 		       NULL, 0, NULL, 0,
    401       1.25    atatat 		       CTL_KERN, CTL_EOL);
    402       1.25    atatat 
    403       1.26    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    404       1.26    atatat 		       CTLFLAG_PERMANENT,
    405       1.27    atatat 		       CTLTYPE_STRUCT, "ntptime",
    406       1.27    atatat 		       SYSCTL_DESCR("Kernel clock values for NTP"),
    407       1.25    atatat 		       sysctl_kern_ntptime, 0, NULL,
    408       1.25    atatat 		       sizeof(struct ntptimeval),
    409       1.25    atatat 		       CTL_KERN, KERN_NTPTIME, CTL_EOL);
    410        1.1  jonathan }
    411        1.4   thorpej #else /* !NTP */
    412       1.13     bjh21 /* For some reason, raising SIGSYS (as sys_nosys would) is problematic. */
    413       1.13     bjh21 
    414        1.4   thorpej int
    415       1.22   thorpej sys_ntp_gettime(l, v, retval)
    416       1.22   thorpej 	struct lwp *l;
    417        1.4   thorpej 	void *v;
    418        1.4   thorpej 	register_t *retval;
    419        1.4   thorpej {
    420       1.19    simonb 
    421        1.4   thorpej 	return(ENOSYS);
    422        1.4   thorpej }
    423       1.13     bjh21 #endif /* !NTP */
    424