diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-10-30 12:32:12 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-10-30 12:39:26 -0400 |
commit | d9b8758935f902fb0ea77fee09e9627e09462a11 (patch) | |
tree | d6dbb060ce2162abe50b6dcada9b23c0a80ad63d /gpsd.c | |
parent | 7a5a25946be3db4bd8c08d1a5b126f43131144eb (diff) | |
download | gpsd-d9b8758935f902fb0ea77fee09e9627e09462a11.tar.gz |
Separate ntpd support from chrony support, step 1.
ntp_offset becomes time_offset. There is a new config symbol CHRONY_ENABLE;
most time service code is npw controlled by TIMESERVICE_ENABLE. The
file ntpshm.c becomes timeexport.c
This change is not complete. More disentanglement has to be done inside
timeexport.c itself; at the moment enabling one but not both of
ntpshm or chrony will probably break its compile. The point of getting
this commit out is so Gary will see the new baseline code ASAP.
All regression tests pass.
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -223,6 +223,9 @@ static void typelist(void) #if defined(NTPSHM_ENABLE) (void)printf("# NTPSHM for NTPd enabled.\n"); #endif +#if defined(CHRONY_ENABLE) + (void)printf("# Chrony support enabled.\n"); +#endif #if defined(PPS_ENABLE) (void)printf("# PPS enabled.\n"); #endif @@ -663,9 +666,9 @@ static void deactivate_device(struct gps_device_t *device) adjust_max_fd(device->gpsdata.gps_fd, false); #if defined(PPS_ENABLE) && defined(TIOCMIWAIT) #endif /* defined(PPS_ENABLE) && defined(TIOCMIWAIT) */ -#ifdef NTPSHM_ENABLE +#ifdef TIMESERVICE_ENABLE ntpd_link_deactivate(device); -#endif /* NTPSHM_ENABLE */ +#endif /* TIMESERVICE_ENABLE */ gpsd_deactivate(device); } } @@ -717,7 +720,7 @@ bool gpsd_add_device(const char *device_name, bool flag_nowait) for (devp = devices; devp < devices + MAXDEVICES; devp++) if (!allocated_device(devp)) { gpsd_init(devp, &context, device_name); -#ifdef NTPSHM_ENABLE +#ifdef TIMESERVICE_ENABLE /* * Now is the right time to grab the shared memory segment(s) * to communicate the navigation message derived and (possibly) @@ -732,7 +735,7 @@ bool gpsd_add_device(const char *device_name, bool flag_nowait) "NTPD ntpd_link_activate: %d\n", (int)devp->shmindex >= 0); -#endif /* NTPSHM_ENABLE */ +#endif /* TIMESERVICE_ENABLE */ gpsd_report(context.debug, LOG_INF, "stashing device %s at slot %d\n", device_name, (int)(devp - devices)); @@ -1508,7 +1511,7 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed) } -#ifdef NTPSHM_ENABLE +#ifdef TIMESERVICE_ENABLE /* * Time is eligible for shipping to NTPD if the driver has * asserted PPSTIME_IS at any point in the current cycle. @@ -1536,14 +1539,14 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed) //gpsd_report(context.debug, LOG_PROG, "NTP: Got one\n"); /* assume zero when there's no offset method */ if (device->device_type == NULL - || device->device_type->ntp_offset == NULL) + || device->device_type->time_offset == NULL) offset = 0.0; else - offset = device->device_type->ntp_offset(device); + offset = device->device_type->time_offset(device); (void)ntpshm_put(device, device->newdata.time, offset); device->last_fixtime = device->newdata.time; } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMESERVICE_ENABLE */ /* * If no reliable end of cycle, must report every time @@ -1946,7 +1949,7 @@ int main(int argc, char *argv[]) gpsd_report(context.debug, LOG_INF, "listening on port %s\n", gpsd_service); #endif /* SOCKET_EXPORT_ENABLE */ -#ifdef NTPSHM_ENABLE +#ifdef TIMESERVICE_ENABLE if (getuid() == 0) { errno = 0; // nice() can ONLY succeed when run as root! @@ -1960,7 +1963,7 @@ int main(int argc, char *argv[]) * to use segments 0 and 1. */ (void)ntpshm_init(&context); -#endif /* NTPSHM_ENABLE */ +#endif /* TIMESERVICE_ENABLE */ #if defined(DBUS_EXPORT_ENABLE) && !defined(S_SPLINT_S) /* we need to connect to dbus as root */ |