[master] 858486f Handle pthread_setname_np() and variants correctly

Federico G. Schwindt fgsch at lodoss.net
Thu Dec 10 10:11:38 CET 2015


commit 858486fc29392cf98a30d137fe76cdd6efc18cae
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Thu Dec 10 09:05:16 2015 +0000

    Handle pthread_setname_np() and variants correctly
    
    Send your kudos to POSIX for failing to provide a standard here.

diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index bfb428e..0f28302 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -95,8 +95,14 @@ THR_SetName(const char *name)
 #if defined(HAVE_PTHREAD_SET_NAME_NP)
 	pthread_set_name_np(pthread_self(), name);
 #elif defined(HAVE_PTHREAD_SETNAME_NP)
+#if defined(__APPLE__)
+	pthread_setname_np(name);
+#elif defined(__NetBSD__)
+	pthread_setname_np(pthread_self(), "%s", name);
+#else
 	pthread_setname_np(pthread_self(), name);
 #endif
+#endif
 }
 
 const char *



More information about the varnish-commit mailing list