summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/logging.c2
-rw-r--r--src/pseudotalloc/pseudotalloc.c16
-rw-r--r--src/pseudotalloc/talloc.h3
-rw-r--r--src/timer_clockgettime.c5
4 files changed, 26 insertions, 0 deletions
diff --git a/src/logging.c b/src/logging.c
index 147b1fb7..1dfd4847 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -356,6 +356,7 @@ static void _output(struct log_target *target, unsigned int subsys,
}
if (!cont) {
if (target->print_ext_timestamp) {
+#ifdef HAVE_LOCALTIME_R
struct tm tm;
struct timeval tv;
osmo_gettimeofday(&tv, NULL);
@@ -367,6 +368,7 @@ static void _output(struct log_target *target, unsigned int subsys,
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);
+#endif
} else if (target->print_timestamp) {
char *timestr;
time_t tm;
diff --git a/src/pseudotalloc/pseudotalloc.c b/src/pseudotalloc/pseudotalloc.c
index 2a990663..89e62696 100644
--- a/src/pseudotalloc/pseudotalloc.c
+++ b/src/pseudotalloc/pseudotalloc.c
@@ -96,3 +96,19 @@ char *talloc_asprintf(const void *ctx, const char *fmt, ...)
va_end(args);
return buf;
}
+
+void *talloc_steal(const void *new_ctx, const void *obj)
+{
+ /* as we don't do hierarchical allocations, this is simply a NOP */
+ return (void *)obj;
+}
+
+char *talloc_vasprintf(const void *t, const char *fmt, va_list ap)
+{
+ /* we have a hard-coded maximum string length of 128 bytes in this pseudo implementation */
+ char *buf = pseudotalloc_malloc(128);
+ if (!buf)
+ return NULL;
+ vsnprintf(buf, 128, fmt, ap);
+ return buf;
+}
diff --git a/src/pseudotalloc/talloc.h b/src/pseudotalloc/talloc.h
index ae2e1fc8..34088af0 100644
--- a/src/pseudotalloc/talloc.h
+++ b/src/pseudotalloc/talloc.h
@@ -59,3 +59,6 @@ void *_talloc_zero_array(const void *ctx,
unsigned count,
const char *name);
char *talloc_asprintf(const void *ctx, const char *fmt, ...);
+
+void *talloc_steal(const void *new_ctx, const void *obj);
+char *talloc_vasprintf(const void *t, const char *fmt, va_list ap);
diff --git a/src/timer_clockgettime.c b/src/timer_clockgettime.c
index 8d9760c5..7b17fd11 100644
--- a/src/timer_clockgettime.c
+++ b/src/timer_clockgettime.c
@@ -44,6 +44,9 @@
/*! \file timer_clockgettime.c
*/
+#include "config.h"
+#ifdef HAVE_CLOCK_GETTIME
+
#include <stdlib.h>
#include <stdbool.h>
#include <sys/time.h>
@@ -135,4 +138,6 @@ void osmo_clock_override_add(clockid_t clk_id, time_t secs, long nsecs)
timespecadd(&c->time, &val, &c->time);
}
+#endif /* HAVE_CLOCK_GETTIME */
+
/*! @} */