fix: Conditionally include `prctl.h` on macos
MacOS does not have the `sys/prctl.h` header. This patch conditionally
excludes `prctl.h` on MacOS and usage of its functionality in the same
way we currently do for windows.
Signed-off-by: Jack Frankland <jack.frankland@arm.com>
Change-Id: Ic56ec358552126b3a10827d9c52db388a8acc214
diff --git a/reference_model/src/func_debug.cc b/reference_model/src/func_debug.cc
index 7979c89..3ebae59 100644
--- a/reference_model/src/func_debug.cc
+++ b/reference_model/src/func_debug.cc
@@ -24,7 +24,9 @@
#ifndef _MSC_VER
#include <execinfo.h>
+#if !defined(__APPLE__) && !defined(__MACH__)
#include <sys/prctl.h>
+#endif
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -40,13 +42,13 @@
[](char ac, char bc) { return tolower(ac) == tolower(bc); });
}
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(__MACH__)
pid_t func_print_backtrace_helper(int num_tries, int sig);
#endif
void func_print_backtrace(FILE* out, int sig)
{
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(__MACH__)
for (int i = 0; i < 2; i++)
{
const pid_t child_pid = func_print_backtrace_helper(i, sig);
@@ -66,7 +68,7 @@
#endif
}
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(__MACH__)
pid_t func_print_backtrace_helper(int num_tries, int sig)
{
const pid_t child_pid = fork();