123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- #ifndef _GPSD_OS_COMPAT_H_
- #define _GPSD_OS_COMPAT_H_
- # ifdef __cplusplus
- extern "C" {
- # endif
- #ifndef HAVE_CLOCK_GETTIME
- #include <time.h>
- #ifndef CLOCKID_T_DEFINED
- typedef int clockid_t
- #define CLOCKID_T_DEFINED
- #endif
- #if !defined(_STRUCT_TIMESPEC) && \
- !defined(_TIMESPEC) && \
- !defined(_TIMESPEC_DECLARED) && \
- !defined(__timespec_defined)
- #define _STRUCT_TIMESPEC
- struct timespec {
- time_t tv_sec
- long tv_nsec
- }
- #endif
- #define CLOCK_REALTIME 0
- int clock_gettime(clockid_t, struct timespec *)
- #endif
- int os_daemon(int nochdir, int noclose)
- #ifdef HAVE_SYSLOG_H
- #include <syslog.h>
- #if !defined(LOG_PERROR)
-
- #define LOG_PERROR 0x20
- #endif
- #else
- #define LOG_EMERG 0
- #define LOG_ALERT 1
- #define LOG_CRIT 2
- #define LOG_ERR 3
- #define LOG_WARNING 4
- #define LOG_NOTICE 5
- #define LOG_INFO 6
- #define LOG_DEBUG 7
- #define LOG_PID 0x01
- #define LOG_PERROR 0x20
- #define LOG_USER (1<<3)
- #define LOG_DAEMON (3<<3)
- void syslog(int priority, const char *format, ...)
- void openlog(const char *__ident, int __option, int __facility)
- void closelog(void)
- #endif
- #ifndef HAVE_STRLCAT
- #include <string.h>
- size_t strlcat(char *dst, const char *src, size_t size)
- #endif
- #ifndef HAVE_STRLCPY
- #include <string.h>
- size_t strlcpy(char *dst, const char *src, size_t size)
- #endif
- #ifndef SIGHUP
- #define SIGHUP 1
- #endif
- #ifndef SIGQUIT
- #define SIGQUIT 3
- #endif
- #ifndef O_NOCTTY
- #define O_NOCTTY 0400
- #endif
- #ifndef HAVE_SINCOS
- void sincos(double x, double *sinp, double *cosp)
- #endif
- # ifdef __cplusplus
- }
- # endif
- #endif
|