X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Futil.c;h=1751c6f418f84e3736a47b25956542f2c7cd8d06;hb=8a8cd0acd09763f5edca6506bb286447c5776778;hp=c69d7d1509d95d8b9eb1bf1996908536ab6b99ed;hpb=bc9fb3a9cd588148e97eaae4eaa200faf0ac8d33;p=sliver-openvswitch.git diff --git a/lib/util.c b/lib/util.c index c69d7d150..1751c6f41 100644 --- a/lib/util.c +++ b/lib/util.c @@ -395,11 +395,19 @@ get_subprogram_name(void) } /* Sets 'name' as the name of the currently running thread or process. (This - * appears in log messages.) */ + * appears in log messages and may also be visible in system process listings + * and debuggers.) */ void set_subprogram_name(const char *name) { free(subprogram_name_set(xstrdup(name))); +#if HAVE_GLIBC_PTHREAD_SETNAME_NP + pthread_setname_np(pthread_self(), name); +#elif HAVE_NETBSD_PTHREAD_SETNAME_NP + pthread_setname_np(pthread_self(), "%s", name); +#elif HAVE_PTHREAD_SET_NAME_NP + pthread_set_name_np(pthread_self(), name); +#endif } /* Returns a pointer to a string describing the program version. The