Skip to contentSkip to conversation

libtracefs: make it build against musl C library

PATCH New Tzvetomir Stoyanov (VMware) 1 participant 1 message Dec 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libtracefs: make it build against musl C library

From: Beniamin Sandu <[email protected]>

* add some missing headers and macros
* set pthread affinity using pthread_setaffinity_np after creating the thread instead of pthread_attr_setaffinity_np (which seems to not be implemented in musl)

Tested using https://musl.cc/x86_64-linux-musl-native.tgz

---
 include/tracefs-local.h | 12 ++++++++++++
 tracefs-events.c        |  1 +
 2 files changed, 13 insertions(+)
include/tracefs-local.h +12 -0
index 9cc371b..bdbf89e 100644
@@ -13,4 +13,16 @@ void warning(const char *fmt, ...);
 int str_read_file(const char *file, char **buffer);
 char *trace_append_file(const char *dir, const char *name);
 
+#ifndef ACCESSPERMS
+#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+#endif
+
+#ifndef ALLPERMS
+#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
+#endif
+
+#ifndef DEFFILEMODE
+#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) /* 0666*/
+#endif
+
 #endif /* _TRACE_FS_LOCAL_H */
tracefs-events.c +1 -0
index ca1d22b..ee45988 100644
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <limits.h>
 
 #include <traceevent/kbuffer.h>
 
Signature · 1 line
2.28.0