Skip to content

Commit e4aa7b8

Browse files
mharbison72amberpixels
authored andcommitted
process_collector: avoid a compiler warning on macOS (fixes prometheus#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 <[email protected]> Signed-off-by: Eugene <[email protected]>
1 parent b372638 commit e4aa7b8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

prometheus/process_collector_cgo_darwin.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515

1616
#include <mach/mach_init.h>
1717
#include <mach/task.h>
18-
// Compiler warns that shared_memory_server.h is deprecated, use this instead.
19-
// But this doesn't define SHARED_DATA_REGION_SIZE or SHARED_TEXT_REGION_SIZE.
20-
//#include <mach/shared_region.h>
21-
#include <mach/shared_memory_server.h>
2218
#include <mach/mach_vm.h>
2319

20+
// The compiler warns that mach/shared_memory_server.h is deprecated, and to use
21+
// mach/shared_region.h instead. But that doesn't define
22+
// SHARED_DATA_REGION_SIZE or SHARED_TEXT_REGION_SIZE, so redefine them here and
23+
// avoid a warning message when running tests.
24+
#define GLOBAL_SHARED_TEXT_SEGMENT 0x90000000U
25+
#define SHARED_DATA_REGION_SIZE 0x10000000
26+
#define SHARED_TEXT_REGION_SIZE 0x10000000
27+
2428

2529
int get_memory_info(unsigned long long *rss, unsigned long long *vsize)
2630
{

0 commit comments

Comments
 (0)