aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Henriques <luis@igalia.com>2025-05-22 15:55:27 +0100
committerBernd Schubert <bernd@bsbernd.com>2025-05-22 22:34:25 +0200
commitcea9b33acc13e7683e3646fca04953d14e3211b7 (patch)
tree0ba364a0d6b8750a03cd405f3f35885323d7f247
parentbaadab0492a495fda98216b351976d2e5d6d0866 (diff)
downloadlibfuse-cea9b33acc13e7683e3646fca04953d14e3211b7.tar.gz
Fix build in musl libc
Function fuse_set_thread_name() assumes that pthread_t is an unsigned long and fails to compile in musl libc with the following: ../lib/util.c: In function 'fuse_set_thread_name': ../lib/util.c:48:28: error: passing argument 1 of 'pthread_setname_np' makes \ pointer from integer without a cast [-Wint-conversion] Fix fuse_set_thread_name() by dropping the 'tid' parameter, as it is always set to pthread_self(). Signed-off-by: Luis Henriques <luis@igalia.com>
-rw-r--r--lib/fuse.c2
-rw-r--r--lib/fuse_loop_mt.c2
-rw-r--r--lib/fuse_uring.c2
-rw-r--r--lib/util.c5
-rw-r--r--lib/util.h2
5 files changed, 6 insertions, 7 deletions
diff --git a/lib/fuse.c b/lib/fuse.c
index b116661..1f01351 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -4840,7 +4840,7 @@ static void *fuse_prune_nodes(void *fuse)
struct fuse *f = fuse;
int sleep_time;
- fuse_set_thread_name(pthread_self(), "fuse_prune_nodes");
+ fuse_set_thread_name("fuse_prune_nodes");
while(1) {
sleep_time = fuse_clean_cache(f);
diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c
index 046256c..e75580c 100644
--- a/lib/fuse_loop_mt.c
+++ b/lib/fuse_loop_mt.c
@@ -132,7 +132,7 @@ static void *fuse_do_work(void *data)
struct fuse_mt *mt = w->mt;
struct fuse_session *se = mt->se;
- fuse_set_thread_name(pthread_self(), "fuse_worker");
+ fuse_set_thread_name("fuse_worker");
while (!fuse_session_exited(se)) {
int isforget = 0;
diff --git a/lib/fuse_uring.c b/lib/fuse_uring.c
index 62c5a4d..fb5cd8f 100644
--- a/lib/fuse_uring.c
+++ b/lib/fuse_uring.c
@@ -679,7 +679,7 @@ static void *fuse_uring_thread(void *arg)
snprintf(thread_name, 16, "fuse-ring-%d", queue->qid);
thread_name[15] = '\0';
- fuse_set_thread_name(pthread_self(), thread_name);
+ fuse_set_thread_name(thread_name);
fuse_uring_set_thread_core(queue->qid);
diff --git a/lib/util.c b/lib/util.c
index 7583d47..2914f1c 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -42,12 +42,11 @@ int libfuse_strtol(const char *str, long *res)
return 0;
}
-void fuse_set_thread_name(unsigned long tid, const char *name)
+void fuse_set_thread_name(const char *name)
{
#ifdef HAVE_PTHREAD_SETNAME_NP
- pthread_setname_np(tid, name);
+ pthread_setname_np(pthread_self(), name);
#else
- (void)tid;
(void)name;
#endif
}
diff --git a/lib/util.h b/lib/util.h
index d91a5e9..aae40e2 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -12,7 +12,7 @@
struct fuse_conn_info;
int libfuse_strtol(const char *str, long *res);
-void fuse_set_thread_name(unsigned long tid, const char *name);
+void fuse_set_thread_name(const char *name);
/**
* Return the low bits of a number