[master] 982e796 Let other OS set the thread name as well

Federico G. Schwindt fgsch at lodoss.net
Thu Nov 26 17:08:23 CET 2015


commit 982e79671d09d3a0661b8ba7e17c1108ca2eb42f
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Thu Nov 26 16:06:04 2015 +0000

    Let other OS set the thread name as well
    
    Amends 83aa5402 to handle FreeBSD and OpenBSD (at least).

diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index bc15b7c..bfb428e 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -92,7 +92,9 @@ THR_SetName(const char *name)
 {
 
 	AZ(pthread_setspecific(name_key, name));
-#ifdef HAVE_PTHREAD_SETNAME_NP
+#if defined(HAVE_PTHREAD_SET_NAME_NP)
+	pthread_set_name_np(pthread_self(), name);
+#elif defined(HAVE_PTHREAD_SETNAME_NP)
 	pthread_setname_np(pthread_self(), name);
 #endif
 }
diff --git a/config.phk b/config.phk
index 74e3391..430a887 100644
--- a/config.phk
+++ b/config.phk
@@ -287,6 +287,7 @@ exit 0
 # HAVE_DLADDR +
 # HAVE_KQUEUE +
 # HAVE_NANOSLEEP +
+# HAVE_PTHREAD_SET_NAME_NP +
 # HAVE_PTHREAD_SETNAME_NP +
 # HAVE_SETPROCTITLE +
 # HAVE_SRANDOMDEV +
diff --git a/configure.ac b/configure.ac
index d7c2d94..1062797 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,6 +248,7 @@ AC_CHECK_FUNCS([fallocate])
 
 save_LIBS="${LIBS}"
 LIBS="${PTHREAD_LIBS}"
+AC_CHECK_FUNCS([pthread_set_name_np])
 AC_CHECK_FUNCS([pthread_setname_np])
 AC_CHECK_FUNCS([pthread_mutex_isowned_np])
 AC_CHECK_FUNCS([pthread_timedjoin_np])



More information about the varnish-commit mailing list