summaryrefslogtreecommitdiff
path: root/ntpshmread.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-02-25 13:59:15 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-02-25 14:02:45 -0500
commit78eaa714b5fecb973d792f5fad746a85e6ff26af (patch)
treea5ac6ce74bfa614e24427e5380d47e01361b3019 /ntpshmread.c
parent45f2674689cf7a15c78f6774dd4bbf64c7f1ab92 (diff)
downloadgpsd-78eaa714b5fecb973d792f5fad746a85e6ff26af.tar.gz
Make ntpmon autoconfigure and do subsecond polling.
Diffstat (limited to 'ntpshmread.c')
-rw-r--r--ntpshmread.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ntpshmread.c b/ntpshmread.c
index 5854df64..710dfd33 100644
--- a/ntpshmread.c
+++ b/ntpshmread.c
@@ -18,7 +18,7 @@
#include "ntpshm.h"
-struct shmTime *shm_get(int unit, bool forall)
+struct shmTime *shm_get(const int unit, const bool create, const bool forall)
/* initialize an initial segment */
{
struct shmTime *p = NULL;
@@ -29,7 +29,7 @@ struct shmTime *shm_get(int unit, bool forall)
* as long as everybody does it the same way.
*/
shmid = shmget(NTPD_BASE + unit, sizeof(struct shmTime),
- IPC_CREAT | (forall ? 0666 : 0600));
+ (create ? IPC_CREAT : 0) | (forall ? 0666 : 0600));
if (shmid == -1) { /* error */
return NULL;
}
@@ -144,6 +144,11 @@ enum segstat_t shm_query(struct shmTime *shm_in, struct shm_stat_t *shm_stat)
}
shm->valid = 0;
+ /*
+ * leap field is not a leap offset but a leap notification code.
+ * The values are magic numbers used by NTP and set by GPSD, if at all, in
+ * the subframe code.
+ */
shm_stat->leap = shm->leap;
shm_stat->precision = shm->precision;
shm_stat->mode = OK;