diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-03-31 00:16:24 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-03-31 00:16:24 -0400 |
commit | e59a564ceb7190a889a98dea3793bc7a9e6104ee (patch) | |
tree | 141109f1e6ef5572f56ac8349ad069531be52034 /ppsthread.c | |
parent | f920451aead7bd406dcf7021382fa00c141bde78 (diff) | |
download | gpsd-e59a564ceb7190a889a98dea3793bc7a9e6104ee.tar.gz |
Loosen ppsthread.c's ties to the rest of GPSD.
Soon, being able to drop it into NTP may be valuable.
The only remaining adhesion is that it needs gpsd_config.h for the
status of HAVE_SYS_TIMEPPS_H.
No code changes.
Diffstat (limited to 'ppsthread.c')
-rw-r--r-- | ppsthread.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/ppsthread.c b/ppsthread.c index af42fe78..1c270820 100644 --- a/ppsthread.c +++ b/ppsthread.c @@ -57,16 +57,24 @@ #include <pthread.h> #include <sys/socket.h> #include <unistd.h> +#include <pthread.h> /* pacifies OpenBSD's compiler */ #include "gpsd_config.h" #include "timespec_str.h" #include "ppsthread.h" -#include "compiler.h" /* required for erno thread-safety */ -#ifdef PPS_ENABLE -#if defined(HAVE_SYS_TIMEPPS_H) -#include <fcntl.h> /* needed for open() and friends */ -#endif /* defined(HAVE_SYS_TIMEPPS_H) */ +/* + * Tell GCC that we want thread-safe behavior with _REENTRANT; + * in particular, errno must be thread-local. + * Tell POSIX-conforming implementations with _POSIX_THREAD_SAFE_FUNCTIONS. + * See http://www.unix.org/whitepapers/reentrant.html + */ +#ifndef _REENTRANT +#define _REENTRANT +#endif +#ifndef _POSIX_THREAD_SAFE_FUNCTIONS +#define _POSIX_THREAD_SAFE_FUNCTIONS +#endif /* * Warning: This is a potential portability problem. @@ -78,9 +86,9 @@ */ #include <sys/ioctl.h> -#include <pthread.h> /* pacifies OpenBSD's compiler */ #if defined(HAVE_SYS_TIMEPPS_H) #include <glob.h> +#include <fcntl.h> /* needed for open() and friends */ #endif #if defined(TIOCMIWAIT) @@ -1276,7 +1284,5 @@ int pps_thread_ppsout(volatile struct pps_thread_t *pps_thread, return ret; } -#endif /* PPS_ENABLE */ - /* end */ |