summaryrefslogtreecommitdiff
path: root/sys-apps/ibm-powerpc-utils/files/ibm-powerpc-utils-1.3.8-musl.patch
blob: 5357e5fdcef319e892e09cc4a2a045e519811cd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
From ec0eb99a402ff9371965c2c8726bc400674215b7 Mon Sep 17 00:00:00 2001
From: Fabian Groffen <grobian@gentoo.org>
Date: Fri, 21 May 2021 11:25:21 +0200
Subject: [PATCH] add includes/defines for musl libc support

- add some missing includes to get proper definitions for beXXtoh and
  PATH_MAX
- guard backtrace() from execinfo.h usage for it is glibc only

PR: https://github.com/ibm-power-utilities/powerpc-utils/pull/63
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
---
 src/common/cpu_info_helpers.c | 1 +
 src/drmgr/common.c            | 6 ++++++
 src/drmgr/dr.h                | 1 +
 src/rtas_dbg.c                | 1 +
 4 files changed, 9 insertions(+)

diff --git a/src/common/cpu_info_helpers.c b/src/common/cpu_info_helpers.c
index 3d08ff7..925f220 100644
--- a/src/common/cpu_info_helpers.c
+++ b/src/common/cpu_info_helpers.c
@@ -29,6 +29,7 @@
 #include <errno.h>
 #include <stdbool.h>
 #include <dirent.h>
+#include <limits.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include "cpu_info_helpers.h"
diff --git a/src/drmgr/common.c b/src/drmgr/common.c
index 5e8135b..32cf805 100644
--- a/src/drmgr/common.c
+++ b/src/drmgr/common.c
@@ -28,7 +28,9 @@
 #include <signal.h>
 #include <errno.h>
 #include <dirent.h>
+#ifdef __GLIBC__
 #include <execinfo.h>
+#endif
 #include <ctype.h>
 #include <sys/wait.h>
 #include <endian.h>
@@ -853,6 +855,7 @@ sighandler(int signo)
 	say(ERROR, "Received signal %d, attempting to cleanup and exit\n",
 	    signo);
 
+#ifdef __GLIBC__
 	if (log_fd) {
 		void *callstack[128];
 		int sz;
@@ -860,6 +863,7 @@ sighandler(int signo)
 		sz = backtrace(callstack, 128);
 		backtrace_symbols_fd(callstack, sz, log_fd);
 	}
+#endif
 
 	dr_fini();
 	exit(-1);
@@ -925,8 +929,10 @@ sig_setup(void)
 	if (sigaction(SIGBUS, &sigact, NULL))
 		return -1;
 
+#ifdef __GLIBC__
 	/* dummy call to backtrace to get symbol loaded */
 	backtrace(callstack, 128);
+#endif
 	return 0;
 }
 
diff --git a/src/drmgr/dr.h b/src/drmgr/dr.h
index f171bfe..b32d49a 100644
--- a/src/drmgr/dr.h
+++ b/src/drmgr/dr.h
@@ -26,6 +26,7 @@
 #include <nl_types.h>
 #include <unistd.h>
 #include <stdarg.h>
+#include <limits.h>
 #include "rtas_calls.h"
 #include "drpci.h"
 
diff --git a/src/rtas_dbg.c b/src/rtas_dbg.c
index 526e78b..ebc7474 100644
--- a/src/rtas_dbg.c
+++ b/src/rtas_dbg.c
@@ -32,6 +32,7 @@
 #include <getopt.h>
 #include <dirent.h>
 #include <string.h>
+#include <endian.h>
 #include <sys/syscall.h>
 #include <unistd.h>
 #include <linux/unistd.h>