Created
March 19, 2018 22:30
-
-
Save craftyguy/bb325814ef2eeb998cc372e70b61a11f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 16191998bc9ae59b6740ae96f3c1a935d7554d65 Mon Sep 17 00:00:00 2001 | |
From: Clayton Craft <[email protected]> | |
Date: Mon, 19 Mar 2018 22:25:52 +0000 | |
Subject: [PATCH 1/2] Fix compilation on musl | |
This relied on __GLIBC__ to omit glibc-specific things so that | |
compilation will not fail on musl | |
--- | |
src/glx/glx.c | 6 ++++-- | |
src/util/ring.c | 4 +++- | |
2 files changed, 7 insertions(+), 3 deletions(-) | |
diff --git a/src/glx/glx.c b/src/glx/glx.c | |
index a8622ed..31e691a 100644 | |
--- a/src/glx/glx.c | |
+++ b/src/glx/glx.c | |
@@ -1,8 +1,9 @@ | |
#ifdef __linux__ | |
#include <linux/fb.h> | |
#endif | |
- | |
+#ifdef __GLIBC__ | |
#include <execinfo.h> | |
+#endif | |
#include <fcntl.h> | |
#include <signal.h> | |
#include <stdlib.h> | |
@@ -186,7 +187,7 @@ static void signal_handler(int sig) { | |
g_bcm_active = false; | |
bcm_host_deinit(); | |
} | |
- | |
+#ifdef __GLIBC__ | |
if (g_stacktrace) { | |
switch (sig) { | |
case SIGBUS: | |
@@ -205,6 +206,7 @@ static void signal_handler(int sig) { | |
} | |
} | |
} | |
+#endif | |
signal(sig, SIG_DFL); | |
raise(sig); | |
} | |
diff --git a/src/util/ring.c b/src/util/ring.c | |
index 94b3310..11a5069 100644 | |
--- a/src/util/ring.c | |
+++ b/src/util/ring.c | |
@@ -9,7 +9,9 @@ | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/mman.h> | |
+#ifdef __GLIBC__ | |
#include <sys/sysctl.h> | |
+#endif | |
#include <sys/types.h> | |
#include <unistd.h> | |
@@ -167,7 +169,7 @@ int ring_write(ring_t *ring, void *buf, size_t bufsize) { | |
const size_t cache_line_size() { | |
size_t size; | |
-#ifdef __linux__ | |
+#ifdef __GLIBC__ | |
size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE); | |
#elif __APPLE__ | |
size_t ret_size = sizeof(size_t); | |
-- | |
2.16.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment