diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-03-31 00:38:23 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-03-31 00:38:23 -0400 |
commit | 2e4a91e8dac81838a2a35e7aed5a74c3ec098e0e (patch) | |
tree | 1d171a6f656fff34a9ce7d0dfb57582dfffef232 /ppsthread.c | |
parent | e59a564ceb7190a889a98dea3793bc7a9e6104ee (diff) | |
download | gpsd-2e4a91e8dac81838a2a35e7aed5a74c3ec098e0e.tar.gz |
ppsthread.[ch] and timespec_str.c are now fully detached from the rest of GPSD.
This means they could be dropped into NTP or another time-service program.
The only requirement is to set -DHAVE_SYS_TIMEPPS_H if you want the RFC2783
code compiled in.
Diffstat (limited to 'ppsthread.c')
-rw-r--r-- | ppsthread.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ppsthread.c b/ppsthread.c index 1c270820..3e850795 100644 --- a/ppsthread.c +++ b/ppsthread.c @@ -1,6 +1,8 @@ /* * ppsthread.c - manage PPS watcher threads * + * To enable KPPS, this file needs to be compiled with -DHAVE_SYS_TIMEPPS_H + * * If you are not good at threads do not touch this file! * For example: errno is thread safe; strerror() is not. * @@ -59,7 +61,6 @@ #include <unistd.h> #include <pthread.h> /* pacifies OpenBSD's compiler */ -#include "gpsd_config.h" #include "timespec_str.h" #include "ppsthread.h" @@ -184,9 +185,12 @@ static int init_kernel_pps(volatile struct pps_thread_t *pps_thread) * Some Linuxes, like the RasbPi's, have PPS devices preexisting. * Other OS have no way to automatically determine the proper /dev/ppsX. * Allow user to pass in an explicit PPS device path. + * + * (We use strncpy() here because this might be compiled where + * strlcpy() is not available.) */ if (strncmp(pps_thread->devicename, "/dev/pps", 8) == 0) - (void)strlcpy(path, pps_thread->devicename, sizeof(path)); + (void)strncpy(path, pps_thread->devicename, sizeof(path)); else { char pps_num = '\0'; /* /dev/pps[pps_num] is our device */ size_t i; /* to match type of globbuf.gl_pathc */ |