uftrace: fix musl

This commit is contained in:
Jürgen Buchmüller 2017-12-06 21:18:22 +01:00
parent 9bc133023c
commit b8bea7545c
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,13 @@
--- libmcount/plthook.c 2017-12-05 06:11:38.000000000 +0100
+++ libmcount/plthook.c 2017-12-06 21:17:22.716483918 +0100
@@ -32,6 +32,10 @@
#define PAGE_SIZE 4096
#define PAGE_ADDR(addr) ((void *)((addr) & ~(PAGE_SIZE - 1)))
+#if !defined(RTLD_DEFAULT)
+#define RTLD_DEFAULT ((void *) 0)
+#endif
+
static void segv_handler(int sig, siginfo_t *si, void *ctx)
{
if (segv_handled)

View File

@ -9,3 +9,25 @@
color(TERM_COLOR_RESET, logfp);
--- libtraceevent/event-parse.c 2017-12-05 06:11:38.000000000 +0100
+++ libtraceevent/event-parse.c 2017-12-06 21:02:42.135421115 +0100
@@ -5353,12 +5353,19 @@
const char *msg;
if (errnum >= 0) {
+#if defined(__GLIBC__)
msg = strerror_r(errnum, buf, buflen);
if (msg != buf) {
size_t len = strlen(msg);
memcpy(buf, msg, min(buflen - 1, len));
*(buf + min(buflen - 1, len)) = '\0';
}
+#else
+ int rc = strerror_r(errnum, buf, buflen);
+ if (rc < 0) {
+ snprintf(buf, buflen, "Error %d", errnum);
+ }
+#endif
return 0;
}