Skip to contentSkip to conversation

package/libfuse3: fix build failure with missing pthread_setname_np()

PATCH New Giulio Benetti 1 participant 1 message Apr 23, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libfuse3: fix build failure with missing pthread_setname_np()

Add local patch pending upstream to guard for pthread_setname_np() presence

Fixes:
https://autobuild.buildroot.net/results/f3c/f3cfaa8ed63483858ffa32b719ea4be68ba6c4f3//

---
 ...read_setname_np-exists-before-use-it.patch | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 package/libfuse3/0003-Check-if-pthread_setname_np-exists-before-use-it.patch
package/libfuse3/0003-Check-if-pthread_setname_np-exists-before-use-it.patch new file +63 -0
new file mode 100644
index 0000000000..8266e8872d
@@ -0,0 +1,63 @@
+From 27582a0f4672f8a770e73d6a05002dea86169906 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Wed, 23 Apr 2025 14:28:29 +0200
+Subject: [PATCH] Check if pthread_setname_np() exists before use it
+
+Since pthread_setname_np() is the only pthread function that requires NPTL
+and it basically only set thread name, let's check if pthread_setname_np()
+does exist, otherwise let's not call pthread_setname_np() to shrink
+dependencies.
+
+Upstream: https://github.com/libfuse/libfuse/pull/1202
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ lib/fuse.c         | 2 ++
+ lib/fuse_loop_mt.c | 2 ++
+ meson.build        | 3 ++-
+ 3 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/lib/fuse.c b/lib/fuse.c
+index 136f0c2..49f5711 100644
+--- a/lib/fuse.c
++++ b/lib/fuse.c
+@@ -4917,7 +4917,9 @@ static void *fuse_prune_nodes(void *fuse)
+ 	struct fuse *f = fuse;
+ 	int sleep_time;
+ 
++#ifdef HAVE_PTHREAD_SETNAME_NP
+ 	pthread_setname_np(pthread_self(), "fuse_prune_nodes");
++#endif
+ 
+ 	while(1) {
+ 		sleep_time = fuse_clean_cache(f);
+diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c
+index 95316f7..d6be998 100644
+--- a/lib/fuse_loop_mt.c
++++ b/lib/fuse_loop_mt.c
+@@ -132,7 +132,9 @@ static void *fuse_do_work(void *data)
+ 	struct fuse_worker *w = (struct fuse_worker *) data;
+ 	struct fuse_mt *mt = w->mt;
+ 
++#ifdef HAVE_PTHREAD_SETNAME_NP
+ 	pthread_setname_np(pthread_self(), "fuse_worker");
++#endif
+ 
+ 	while (!fuse_session_exited(mt->se)) {
+ 		int isforget = 0;
+diff --git a/meson.build b/meson.build
+index f28df3d..a3aa735 100644
+--- a/meson.build
++++ b/meson.build
+@@ -72,7 +72,8 @@ private_cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
+ # Test for presence of some functions
+ test_funcs = [ 'fork', 'fstatat', 'openat', 'readlinkat', 'pipe2',
+                'splice', 'vmsplice', 'posix_fallocate', 'fdatasync',
+-               'utimensat', 'copy_file_range', 'fallocate', 'static_assert' ]
++               'utimensat', 'copy_file_range', 'fallocate', 'static_assert',
++               'pthread_setname_np' ]
+ foreach func : test_funcs
+     private_cfg.set('HAVE_' + func.to_upper(),
+         cc.has_function(func, prefix: include_default, args: args_default))
+-- 
+2.39.5
+
Signature · 6 lines
2.39.5

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot