From 1fc8e4372bf0c7ccc7f54abe387933dc8a2de670 Mon Sep 17 00:00:00 2001 From: trey Date: Wed, 3 Feb 2010 14:55:35 +0100 Subject: patch to make rsyslog compile under Apple OS X Signed-off-by: Rainer Gerhards --- runtime/debug.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'runtime/debug.c') diff --git a/runtime/debug.c b/runtime/debug.c index a517b1ba..6d82397f 100644 --- a/runtime/debug.c +++ b/runtime/debug.c @@ -47,6 +47,9 @@ #include #include #include +#if _POSIX_TIMERS <= 0 +#include +#endif #include "rsyslog.h" #include "debug.h" @@ -844,6 +847,9 @@ do_dbgprint(uchar *pszObjName, char *pszMsg, size_t lenMsg) char pszWriteBuf[32*1024]; size_t lenWriteBuf; struct timespec t; +# if _POSIX_TIMERS <= 0 + struct timeval tv; +# endif /* The bWasNL handler does not really work. It works if no thread * switching occurs during non-NL messages. Else, things are messed @@ -869,7 +875,14 @@ do_dbgprint(uchar *pszObjName, char *pszMsg, size_t lenMsg) if(bWasNL) { if(bPrintTime) { +# if _POSIX_TIMERS > 0 + /* this is the "regular" code */ clock_gettime(CLOCK_REALTIME, &t); +# else + gettimeofday(&tv, NULL); + t.tv_sec = tv.tv_sec; + t.tv_nsec = tv.tv_usec * 1000; +# endif lenWriteBuf = snprintf(pszWriteBuf, sizeof(pszWriteBuf), "%4.4ld.%9.9ld:", (long) (t.tv_sec % 10000), t.tv_nsec); if(stddbg != -1) write(stddbg, pszWriteBuf, lenWriteBuf); -- cgit v1.2.3