void-packages/srcpkgs/qt6-webengine/patches/0302-chromium-no-mallinfo.p...

68 lines
3.0 KiB
Diff
Raw Normal View History

2022-08-08 12:13:11 +02:00
--- qt6-webengine-6.4.2.orig/src/3rdparty/chromium/base/process/process_metrics_posix.cc
+++ qt6-webengine-6.4.2/src/3rdparty/chromium/base/process/process_metrics_posix.cc
@@ -105,7 +105,8 @@ void IncreaseFdLimitTo(unsigned int max_
#endif // !BUILDFLAG(IS_FUCHSIA)
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || \
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
namespace {
size_t GetMallocUsageMallinfo() {
@@ -123,17 +124,18 @@ size_t GetMallocUsageMallinfo() {
}
} // namespace
-#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
- // BUILDFLAG(IS_ANDROID)
+#endif // (BUILDFLAG(IS_LINUX) && defined(__GLIBC__) ||
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
size_t ProcessMetrics::GetMallocUsage() {
#if BUILDFLAG(IS_APPLE)
malloc_statistics_t stats = {0};
malloc_zone_statistics(nullptr, &stats);
return stats.size_in_use;
-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+#elif (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || \
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
return GetMallocUsageMallinfo();
-#elif BUILDFLAG(IS_FUCHSIA)
+#elif BUILDFLAG(IS_FUCHSIA) || (BUILDFLAG(IS_LINUX) && !defined(__GLIBC__))
// TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
return 0;
#endif
--- qt6-webengine-6.4.2.orig/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
+++ qt6-webengine-6.4.2/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
@@ -174,7 +174,8 @@ void ReportAppleAllocStats(size_t* total
#if (BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \
(!BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \
- !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_FUCHSIA))
+ !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_FUCHSIA) && \
+ !(BUILDFLAG(IS_LINUX) && !defined(__GLIBC__)))
void ReportMallinfoStats(ProcessMemoryDump* pmd,
size_t* total_virtual_size,
size_t* resident_size,
@@ -339,7 +340,7 @@ bool MallocDumpProvider::OnMemoryDump(co
&allocated_objects_count);
#elif BUILDFLAG(IS_FUCHSIA)
// TODO(fuchsia): Port, see https://crbug.com/706592.
-#else
+#elif defined(__GLIBC__)
ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size,
&allocated_objects_size, &allocated_objects_count);
#endif
--- qt6-webengine-6.4.2.orig/src/3rdparty/chromium/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
+++ qt6-webengine-6.4.2/src/3rdparty/chromium/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
@@ -35,7 +35,7 @@ bool MemoryUsage::IsSupported() {
MemoryUsage GetMemoryUsage() {
MemoryUsage result;
-#ifdef __linux__
+#if defined(__linux__) && defined(__GLIBC__)
rusage res;
if (getrusage(RUSAGE_SELF, &res) == 0) {
result.max_rss_kb = res.ru_maxrss;