Skip to contentSkip to conversation

libtracefs: make it build against musl C library

PATCH Superseded Tzvetomir Stoyanov (VMware) 3 participants 5 messages Dec 2, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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
#1 lore raw
Quoted 7 lines · On Wed, 2 Dec 2020 06:08:02 +0200 "Tzvetomir Stoyanov (VMware)"…

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)

Quoted 8 lines

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

Tzvetomir,

FYI, when sending patches, even for those you are not the author for, you are still required to add a Signed-off-by.

Please add that here, and I can pull it into the libtracefs repo.

Thanks!

-- Steve

Quoted 38 lines
---
 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>
 
#2 lore raw

Hey guys,

Sorry to hijack your thread, my previous replies got bounced back by the mailing list (although I sent them in Plain Text mode), so just trying again now to see if it works...

Cheers,
Beni

În mie., 2 dec. 2020 la 16:36, Steven Rostedt <[email protected]> a scris:

Quoted 71 lines
Quoted 7 lines · On Wed, 2 Dec 2020 06:08:02 +0200 "Tzvetomir Stoyanov (VMware)"…

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)

Quoted 8 lines

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

Tzvetomir,

FYI, when sending patches, even for those you are not the author for, you are still required to add a Signed-off-by.

Please add that here, and I can pull it into the libtracefs repo.

Thanks!

-- Steve

Quoted 38 lines
---
 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>
 
#3 lore raw
Quoted 6 lines · On Wed, 2 Dec 2020 20:43:58 +0200 Beniamin Sandu <[email protected]>…

Hey guys,

Sorry to hijack your thread, my previous replies got bounced back by the mailing list (although I sent them in Plain Text mode), so just trying again now to see if it works...

I see this in both my INBOX and in my trace-devel folder.

-- Steve

#4 lore raw
Quoted 6 lines · Steven Rostedt
Quoted 2 lines · On Wed, 2 Dec 2020 20:43:58 +0200 Beniamin Sandu <[email protected]>…

Hey guys,

Quoted 8 lines
Quoted 4 lines

Sorry to hijack your thread, my previous replies got bounced back by the mailing list (although I sent them in Plain Text mode), so just trying again now to see if it works...

I see this in both my INBOX and in my trace-devel folder.

-- Steve

Yep, looks like it's working now.
Thanks for the reply and for accepting my patch!

/Beni