From e15ac060e7ae78d4c3569d7fc9071bcf49807e05 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 4 Dec 2014 14:15:36 +0100 Subject: fix libosmocore build for NuttX target this fixes some compilation issues with libosmocore under NuttX, particularly as some #defines are missing or some header files are slightly different. --- src/application.c | 6 ++++++ src/ctrl/control_if.c | 8 ++++++-- src/gsm/a5.c | 5 +++++ src/macaddr.c | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/application.c b/src/application.c index 881f0117..9c3fe52b 100644 --- a/src/application.c +++ b/src/application.c @@ -81,10 +81,16 @@ static void sighup_hdlr(int signal) void osmo_init_ignore_signals(void) { /* Signals that by default would terminate */ +#ifdef SIGPIPE signal(SIGPIPE, SIG_IGN); +#endif signal(SIGALRM, SIG_IGN); +#ifdef SIGHUP signal(SIGHUP, &sighup_hdlr); +#endif +#ifdef SIGIO signal(SIGIO, SIG_IGN); +#endif } /*! \brief Initialize the osmocom logging framework diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index c20c1e0f..dc191209 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -31,10 +31,12 @@ #include -#include #include +#ifdef HAVE_NETINET_TCP_H +#include +#endif -#include +#include #include #include #include @@ -378,6 +380,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what) LOGP(DLCTRL, LOGL_INFO, "accept()ed new control connection from %s\n", inet_ntoa(sa.sin_addr)); +#ifdef TCP_NODELAY on = 1; ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)); if (ret != 0) { @@ -385,6 +388,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what) close(fd); return ret; } +#endif ccon = ctrl_connection_alloc(listen_bfd->data); if (!ccon) { LOGP(DLCTRL, LOGL_ERROR, "Failed to allocate.\n"); diff --git a/src/gsm/a5.c b/src/gsm/a5.c index de821e89..10a063e2 100644 --- a/src/gsm/a5.c +++ b/src/gsm/a5.c @@ -39,6 +39,11 @@ #include +/* Somme OS (like Nuttx) don't have ENOTSUP */ +#ifndef ENOTSUP +#define ENOTSUP EINVAL +#endif + /*! \brief Main method to generate a A5/x cipher stream * \param[in] n Which A5/x method to use * \param[in] key 8 byte array for the key (as received from the SIM) diff --git a/src/macaddr.c b/src/macaddr.c index 7bc44017..59c481f7 100644 --- a/src/macaddr.c +++ b/src/macaddr.c @@ -89,6 +89,7 @@ int osmo_get_macaddr(uint8_t *mac_out, const char *dev_name) #include #include +#include #include int osmo_get_macaddr(uint8_t *mac_out, const char *dev_name) -- cgit v1.2.3