lib: Set thread names
authorBernd Schubert <bernd@bsbernd.com>
Mon, 27 Jan 2025 20:33:43 +0000 (21:33 +0100)
committerBernd Schubert <bernd@bsbernd.com>
Mon, 10 Feb 2025 15:56:45 +0000 (16:56 +0100)
Main worker threads: fuse_worker
high level clean up threads: "fuse_prune_nodes"

Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
lib/fuse.c
lib/fuse_loop_mt.c

index 8fbc035ba6edd98ca3cdce7133ace75ab4051bfc..5d57d2428d9175e883b591d6076fd5db3978e108 100644 (file)
@@ -9,6 +9,8 @@
   See the file COPYING.LIB
 */
 
+#define _GNU_SOURCE
+
 #include "fuse_config.h"
 #include "fuse_i.h"
 #include "fuse_lowlevel.h"
@@ -4890,6 +4892,8 @@ static void *fuse_prune_nodes(void *fuse)
        struct fuse *f = fuse;
        int sleep_time;
 
+       pthread_setname_np(pthread_self(), "fuse_prune_nodes");
+
        while(1) {
                sleep_time = fuse_clean_cache(f);
                sleep(sleep_time);
index 0e79b499ac1b76bd9f835e15bccad87450b58f71..95316f7fd7ce2ad0b3606026650ffb5a4b7e3f85 100644 (file)
@@ -8,6 +8,8 @@
   See the file COPYING.LIB.
 */
 
+#define _GNU_SOURCE
+
 #include "fuse_config.h"
 #include "fuse_lowlevel.h"
 #include "fuse_misc.h"
@@ -130,6 +132,8 @@ static void *fuse_do_work(void *data)
        struct fuse_worker *w = (struct fuse_worker *) data;
        struct fuse_mt *mt = w->mt;
 
+       pthread_setname_np(pthread_self(), "fuse_worker");
+
        while (!fuse_session_exited(mt->se)) {
                int isforget = 0;
                int res;