From 215bd656a09d0293162dc769389cfafa2ae2b2e8 Mon Sep 17 00:00:00 2001
From: David CARLIER <devnexen@gmail.com>
Date: Tue, 20 Jul 2021 20:37:45 +0100
Subject: [PATCH] BUILD/MINOR: memprof fix macOs build.

this platform has a similar malloc_usable_size too.
---
 include/haproxy/compat.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/haproxy/compat.h b/include/haproxy/compat.h
index 037756494..72dc3dc4f 100644
--- a/include/haproxy/compat.h
+++ b/include/haproxy/compat.h
@@ -277,6 +277,12 @@ typedef struct { } empty_t;
 #include <malloc_np.h>
 #endif
 
+/* macOS has a call similar to malloc_usable_size */
+#if defined(USE_MEMORY_PROFILING) && defined(__APPLE__)
+#include <malloc/malloc.h>
+#define malloc_usable_size malloc_size
+#endif
+
 /* Max number of file descriptors we send in one sendmsg(). Linux seems to be
  * able to send 253 fds per sendmsg(), not sure about the other OSes.
  */
-- 
2.30.1 (Apple Git-130)

