Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | From 290703a5d21f34ea5ec23efc815a9f4df241e7e8 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 23 Oct 2015 00:33:32 -0700 |
| 4 | Subject: [PATCH] Fix build with musl, backtrace() APIs are glibc specific |
| 5 | |
| 6 | Signed-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 | |
| 12 | diff --git a/userspace/libsinsp/utils.cpp b/userspace/libsinsp/utils.cpp |
| 13 | index 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 ------------"; |
| 35 | diff --git a/userspace/libsinsp/utils.h b/userspace/libsinsp/utils.h |
| 36 | index 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 | -- |
| 49 | 2.6.2 |
| 50 | |