From 3c21cc0ecf6ece86fa921a829762a735158140a8 Mon Sep 17 00:00:00 2001 From: Matt Harbison Date: Thu, 7 Nov 2024 17:22:22 -0500 Subject: [PATCH] process_collector: avoid a compiler warning on macOS (fixes #1660) The header has a warning when included, with no way to shut it off, and no alternative to obtain these symbols. They're technically architecture specific values, but they aren't different between amd64 and arm64, so combine the definitions. Signed-off-by: Matt Harbison --- prometheus/process_collector_cgo_darwin.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/prometheus/process_collector_cgo_darwin.c b/prometheus/process_collector_cgo_darwin.c index f83cf02..1554f67 100644 --- a/prometheus/process_collector_cgo_darwin.c +++ b/prometheus/process_collector_cgo_darwin.c @@ -15,12 +15,16 @@ #include #include -// Compiler warns that shared_memory_server.h is deprecated, use this instead. -// But this doesn't define SHARED_DATA_REGION_SIZE or SHARED_TEXT_REGION_SIZE. -//#include -#include #include +// The compiler warns that mach/shared_memory_server.h is deprecated, and to use +// mach/shared_region.h instead. But that doesn't define +// SHARED_DATA_REGION_SIZE or SHARED_TEXT_REGION_SIZE, so redefine them here and +// avoid a warning message when running tests. +#define GLOBAL_SHARED_TEXT_SEGMENT 0x90000000U +#define SHARED_DATA_REGION_SIZE 0x10000000 +#define SHARED_TEXT_REGION_SIZE 0x10000000 + int get_memory_info(unsigned long long *rss, unsigned long long *vsize) {