aboutsummaryrefslogtreecommitdiffstats
path: root/testing/opencascade/no_mallinfo.patch
diff options
context:
space:
mode:
authorMarian Buschsieweke <marian.buschsieweke@ovgu.de>2019-10-15 10:22:15 +0200
committerMilan P. Stanić <mps@arvanta.net>2019-10-22 22:41:30 +0200
commitcc09448dc3b0ed20643dbc894c515c88407ebc37 (patch)
tree4334c4d252419f989ca9294f5d3ce6090d409a1d /testing/opencascade/no_mallinfo.patch
parentbd5f040a849d08e2ef29f742e34d6a601adac682 (diff)
downloadaports-cc09448dc3b0ed20643dbc894c515c88407ebc37.tar.bz2
aports-cc09448dc3b0ed20643dbc894c515c88407ebc37.tar.xz
testing/opencascade: new aport
Diffstat (limited to 'testing/opencascade/no_mallinfo.patch')
-rw-r--r--testing/opencascade/no_mallinfo.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/testing/opencascade/no_mallinfo.patch b/testing/opencascade/no_mallinfo.patch
new file mode 100644
index 0000000000..6aef939aed
--- /dev/null
+++ b/testing/opencascade/no_mallinfo.patch
@@ -0,0 +1,28 @@
+mallinfo() is not provided in musl. This patch uses getrusage() instead to use
+the maximum resident set size as a (poor) approximation of the heap usage.
+--- occt-V7_3_0p3.bin/src/OSD/OSD_MemInfo.cxx
++++ occt-V7_3_0p3/src/OSD/OSD_MemInfo.cxx
+@@ -35,6 +35,9 @@
+ #include <sstream>
+ #include <fstream>
+
++#include <sys/time.h>
++#include <sys/resource.h>
++
+ #include <OSD_MemInfo.hxx>
+
+ // =======================================================================
+@@ -147,8 +150,11 @@
+ }
+ aFile.close();
+
+- struct mallinfo aMI = mallinfo();
+- myCounters[MemHeapUsage] = aMI.uordblks;
++ // mallinfo() not available with musl. We use getrusage to approximate it
++ // with the maximum resident set size
++ struct rusage ru = { .ru_maxrss = 0 };
++ getrusage(RUSAGE_SELF, &ru);
++ myCounters[MemHeapUsage] = ru.ru_maxrss;
+
+ #elif (defined(__APPLE__))
+ struct task_basic_info aTaskInfo;