mirror of https://gerrit.osmocom.org/libosmocore
Fix embedded (arm-none-eabi) builds
Due to OS#3360, build testing for arm-none-eabi was unfortunately skipped for a long time. This is a number of fixes that make the compile test pass again. Related: OS#3360 Change-Id: I88e3c8e1a8786ca2a6a023b0d27c74be200a8588
This commit is contained in:
parent
f1e13d6081
commit
14c4c498b1
|
@ -91,6 +91,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
|
||||||
CFLAGS="$saved_CFLAGS"
|
CFLAGS="$saved_CFLAGS"
|
||||||
AC_SUBST(SYMBOL_VISIBILITY)
|
AC_SUBST(SYMBOL_VISIBILITY)
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS(clock_gettime localtime_r)
|
||||||
|
|
||||||
AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
|
AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
|
||||||
AC_CACHE_CHECK(
|
AC_CACHE_CHECK(
|
||||||
[whether struct tm has tm_gmtoff member],
|
[whether struct tm has tm_gmtoff member],
|
||||||
|
|
|
@ -356,6 +356,7 @@ static void _output(struct log_target *target, unsigned int subsys,
|
||||||
}
|
}
|
||||||
if (!cont) {
|
if (!cont) {
|
||||||
if (target->print_ext_timestamp) {
|
if (target->print_ext_timestamp) {
|
||||||
|
#ifdef HAVE_LOCALTIME_R
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
osmo_gettimeofday(&tv, NULL);
|
osmo_gettimeofday(&tv, NULL);
|
||||||
|
@ -367,6 +368,7 @@ static void _output(struct log_target *target, unsigned int subsys,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err;
|
goto err;
|
||||||
OSMO_SNPRINTF_RET(ret, rem, offset, len);
|
OSMO_SNPRINTF_RET(ret, rem, offset, len);
|
||||||
|
#endif
|
||||||
} else if (target->print_timestamp) {
|
} else if (target->print_timestamp) {
|
||||||
char *timestr;
|
char *timestr;
|
||||||
time_t tm;
|
time_t tm;
|
||||||
|
|
|
@ -96,3 +96,19 @@ char *talloc_asprintf(const void *ctx, const char *fmt, ...)
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return buf;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -59,3 +59,6 @@ void *_talloc_zero_array(const void *ctx,
|
||||||
unsigned count,
|
unsigned count,
|
||||||
const char *name);
|
const char *name);
|
||||||
char *talloc_asprintf(const void *ctx, const char *fmt, ...);
|
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);
|
||||||
|
|
|
@ -44,6 +44,9 @@
|
||||||
/*! \file timer_clockgettime.c
|
/*! \file timer_clockgettime.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_CLOCK_GETTIME
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <sys/time.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);
|
timespecadd(&c->time, &val, &c->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_CLOCK_GETTIME */
|
||||||
|
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
Loading…
Reference in New Issue