Change in libosmocore[master]: tcp_stats: fix compilation on CentOS 7

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/.

laforge gerrit-no-reply at lists.osmocom.org
Fri Dec 24 10:39:49 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26683 )

Change subject: tcp_stats: fix compilation on CentOS 7
......................................................................

tcp_stats: fix compilation on CentOS 7

This is to fix the following compile error on CentOS 7:

[   74s] stats_tcp.c: In function 'fill_stats':
[   74s] stats_tcp.c:138:15: error: 'struct tcp_info' has no member named 'tcpi_notsent_bytes'
[   74s]        tcp_info.tcpi_notsent_bytes);
[   74s]                ^

Closes: OS#5374
Change-Id: Icde6651baeb0828477dbf540a02b16a1a5f91797
---
M configure.ac
M src/stats_tcp.c
2 files changed, 11 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/configure.ac b/configure.ac
index 8fb299b..89615fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -517,6 +517,13 @@
   [Runtime SIMD detection will be disabled])
 
 dnl There are some members in struct tcp_info that might not exist on all linux versions
+AC_CHECK_MEMBER([struct tcp_info.tcpi_notsent_bytes],
+		AC_DEFINE([HAVE_TCP_INFO_TCPI_NOTSENT_BYTES],
+		[1],
+		[Define to 1 if your <linux/tcp.h> header file have the tcpi_notsent_bytes member in struct tcp_info]),
+		[],
+		[#include <linux/tcp.h>])
+
 AC_CHECK_MEMBER([struct tcp_info.tcpi_rwnd_limited],
 		AC_DEFINE([HAVE_TCP_INFO_TCPI_RWND_LIMITED],
 		[1],
diff --git a/src/stats_tcp.c b/src/stats_tcp.c
index fffb10a..d2be6a9 100644
--- a/src/stats_tcp.c
+++ b/src/stats_tcp.c
@@ -134,8 +134,12 @@
 	osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_RTT), tcp_info.tcpi_rtt);
 	osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_RCV_RTT),
 			   tcp_info.tcpi_rcv_rtt);
+#if HAVE_TCP_INFO_TCPI_NOTSENT_BYTES == 1
 	osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_NOTSENT_BYTES),
 			   tcp_info.tcpi_notsent_bytes);
+#else
+	osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_NOTSENT_BYTES), -1);
+#endif
 
 #if HAVE_TCP_INFO_TCPI_RWND_LIMITED == 1
 	osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_RWND_LIMITED),

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26683
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Icde6651baeb0828477dbf540a02b16a1a5f91797
Gerrit-Change-Number: 26683
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211224/2a3481c4/attachment.htm>


More information about the gerrit-log mailing list