summaryrefslogtreecommitdiff
path: root/gpsmon.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-07 01:57:32 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-03-07 01:57:32 -0500
commite92b21041e00778c72362620ad9d62ffa94613db (patch)
tree2871a2dda9955daabb8efab913cd3b13684cb8f8 /gpsmon.c
parent02c9c43a3aaaf73f84fdf9fbc96e9a32e546d273 (diff)
downloadgpsd-e92b21041e00778c72362620ad9d62ffa94613db.tar.gz
Another step in prying ntplib loose. Partly decouple ppsthread.c fom sessions.
All regression tests pass.
Diffstat (limited to 'gpsmon.c')
-rw-r--r--gpsmon.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gpsmon.c b/gpsmon.c
index 04739324..e951b6b4 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -249,7 +249,19 @@ void pps_update(WINDOW *win, int y, int x)
/*@-type -noeffect@*/ /* splint is confused about struct timespec */
struct timedelta_t ppstimes;
- if (pps_thread_lastpps(&session, &ppstimes) > 0) {
+ int status = pps_thread_lastpps(&session.pps_state, &ppstimes);
+
+ if (status == PPS_LOCK_ERR) {
+ char errbuf[BUFSIZ] = "unknown error";
+ (void)strerror_r(errno, errbuf,(int) sizeof(errbuf));
+ gpsd_report(&session.context->errout, LOG_ERROR,
+ "PPS: pthread_mutex_unlock() : %s\n", errbuf);
+ } else if (status == PPS_LOCK_ERR) {
+ char errbuf[BUFSIZ] = "unknown error";
+ (void)strerror_r(errno, errbuf,(int) sizeof(errbuf));
+ gpsd_report(&session.context->errout, LOG_ERROR,
+ "PPS: pthread_mutex_lock() : %s\n", errbuf);
+ } else {
/* NOTE: can not use double here due to precision requirements */
struct timespec timedelta;
(void)wmove(win, y, x);
@@ -790,9 +802,9 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED)
"------------------- PPS offset: %.20s ------\n ",
timedelta_str);
/* coverity[missing_lock] */
- session.ppslast = noclobber.pps;
+ session.pps_state.ppslast = noclobber.pps;
/* coverity[missing_lock] */
- session.ppscount++;
+ session.pps_state.ppscount++;
}
}
else