1From 5feed6d2f86750bfe1e7c26d6fd4e8d2195ea81f Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
3Date: Thu, 4 Aug 2022 19:54:23 +0200
4Subject: [PATCH] src/common/transport.cc: fallback value for RUSAGE_THREAD
5
6uClibc-ng currently does not define RUSAGE_THREAD, so let's add a
7fallback value until it gets fixed in uClibc-ng. The value is the same
8on all Linux systems, regardless of the CPU architecture.
9
10Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
11Upstream bug: https://mailman.openadk.org/mailman3/hyperkitty/list/devel@uclibc-ng.org/thread/MEXOUSFSH46UFS3AEMEIEPTL5U4HVEFL/
12---
13 src/common/transport.cc | 4 ++++
14 1 file changed, 4 insertions(+)
15
16diff --git a/src/common/transport.cc b/src/common/transport.cc
17index 62efb8c..0f3abb0 100644
18--- a/src/common/transport.cc
19+++ b/src/common/transport.cc
20@@ -515,6 +515,10 @@ namespace Pistache::Tcp
21
22         rusage now;
23
24+#if !defined(RUSAGE_THREAD)
25+#define RUSAGE_THREAD 1
26+#endif
27+
28         auto res = getrusage(RUSAGE_THREAD, &now);
29         if (res == -1)
30             loadRequest_.reject(std::runtime_error("Could not compute usage"));
31--
322.37.1
33
34