blob: 7d3f8a19d79cc780335ddb0878f215efda79c144 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001From 290703a5d21f34ea5ec23efc815a9f4df241e7e8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 23 Oct 2015 00:33:32 -0700
4Subject: [PATCH] Fix build with musl, backtrace() APIs are glibc specific
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 userspace/libsinsp/utils.cpp | 4 +++-
9 userspace/libsinsp/utils.h | 2 +-
10 2 files changed, 4 insertions(+), 2 deletions(-)
11
12diff --git a/userspace/libsinsp/utils.cpp b/userspace/libsinsp/utils.cpp
13index 8f23f9c..c496a57 100644
14--- a/userspace/libsinsp/utils.cpp
15+++ b/userspace/libsinsp/utils.cpp
16@@ -21,7 +21,9 @@ along with sysdig. If not, see <http://www.gnu.org/licenses/>.
17 #include <limits.h>
18 #include <stdlib.h>
19 #include <sys/time.h>
20+#ifdef __GLIBC__
21 #include <execinfo.h>
22+#endif
23 #include <unistd.h>
24 #include <sys/time.h>
25 #include <netdb.h>
26@@ -741,7 +743,7 @@ uint64_t sinsp_utils::get_current_time_ns()
27 return tv.tv_sec * (uint64_t) 1000000000 + tv.tv_usec * 1000;
28 }
29
30-#ifndef _WIN32
31+#if defined(_WIN32) && defined(__GLIBC__)
32 void sinsp_utils::bt(void)
33 {
34 static const char start[] = "BACKTRACE ------------";
35diff --git a/userspace/libsinsp/utils.h b/userspace/libsinsp/utils.h
36index 600d00b..4ab4650 100644
37--- a/userspace/libsinsp/utils.h
38+++ b/userspace/libsinsp/utils.h
39@@ -79,7 +79,7 @@ public:
40
41 static uint64_t get_current_time_ns();
42
43-#ifndef _WIN32
44+#if not defined(_WIN32) && defined(__GLIBC__)
45 //
46 // Print the call stack
47 //
48--
492.6.2
50