From 27a3217bfce20d755de022fb924eaff2c9f4fa20 Mon Sep 17 00:00:00 2001
From: David CARLIER <devnexen@gmail.com>
Date: Mon, 11 Apr 2022 12:41:24 +0100
Subject: [PATCH 1/2] BUILD/SMALL: tcp_sample clarifying samples support per
 os,  for further expansion.

---
 src/tcp_sample.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/tcp_sample.c b/src/tcp_sample.c
index 895a1306f..c0d3f2eae 100644
--- a/src/tcp_sample.c
+++ b/src/tcp_sample.c
@@ -363,6 +363,7 @@ static inline int get_tcp_info(const struct arg *args, struct sample *smp,
 	return 1;
 }
 
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 /* get the mean rtt of a client connection */
 static int
 smp_fetch_fc_rtt(const struct arg *args, struct sample *smp, const char *kw, void *private)
@@ -376,7 +377,9 @@ smp_fetch_fc_rtt(const struct arg *args, struct sample *smp, const char *kw, voi
 
 	return 1;
 }
+#endif
 
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 /* get the variance of the mean rtt of a client connection */
 static int
 smp_fetch_fc_rttvar(const struct arg *args, struct sample *smp, const char *kw, void *private)
@@ -390,9 +393,10 @@ smp_fetch_fc_rttvar(const struct arg *args, struct sample *smp, const char *kw,
 
 	return 1;
 }
+#endif
 
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 /* get the unacked counter on a client connection */
 static int
 smp_fetch_fc_unacked(const struct arg *args, struct sample *smp, const char *kw, void *private)
@@ -401,7 +405,9 @@ smp_fetch_fc_unacked(const struct arg *args, struct sample *smp, const char *kw,
 		return 0;
 	return 1;
 }
+#endif
 
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 /* get the sacked counter on a client connection */
 static int
 smp_fetch_fc_sacked(const struct arg *args, struct sample *smp, const char *kw, void *private)
@@ -410,7 +416,9 @@ smp_fetch_fc_sacked(const struct arg *args, struct sample *smp, const char *kw,
 		return 0;
 	return 1;
 }
+#endif
 
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 /* get the lost counter on a client connection */
 static int
 smp_fetch_fc_lost(const struct arg *args, struct sample *smp, const char *kw, void *private)
@@ -419,7 +427,9 @@ smp_fetch_fc_lost(const struct arg *args, struct sample *smp, const char *kw, vo
 		return 0;
 	return 1;
 }
+#endif
 
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 /* get the retrans counter on a client connection */
 static int
 smp_fetch_fc_retrans(const struct arg *args, struct sample *smp, const char *kw, void *private)
@@ -428,7 +438,9 @@ smp_fetch_fc_retrans(const struct arg *args, struct sample *smp, const char *kw,
 		return 0;
 	return 1;
 }
+#endif
 
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 /* get the fackets counter on a client connection */
 static int
 smp_fetch_fc_fackets(const struct arg *args, struct sample *smp, const char *kw, void *private)
@@ -437,7 +449,9 @@ smp_fetch_fc_fackets(const struct arg *args, struct sample *smp, const char *kw,
 		return 0;
 	return 1;
 }
+#endif
 
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 /* get the reordering counter on a client connection */
 static int
 smp_fetch_fc_reordering(const struct arg *args, struct sample *smp, const char *kw, void *private)
@@ -446,7 +460,7 @@ smp_fetch_fc_reordering(const struct arg *args, struct sample *smp, const char *
 		return 0;
 	return 1;
 }
-#endif // linux || freebsd || netbsd
+#endif
 #endif // TCP_INFO
 
 /* Note: must not be declared <const> as its list will be overwritten.
@@ -480,10 +494,20 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
 	{ "fc_rttvar",        smp_fetch_fc_rttvar,        ARG1(0,STR), val_fc_time_value, SMP_T_SINT, SMP_USE_L4CLI },
 #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 	{ "fc_unacked",       smp_fetch_fc_unacked,       ARG1(0,STR), var_fc_counter, SMP_T_SINT, SMP_USE_L4CLI },
+#endif // linux || freebsd || netbsd
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 	{ "fc_sacked",        smp_fetch_fc_sacked,        ARG1(0,STR), var_fc_counter, SMP_T_SINT, SMP_USE_L4CLI },
+#endif // linux || freebsd || netbsd
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 	{ "fc_retrans",       smp_fetch_fc_retrans,       ARG1(0,STR), var_fc_counter, SMP_T_SINT, SMP_USE_L4CLI },
+#endif // linux || freebsd || netbsd
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 	{ "fc_fackets",       smp_fetch_fc_fackets,       ARG1(0,STR), var_fc_counter, SMP_T_SINT, SMP_USE_L4CLI },
+#endif // linux || freebsd || netbsd
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 	{ "fc_lost",          smp_fetch_fc_lost,          ARG1(0,STR), var_fc_counter, SMP_T_SINT, SMP_USE_L4CLI },
+#endif // linux || freebsd || netbsd
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 	{ "fc_reordering",    smp_fetch_fc_reordering,    ARG1(0,STR), var_fc_counter, SMP_T_SINT, SMP_USE_L4CLI },
 #endif // linux || freebsd || netbsd
 #endif // TCP_INFO
-- 
2.32.0 (Apple Git-132)

