r3600 - branches/2.0/varnish-cache/bin/varnishd

tfheen at projects.linpro.no tfheen at projects.linpro.no
Thu Feb 5 11:16:46 CET 2009


Author: tfheen
Date: 2009-02-05 11:16:46 +0100 (Thu, 05 Feb 2009)
New Revision: 3600

Modified:
   branches/2.0/varnish-cache/bin/varnishd/cache.h
   branches/2.0/varnish-cache/bin/varnishd/cache_acceptor_poll.c
   branches/2.0/varnish-cache/bin/varnishd/flint.lnt
Log:
Merge r3365: A couple of stylistisc FlexeLint v9 nits, and some additions to the .lnt file.

Unfortunately the thread support in FlexeLint is not quite up to our
standards of creative locking.



Modified: branches/2.0/varnish-cache/bin/varnishd/cache.h
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-02-05 10:13:52 UTC (rev 3599)
+++ branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-02-05 10:16:46 UTC (rev 3600)
@@ -615,9 +615,25 @@
 #define MTX			pthread_mutex_t
 #define MTX_INIT(foo)		AZ(pthread_mutex_init(foo, NULL))
 #define MTX_DESTROY(foo)	AZ(pthread_mutex_destroy(foo))
+
+#ifdef __flexelint_v9__
 #define TRYLOCK(foo, r)						\
 do {								\
 	(r) = pthread_mutex_trylock(foo);			\
+} while (0)
+#define LOCK(foo)						\
+do {								\
+	AZ(pthread_mutex_lock(foo));				\
+} while (0)
+#define UNLOCK(foo)						\
+do {								\
+	AZ(pthread_mutex_unlock(foo));				\
+} while (0)
+
+#else
+#define TRYLOCK(foo, r)						\
+do {								\
+	(r) = pthread_mutex_trylock(foo);			\
 	assert(r == 0 || r == EBUSY);				\
 	if (params->diag_bitmap & 0x8) {			\
 		VSL(SLT_Debug, 0,				\
@@ -652,6 +668,7 @@
 		    "MTX_UNLOCK(%s,%s,%d," #foo ")",		\
 		    __func__, __FILE__, __LINE__);		\
 } while (0)
+#endif
 
 #if defined(HAVE_PTHREAD_MUTEX_ISOWNED_NP)
 #define ALOCKED(mutex)		AN(pthread_mutex_isowned_np((mutex)))
@@ -693,8 +710,7 @@
 {
 
 	Tcheck(t);
-	return
-	    ((unsigned)(t.e - t.b));
+	return ((unsigned)(t.e - t.b));
 }
 
 static inline void

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_acceptor_poll.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_acceptor_poll.c	2009-02-05 10:13:52 UTC (rev 3599)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_acceptor_poll.c	2009-02-05 10:16:46 UTC (rev 3600)
@@ -55,7 +55,7 @@
 vca_pollspace(unsigned fd)
 {
 	struct pollfd *newpollfd = pollfd;
-	unsigned newnpoll = npoll;
+	unsigned newnpoll;
 
 	if (fd < npoll)
 		return;

Modified: branches/2.0/varnish-cache/bin/varnishd/flint.lnt
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/flint.lnt	2009-02-05 10:13:52 UTC (rev 3599)
+++ branches/2.0/varnish-cache/bin/varnishd/flint.lnt	2009-02-05 10:16:46 UTC (rev 3600)
@@ -1,5 +1,47 @@
--passes=3
 
+-d__flexelint_v9__=1
+
+//-sem (pthread_mutex_lock, thread_lock)
+-sem (pthread_mutex_trylock, thread_lock)
+-sem (VBE_DropRefLocked, thread_unlock)
+-e459	// unlocked access from func-ptr
+-e454	// mutex not released (...ReleaseLocked)
+-e457	// unprotected access
+
+-esym(458, lbv_assert)	// unlocked access
+-esym(458, params)	// unlocked access
+
+-emacro(835, HTTPH)	// Info 835: A zero has been given as left argument to operator '&'
+-emacro(845, HTTPH)	// Info 845: The left argument to operator '&&' is certain to be 0
+//////////////
+-efunc(1791, pdiff)	// return last on line
+//////////////
+-efile(451, "sys/*.h")	// No include guard
+-efile(451, "machine/*.h")	// No include guard
+-efile(451, "vcl_returns.h")	// No include guard
+-efile(451, "cache_backend_poll.h")	// No include guard
+-efile(451, "steps.h")	// No include guard
+-efile(451, "http_headers.h")	// No include guard
+-efile(451, "stat_field.h")	// No include guard
+-efile(451, "acct_fields.h")	// No include guard
+-efile(451, "config.h")	// No include guard
+//////////////
+// -e458			// unprotected access
+// -e456			// merged locking paths
+-sem(vca_thread_acct, thread_mono)
+-sem(vca_epoll_thread, thread_mono)
+-sem(vca_kqueue_thread, thread_mono)
+-sem(vca_poll_thread, thread_mono)
+-sem(vca_ports_thread, thread_mono)
+-sem(exp_timer, thread_mono)
+-sem(wrk_herdtimer_thread, thread_mono)
+-sem(wrk_herder_thread, thread_mono)
+-esym(458, VSL_stats)
+-esym(458, heritage)
+-esym(458, name_key)
+//////////////
+-passes=1
+
 +libh mgt_event.h
 +libh ../../config.h
 



More information about the varnish-commit mailing list