summaryrefslogtreecommitdiff
path: root/timehint.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-07 11:51:15 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-03-07 11:51:15 -0500
commitdf34a3add8df382eb852a67635c6859ee8cc657f (patch)
treec52183ba41403d093ad1ac971fa45c4ba1289f0c /timehint.c
parent9c49083f2afe799343a610912b0ed404b2ffad05 (diff)
downloadgpsd-df34a3add8df382eb852a67635c6859ee8cc657f.tar.gz
gpsd-report() -> gpsd_log()
This change is done so we can add a "log" hook to the pps_thread_t structure (this is not done yet) and harmonize with the name of the outer logging function. If that name had been left as gpsd_report() there would have been scope for bad confusion with the report_hook member. Also, remove two stray duplicative printf calls from the NMEA2000 driver (drivers shouldn't have printfs!) and fix one typo. This is a step towards factoring out ntplib. For that to happen, the PPS thread code needs to be decoupled from the core session structure. No logic changes. Object compatibility preserved. All regression tests pass.
Diffstat (limited to 'timehint.c')
-rw-r--r--timehint.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/timehint.c b/timehint.c
index d5d0ab5c..16788df2 100644
--- a/timehint.c
+++ b/timehint.c
@@ -130,23 +130,23 @@ static /*@null@*/ volatile struct shmTime *getShmTime(struct gps_context_t *cont
shmid = shmget((key_t) (NTPD_BASE + unit),
sizeof(struct shmTime), (int)(IPC_CREAT | perms));
if (shmid == -1) {
- gpsd_report(&context->errout, LOG_ERROR,
- "NTPD shmget(%ld, %zd, %o) fail: %s\n",
- (long int)(NTPD_BASE + unit), sizeof(struct shmTime),
- (int)perms, strerror(errno));
+ gpsd_log(&context->errout, LOG_ERROR,
+ "NTPD shmget(%ld, %zd, %o) fail: %s\n",
+ (long int)(NTPD_BASE + unit), sizeof(struct shmTime),
+ (int)perms, strerror(errno));
return NULL;
}
p = (struct shmTime *)shmat(shmid, 0, 0);
/*@ -mustfreefresh */
if ((int)(long)p == -1) {
- gpsd_report(&context->errout, LOG_ERROR,
- "NTPD shmat failed: %s\n",
- strerror(errno));
+ gpsd_log(&context->errout, LOG_ERROR,
+ "NTPD shmat failed: %s\n",
+ strerror(errno));
return NULL;
}
- gpsd_report(&context->errout, LOG_PROG,
- "NTPD shmat(%d,0,0) succeeded, segment %d\n",
- shmid, unit);
+ gpsd_log(&context->errout, LOG_PROG,
+ "NTPD shmat(%d,0,0) succeeded, segment %d\n",
+ shmid, unit);
return p;
/*@ +mustfreefresh */
}
@@ -233,7 +233,7 @@ int ntpshm_put(struct gps_device_t *session, volatile struct shmTime *shmseg, st
int precision = -1; /* default precision */
if (shmseg == NULL) {
- gpsd_report(&session->context->errout, LOG_RAW, "NTPD missing shm\n");
+ gpsd_log(&session->context->errout, LOG_RAW, "NTPD missing shm\n");
return 0;
}
@@ -249,11 +249,11 @@ int ntpshm_put(struct gps_device_t *session, volatile struct shmTime *shmseg, st
/*@-type@*/ /* splint is confused about struct timespec */
timespec_str( &td->real, real_str, sizeof(real_str) );
timespec_str( &td->clock, clock_str, sizeof(clock_str) );
- gpsd_report(&session->context->errout, LOG_RAW,
- "NTP ntpshm_put(%s %s) %s @ %s\n",
- session->gpsdata.dev.path,
- (precision == -20) ? "pps" : "clock",
- real_str, clock_str);
+ gpsd_log(&session->context->errout, LOG_RAW,
+ "NTP ntpshm_put(%s %s) %s @ %s\n",
+ session->gpsdata.dev.path,
+ (precision == -20) ? "pps" : "clock",
+ real_str, clock_str);
/*@+type@*/
return 1;
@@ -292,16 +292,16 @@ static void init_hook(struct gps_device_t *session)
}
if (access(chrony_path, F_OK) != 0) {
- gpsd_report(&session->context->errout, LOG_PROG,
- "PPS chrony socket %s doesn't exist\n", chrony_path);
+ gpsd_log(&session->context->errout, LOG_PROG,
+ "PPS chrony socket %s doesn't exist\n", chrony_path);
} else {
session->pps_thread.chronyfd = netlib_localsocket(chrony_path, SOCK_DGRAM);
if (session->pps_thread.chronyfd < 0)
- gpsd_report(&session->context->errout, LOG_PROG,
- "PPS connect chrony socket failed: %s, error: %d, errno: %d/%s\n",
- chrony_path, session->pps_thread.chronyfd, errno, strerror(errno));
+ gpsd_log(&session->context->errout, LOG_PROG,
+ "PPS connect chrony socket failed: %s, error: %d, errno: %d/%s\n",
+ chrony_path, session->pps_thread.chronyfd, errno, strerror(errno));
else
- gpsd_report(&session->context->errout, LOG_RAW,
+ gpsd_log(&session->context->errout, LOG_RAW,
"PPS using chrony socket: %s\n", chrony_path);
}
}
@@ -338,9 +338,9 @@ static void chrony_send(struct gps_device_t *session, struct timedelta_t *td)
/*@-type@*/ /* splint is confused about struct timespec */
timespec_str( &td->real, real_str, sizeof(real_str) );
timespec_str( &td->clock, clock_str, sizeof(clock_str) );
- gpsd_report(&session->context->errout, LOG_RAW,
- "PPS chrony_send %s @ %s Offset: %0.9f\n",
- real_str, clock_str, sample.offset);
+ gpsd_log(&session->context->errout, LOG_RAW,
+ "PPS chrony_send %s @ %s Offset: %0.9f\n",
+ real_str, clock_str, sample.offset);
/*@+type@*/
(void)send(session->pps_thread.chronyfd, &sample, sizeof (sample), 0);
}
@@ -414,8 +414,8 @@ void ntpshm_link_activate(struct gps_device_t *session)
session->shm_clock = ntpshm_alloc(session->context);
if (session->shm_clock == NULL) {
- gpsd_report(&session->context->errout, LOG_INF,
- "NTPD ntpshm_alloc() failed\n");
+ gpsd_log(&session->context->errout, LOG_INF,
+ "NTPD ntpshm_alloc() failed\n");
#if defined(PPS_ENABLE)
} else if (session->sourcetype == source_usb || session->sourcetype == source_rs232) {
/* We also have the 1pps capability, allocate a shared-memory segment
@@ -423,8 +423,8 @@ void ntpshm_link_activate(struct gps_device_t *session)
* transitions
*/
if ((session->shm_pps = ntpshm_alloc(session->context)) == NULL) {
- gpsd_report(&session->context->errout, LOG_INF,
- "NTPD ntpshm_alloc(1) failed\n");
+ gpsd_log(&session->context->errout, LOG_INF,
+ "NTPD ntpshm_alloc(1) failed\n");
} else {
init_hook(session);
session->pps_thread.report_hook = report_hook;