This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHello Jenkins Builder, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1607 to look at the new patch set (#2). stats: Build UDP socket code only if sys/socket.h exists Change-Id: I6beb4fcc394ed7d3f8dd7a097b6e998245ecf401 --- M include/osmocom/core/stats.h M src/stats.c 2 files changed, 21 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/07/1607/2 diff --git a/include/osmocom/core/stats.h b/include/osmocom/core/stats.h index f754e41..09b836a 100644 --- a/include/osmocom/core/stats.h +++ b/include/osmocom/core/stats.h @@ -19,7 +19,15 @@ */ #pragma once +/* a bit of a crude way to disable building/using this on (bare iron) + * embedded systems. We cannot use the autoconf-defined HAVE_... macros + * here, as that only works at library compile time, not at application + * compile time */ +#ifdef unix + #include <sys/socket.h> +#include <arpa/inet.h> + #include <osmocom/core/linuxlist.h> #include <stdint.h> @@ -119,3 +127,5 @@ int osmo_stats_reporter_send_buffer(struct osmo_stats_reporter *srep); int osmo_stats_reporter_udp_open(struct osmo_stats_reporter *srep); int osmo_stats_reporter_udp_close(struct osmo_stats_reporter *srep); + +#endif /* unix */ diff --git a/src/stats.c b/src/stats.c index 9c826cc..0189688 100644 --- a/src/stats.c +++ b/src/stats.c @@ -21,6 +21,8 @@ * */ +#include "config.h" + #include <osmocom/core/byteswap.h> #include <osmocom/core/stats.h> @@ -30,9 +32,6 @@ #include <errno.h> #include <stdio.h> #include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> #include <osmocom/core/utils.h> #include <osmocom/core/logging.h> @@ -163,6 +162,8 @@ return NULL; } +#ifdef HAVE_SYS_SOCKET_H + int osmo_stats_reporter_set_remote_addr(struct osmo_stats_reporter *srep, const char *addr) { int rc; @@ -240,6 +241,7 @@ return update_srep_config(srep); } +#endif int osmo_stats_reporter_set_max_class(struct osmo_stats_reporter *srep, enum osmo_stats_class class_id) @@ -288,6 +290,11 @@ } /*** i/o helper functions ***/ + +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> int osmo_stats_reporter_udp_open(struct osmo_stats_reporter *srep) { @@ -381,6 +388,7 @@ return rc; } +#endif /* HAVE_SYS_SOCKET_H */ /*** log reporter ***/ -- To view, visit https://gerrit.osmocom.org/1607 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I6beb4fcc394ed7d3f8dd7a097b6e998245ecf401 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Holger Freyther <holger at freyther.de> Gerrit-Reviewer: Jenkins Builder