mirror of https://gerrit.osmocom.org/libosmocore
Fix build for OSX
Change-Id: I580a500edcf4812e570be586890abef746083a8c Reviewed-on: https://gerrit.osmocom.org/74 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
This commit is contained in:
parent
78ad042f94
commit
cc3694b650
|
@ -23,6 +23,17 @@
|
||||||
#else
|
#else
|
||||||
#error "Unknown endian"
|
#error "Unknown endian"
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#include <machine/endian.h>
|
||||||
|
#if defined(__DARWIN_LITTLE_ENDIAN)
|
||||||
|
#define OSMO_IS_LITTLE_ENDIAN 1
|
||||||
|
#define OSMO_IS_BIG_ENDIAN 0
|
||||||
|
#elif define(__DARWIN_BIG_ENDIAN)
|
||||||
|
#define OSMO_IS_LITTLE_ENDIAN 0
|
||||||
|
#define OSMO_IS_BIG_ENDIAN 1
|
||||||
|
#else
|
||||||
|
#error "Unknown endian"
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
|
|
14
src/stats.c
14
src/stats.c
|
@ -301,6 +301,14 @@ int osmo_stats_reporter_udp_open(struct osmo_stats_reporter *srep)
|
||||||
if (sock == -1)
|
if (sock == -1)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
#if defined(__APPLE__) && !defined(MSG_NOSIGNAL)
|
||||||
|
{
|
||||||
|
static int val = 1;
|
||||||
|
|
||||||
|
rc = setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (void*)&val, sizeof(val));
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (srep->bind_addr_len > 0) {
|
if (srep->bind_addr_len > 0) {
|
||||||
rc = bind(sock, &srep->bind_addr, srep->bind_addr_len);
|
rc = bind(sock, &srep->bind_addr, srep->bind_addr_len);
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
|
@ -345,7 +353,11 @@ int osmo_stats_reporter_send(struct osmo_stats_reporter *srep, const char *data,
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = sendto(srep->fd, data, data_len, MSG_NOSIGNAL | MSG_DONTWAIT,
|
rc = sendto(srep->fd, data, data_len,
|
||||||
|
#ifdef MSG_NOSIGNAL
|
||||||
|
MSG_NOSIGNAL |
|
||||||
|
#endif
|
||||||
|
MSG_DONTWAIT,
|
||||||
&srep->dest_addr, srep->dest_addr_len);
|
&srep->dest_addr, srep->dest_addr_len);
|
||||||
|
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
|
|
Loading…
Reference in New Issue