diff -Naur glusterfs-3.4.2/api/src/glfs.c glusterfs-3.4.2.krb/api/src/glfs.c --- glusterfs-3.4.2/api/src/glfs.c 2014-01-03 05:17:11.000000000 -0600 +++ glusterfs-3.4.2.krb/api/src/glfs.c 2014-01-31 08:45:33.897189188 -0600 @@ -393,6 +393,11 @@ { struct glfs *fs = NULL; + { + static unsigned short instance=0; + set_pname( "gp", instance++ ); + } + fs = data; event_dispatch (fs->ctx->event_pool); diff -Naur glusterfs-3.4.2/libglusterfs/src/globals.c glusterfs-3.4.2.krb/libglusterfs/src/globals.c --- glusterfs-3.4.2/libglusterfs/src/globals.c 2014-01-03 05:17:11.000000000 -0600 +++ glusterfs-3.4.2.krb/libglusterfs/src/globals.c 2014-01-31 08:46:35.730298902 -0600 @@ -14,6 +14,7 @@ #endif /* !_CONFIG_H */ #include +#include #include "glusterfs.h" #include "globals.h" @@ -358,3 +359,19 @@ out: return ret; } + +void +set_pname( const char *label, unsigned short idx ) +{ + char cname[17]; + char app[32]; + char nname[17]; + int maxnamelen; + + prctl(PR_GET_NAME, (unsigned long)cname, 0, 0, 0); + cname[16] = 0; + + maxnamelen = sizeof(nname)-1 - snprintf( app, sizeof(app), "/%.2s:%d", label, idx ); + snprintf( nname, sizeof(nname), "%.*s%s", maxnamelen, cname, app ); + prctl(PR_SET_NAME, (unsigned long)nname, 0, 0, 0); +} diff -Naur glusterfs-3.4.2/libglusterfs/src/globals.h glusterfs-3.4.2.krb/libglusterfs/src/globals.h --- glusterfs-3.4.2/libglusterfs/src/globals.h 2014-01-03 05:17:11.000000000 -0600 +++ glusterfs-3.4.2.krb/libglusterfs/src/globals.h 2014-01-31 08:46:27.418149474 -0600 @@ -56,6 +56,9 @@ /* init */ int glusterfs_globals_init (glusterfs_ctx_t *ctx); +/* set thread name */ +void set_pname( const char *label, unsigned short idx ); + extern const char *gf_fop_list[]; #endif /* !_GLOBALS_H */ diff -Naur glusterfs-3.4.2/libglusterfs/src/syncop.c glusterfs-3.4.2.krb/libglusterfs/src/syncop.c --- glusterfs-3.4.2/libglusterfs/src/syncop.c 2014-01-03 05:17:11.000000000 -0600 +++ glusterfs-3.4.2.krb/libglusterfs/src/syncop.c 2014-01-31 08:46:53.747622553 -0600 @@ -531,6 +531,11 @@ struct syncproc *proc = NULL; struct synctask *task = NULL; + { + static unsigned short instance=0; + set_pname( "sp", instance++ ); + } + proc = thdata; env = proc->env; diff -Naur glusterfs-3.4.2/libglusterfs/src/timer.c glusterfs-3.4.2.krb/libglusterfs/src/timer.c --- glusterfs-3.4.2/libglusterfs/src/timer.c 2014-01-03 05:17:11.000000000 -0600 +++ glusterfs-3.4.2.krb/libglusterfs/src/timer.c 2014-01-31 08:46:13.209893446 -0600 @@ -129,6 +129,11 @@ gf_timer_registry_t *reg = NULL; const struct timespec sleepts = {.tv_sec = 1, .tv_nsec = 0, }; + { + static unsigned short instance=0; + set_pname( "tm", instance++ ); + } + if (ctx == NULL) { gf_log_callingfn ("timer", GF_LOG_ERROR, "invalid argument");