diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-11-02 09:58:21 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-11-02 09:58:21 -0400 |
commit | 4b7ffe96ba0adce4a6d9746f0c548d75476d09aa (patch) | |
tree | 24e3bd63bd75057d7b9e014cd1fe7cfffd8dd281 /ntpshm.c | |
parent | ffae809ddecd0fb885f6b15407895d5b3072b1c1 (diff) | |
download | gpsd-4b7ffe96ba0adce4a6d9746f0c548d75476d09aa.tar.gz |
Finish decoupling the PPS watcher code from NTP shared-segment management.
Also, further contain the latter.
Diffstat (limited to 'ntpshm.c')
-rw-r--r-- | ntpshm.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -128,7 +128,7 @@ static /*@null@*/ volatile struct shmTime *getShmTime(struct gps_context_t *cont /* * Note: this call requires root under BSD, and possibly on - * well-secured Linux systems. This is why ntpshm_init() has to be + * well-secured Linux systems. This is why ntpshm_context_init() has to be * called before privilege-dropping. */ shmid = shmget((key_t) (NTPD_BASE + unit), @@ -155,7 +155,7 @@ static /*@null@*/ volatile struct shmTime *getShmTime(struct gps_context_t *cont /*@ +mustfreefresh */ } -void ntpshm_init(struct gps_context_t *context) +void ntpshm_context_init(struct gps_context_t *context) /* Attach all NTP SHM segments. Called once at startup, while still root. */ { int i; @@ -209,6 +209,17 @@ static bool ntpshm_free(struct gps_context_t * context, int segment) return true; } +void ntpshm_session_init(struct gps_device_t *session) +{ +#ifdef NTPSHM_ENABLE + /* mark NTPD shared memory segments as unused */ + session->shmindex = -1; +#endif /* NTPSHM_ENABLE */ +#ifdef PPS_ENABLE + session->shmTimeP = -1; +#endif /* PPS_ENABLE */ +} + int ntpshm_put(struct gps_device_t *session, double fixtime, double fudge) /* put a received fix time into shared memory for NTP */ { |