trace-cmd: fix musl build

This commit is contained in:
Jürgen Buchmüller 2020-07-18 16:47:32 +02:00
parent 629b09a519
commit 18f61641a0
4 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,16 @@
--- lib/trace-cmd/include/trace-cmd-local.h 2020-07-17 17:14:20.000000000 +0200
+++ lib/trace-cmd/include/trace-cmd-local.h 2020-07-18 16:31:32.060682767 +0200
@@ -18,8 +18,13 @@
#ifndef htonll
# if __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined(__GLIBC__)
#define htonll(x) __bswap_64(x)
#define ntohll(x) __bswap_64(x)
+#else
+#define htonll(x) __bswap64(x)
+#define ntohll(x) __bswap64(x)
+#endif
#else
#define htonll(x) (x)
#define ntohll(x) (x)

View file

@ -0,0 +1,40 @@
--- include/tracefs/tracefs.h 2020-07-17 17:14:20.000000000 +0200
+++ include/tracefs/tracefs.h 2020-07-18 16:27:27.559697340 +0200
@@ -6,6 +6,7 @@
#ifndef _TRACE_FS_H
#define _TRACE_FS_H
+#include <limits.h>
#include "traceevent/event-parse.h"
char *tracefs_get_tracing_file(const char *name);
--- lib/trace-cmd/trace-plugin.c 2020-07-17 17:14:20.000000000 +0200
+++ lib/trace-cmd/trace-plugin.c 2020-07-18 16:33:40.323675122 +0200
@@ -6,6 +6,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <dlfcn.h>
+#include <limits.h>
#include <sys/stat.h>
#include <libgen.h>
#include "trace-cmd.h"
--- tracecmd/trace-agent.c 2020-07-17 17:14:20.000000000 +0200
+++ tracecmd/trace-agent.c 2020-07-18 16:35:53.882667161 +0200
@@ -14,6 +14,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/wait.h>
--- tracecmd/trace-setup-guest.c 2020-07-17 17:14:20.000000000 +0200
+++ tracecmd/trace-setup-guest.c 2020-07-18 16:37:29.463661464 +0200
@@ -13,6 +13,7 @@
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <limits.h>
#include "trace-local.h"
#include "trace-msg.h"

View file

@ -0,0 +1,24 @@
--- tracecmd/trace-tsync.c 2020-07-17 17:14:20.000000000 +0200
+++ tracecmd/trace-tsync.c 2020-07-18 16:41:53.175645746 +0200
@@ -104,8 +104,10 @@
pthread_attr_init(&attrib);
pthread_attr_setdetachstate(&attrib, PTHREAD_CREATE_JOINABLE);
+#if defined(__GLIBC__)
if (!get_first_cpu(&pin_mask, &mask_size))
pthread_attr_setaffinity_np(&attrib, mask_size, pin_mask);
+#endif
ret = pthread_create(&instance->tsync_thread, &attrib,
tsync_host_thread, &instance->tsync);
@@ -243,8 +245,10 @@
pthread_attr_init(&attrib);
tsync->sync_proto = proto;
pthread_attr_setdetachstate(&attrib, PTHREAD_CREATE_JOINABLE);
+#if defined(__GLIBC__)
if (!get_first_cpu(&pin_mask, &mask_size))
pthread_attr_setaffinity_np(&attrib, mask_size, pin_mask);
+#endif
ret = pthread_create(thr_id, &attrib, tsync_agent_thread, tsync);

View file

@ -0,0 +1,10 @@
--- include/trace-cmd/trace-cmd.h 2020-07-17 17:14:20.000000000 +0200
+++ include/trace-cmd/trace-cmd.h 2020-07-18 16:23:27.984711620 +0200
@@ -6,6 +6,7 @@
#ifndef _TRACE_CMD_H
#define _TRACE_CMD_H
+#include <pthread.h>
#include "traceevent/event-parse.h"
#define TRACECMD_MAGIC { 23, 8, 68 }